Skip to content

Fix SMB:// in capitals, unreadable downloads and lost Stash ratings - #105

Merged
seaweeduk merged 2 commits into
masterfrom
fix/files-network
Nov 22, 2026
Merged

seaweeduk merged 2 commits into
masterfrom
fix/files-network

Conversation

@seaweeduk

@seaweeduk seaweeduk commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Fixes for files, network shares and Stash write-back.

  • SMB:// and SFTP:// in capitals were taken for web links, which never opened ("No protocol handler" for SMB, "Protocol not found" for SFTP). smb:// and sftp:// are now recognised in any case. The app and the library keep the scheme in lowercase (remote::lowerScheme()), so SMB://nas/media/a.mp4 finds the same record as smb://nas/media/a.mp4. Typing SMB://nas in Add a computer now names nas instead of a host called smb:.

    • Library keys only change for addresses with a capitalised scheme. A link row kept for one of these before stays in the database untouched.
  • Downloads: a local source whose stat() failed for any reason (permission denied on a parent folder, say) failed with "The video isn't there any more". It now fails as gone only when the file doesn't exist (ENOENT/ENOTDIR), as a remote source does. Otherwise it waits and is tried again every 10 s. A local source that can't be read, at the start or partway through the copy, now says so; a failed write to the drive still waits as before.

    Local source Before After
    stat() fails, file there Failed: "The video isn't there any more" Waiting: "The video can't be read; trying again"
    Read fails (start or mid-copy) Waiting: "Waiting for the server" Waiting: "The video can't be read; trying again"

    The message is a new string, with all six translations.

  • Stash outbox: a rating or play that couldn't be written to the outbox was logged and dropped. It now stays in memory, in order, and is tried again with the next rating or play, before the next send or send preview, and once more when the worker stops. The outbox file format is unchanged.

    Outbox unwritable for the first change, then writable Before After
    A rating, then a play: what the outbox holds 0 ratings, 1 play 1 rating, 1 play
    A play, then the app closes: what the outbox holds 0 plays 1 play
    A play, then "Send my ratings and plays" with that play in the library: times sent to Stash [123] [123]
  • Pinning /: the file browser no longer offers to pin /, as first-run setup already didn't (File system has no tick there). Pinning it would put every video on the device into the Library, apps' and games' videos and every mounted drive's included. One small check, Places::pinnable(), is shared by both. An existing pin of / still shows Unpin, so it can be removed. Whole computers (smb://nas) and shares stay pinnable.

Known and left as is

  • Library::addCopy() still assumes it gets a file path. Its only caller passes completed downloads; folder pins go through Places.
  • If the outbox file is already read-only when the app opens it, SQLite opens it read-only and the app keeps that handle until it restarts, so making the file writable again mid-run doesn't help. It takes someone changing the permissions of the app's own data file while it runs. Ratings and plays made meanwhile stay in memory and are lost when the app closes.

Important

AI disclosure

Model Variant Role
anthropic/claude-opus-5-5 high Implementation
openai/gpt-6.2-astra high Independent review

Agent harness OpenCode 2.3.2

@seaweeduk seaweeduk added the fix Bug fix (release notes: Fixes) label Nov 22, 2026
@opencode-agent

Copy link
Copy Markdown
  1. Medium — Stash retries can stay read-only after permissions are restored (src/stash_write_back.cpp:50–56, src/stash_outbox.cpp:78–91). If an existing outbox is readable but not writable when first opened, SQLite on Linux can return success with a read-only connection. StashOutbox::open() caches that connection and returns immediately on every subsequent call. Restoring the file’s write permission therefore does not help keep(): the next event, send preview, and shutdown retry all use the same read-only handle. The queued changes are lost when the worker exits even though the file is writable by then. After sqlite3_open_v2() succeeds, check sqlite3_db_readonly(db_, "main"); if read-only, report the write error, close the handle, and reset db_ so the next retry reopens it.

  2. Low — A successful send preview leaves Settings showing the old outbox status (src/stash_write_back.cpp:447–449, 468–475). If a play could not be saved because the drive was full, freeing space and opening “Send my ratings and plays” can now save it. The preview correctly counts that play as waiting, but only the send path recounts and publishes the write-back status. Closing the preview without sending leaves Settings showing the previous write error and omitting the newly queued play. When a preview retries a nonempty unsaved queue, refresh and publish the waiting counts and the result of that write.

github run

@seaweeduk

Copy link
Copy Markdown
Owner Author

/oc Please re-review the change since the first review.

  1. A read-only outbox handle kept after permissions are restored: declined. SQLite opens the outbox read-only only if the app's own stash_outbox.db in its data folder is already write-protected when it's first opened. Recovering mid-run then needs someone to change that file's permissions while the app runs. That depends on someone changing the app's own state by hand. Disk full, the realistic case, opens normally and its retries work. It's listed under "Known and left as is".
  2. A send preview that saves retried events leaves the status stale: fixed in ba13963. When the preview's keep() had events waiting, the worker now sets status.error from that write, recounts with counted(), and publishes, as the event path does.

@opencode-agent

Copy link
Copy Markdown

No new findings. ba139633 fixes the stale Settings status: when a preview retries pending events, the worker updates the write error, recounts waiting ratings and plays, and publishes the status even if the user closes the preview without sending. A preview with nothing to retry leaves the existing status alone.

The cached read-only SQLite handle remains a documented, accepted limitation. I found no reason to reopen it in this follow-up.

Verified by code inspection and git diff --check; the retry scenario was not run.

github run

@seaweeduk
seaweeduk changed the base branch from refactor/wave-5 to master November 22, 2026 21:00
@seaweeduk
seaweeduk merged commit 1153bf6 into master Nov 22, 2026
@seaweeduk
seaweeduk deleted the fix/files-network branch November 22, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix (release notes: Fixes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant