Repository navigation
feat(upload): skip already-uploaded photos via the shared upload ledger - #93
Conversation
`photos upload` now uses the SDK 0.3.6 upload ledger (~/.rawback/upload-ledger.jsonl, shared with Desktop) and confirms each upload with the server. - Before reading any metadata, files the ledger settles are skipped: a server-confirmed photo, or a photo without a capture time that was transferred before. A photo whose confirmation failed keeps going to the server's check, with its capture time taken from the ledger. - A photo confirmed at another path (moved folder, second copy) is skipped by filename + capture time and recorded at its new path. - The server's existing photos found at review are recorded with their image ids. - After the transfer, uploaded photos are confirmed with `matchUploadIdentities`: matches are recorded as `server`; photos the server does not have are forgotten and uploaded again next time. The summary reports Confirmed and Unconfirmed. - The upload-state resume record now only skips photos without a capture time; the rest are checked with the server once and remembered. - `--recheck` ignores local history and asks the server about every file. - The remote check uses the SDK's batched helper instead of its own loop. - Bumps @rawback/sdk to 0.3.6, which also brings bun.lock back in line with package.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013P4VoitjQTCoqBXwDacJQi
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
/claude review |
|
Claude finished @AnnatarHe's task in 25s —— View job Review of PR #93: skip already-uploaded photos via the shared upload ledgerI read the The design holds together. Fast skip comes before the EXIF read, the ledger and resume record keep distinct trust rules, and every ledger failure degrades to a warning. I found no blocking bugs, only the points below.
Worth considering
Minor
|
Why
A successful SFTP close doesn't say whether Rawback stored the photo, found it to be a duplicate, or failed to record it. Until now, every
photos uploadre-read EXIF for every file and asked the server again. Photos with no capture time, which the server can't deduplicate, were uploaded again on every run.rawback-app/sdk#57 (released in 0.3.6) added a shared upload ledger,
~/.rawback/upload-ledger.jsonl, and a batched server check. This PR wires both into the CLI's own transfer loop. Desktop gets the same through the SDK'sUploadManagerin a separate PR.What
Fast skip before any metadata read. Files the ledger settles are skipped at the cost of one
stat:A photo whose confirmation request failed still goes to the server's check. Its capture time comes from the ledger, so it skips the EXIF read. This is the same rule the SDK's
UploadManagerapplies.Moved or copied photos. A photo confirmed at another path is skipped by filename + capture time, and recorded at its new path.
Acknowledgement. After the transfer, the uploaded photos are checked with the server through
matchUploadIdentities.serverwith their image id.The summary now shows Confirmed, and Unconfirmed when there are any. Each confirmed photo is one ledger line.
Remote matches found at review are recorded with their image ids.
Legacy resume record. The
upload-state.jsonresume record now only skips photos with no capture time. Other photos are checked with the server once and remembered in the ledger after that. So a photo the server never recorded is no longer skipped forever.--recheckignores the ledger and the resume record and asks the server about every file. What it learns is still recorded.Remote check. It now uses the SDK's batched helper (500 per request) instead of its own 200-per-request loop. It still fails open.
Ledger location. The ledger sits beside the upload state, so tests that point
statePathat a temp dir never touch~/.rawback.Output. The dry-run's "Completed" field is now "Already uploaded". A dry run never writes the ledger.
SDK bump.
@rawback/sdkgoes to 0.3.6. This also bringsbun.lockback in line withpackage.json(it was pinned at 0.3.6 but locked at 0.3.5).Docs.
docs/commands.mdanddocs/configuration.mdgain a new "Upload acknowledgements" section, the README file table andAGENTS.mdlist the new file, and I fixed a garbled paragraph in the upload behaviour section.Testing
bun run checkpasses: typecheck, 741 tests, lint, format, and the compiled binary build.New tests in
test/upload.test.ts:--recheckchecks every file.The help test covers
--recheck.End to end. I ran the real
runUploadagainst an ssh2 SFTP server, through the CLI's realSftpClientand real exiftool. The server records photos on CLOSE and fails CLOSE for one file.transfer, and the refused file failed.Generated by Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.