Skip to content

Delete diff images, their routes, and review.json (diffs step 6) - #120

Merged
nedtwigg merged 5 commits into
mainfrom
delete-diff-images
Nov 30, 2026
Merged

nedtwigg merged 5 commits into
mainfrom
delete-diff-images

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Merge only after app.selfie.dev is deployed from a main that includes #119. The production Worker still runs a page that asks for /api/diffs and diff images, and CI pushes with the CLI from each PR's commit.

The last of step 6 in docs/plans/diffs.md: no diff image is made, kept, or served, except by selfie diff and selfie flakes on demand, and review.json is gone.

Removed

  • Routes: GET /api/diffs/:current/:golden and /image (ui/src/server/app.ts). The sync routes PUT /diffs/:current/:golden, PUT /diffs/:current/:golden/image, and GET /batches/:id/diffs/needed (ui/src/server/sync.ts). The needed-pairs helper is folded into derived/needed, its only user.
  • ReviewSource.diffStats and diffImage, in the local source with its 32-pair cache (cli/src/ui.ts) and in the hosted one.
  • StoredDiffs' image and stats methods. What's left only keeps derived blobs, so it's renamed DerivedBlobs (store/src/core/derived-blobs.ts), with put, has, get, hasEach, and getEach. The project field is now derived instead of diffs.
  • review.json: its writer, ReviewCache, writeReviewCache, and readReviewCache, which was a library export. The CHANGELOG says so under Removed.
  • The DiffPair alias, which is now just ImagePair.

What push sends now

uploadRecords asks derived/needed?tag=diff-1 and sends each pair's record: the one this store keeps, or one it works out, fetching any image it lacks. It skips a record larger than 64 KiB. diffs in its JSON keeps its name and now counts records sent, since push's JSON has no schema version to raise. A remote with no derived routes still answers not-found, which push takes as wanting nothing.

Heads-up, for the owner to decide: selfie push from the released 0.1.0 calls diffs/needed without a fallback. Once a Worker from this PR is deployed, that push fails at its last step (exit 2), after the batch, images, decisions, and status have all gone. The CHANGELOG tells people to upgrade. If 0.1.0 pushes in anyone's CI matter, a stub diffs/needed that answers { pairs: [] } would keep them green.

After deploying

OPERATIONS.md → Deleting R2's diff images is a one-time cleanup for the owner. It checks that the deployed app/* tag includes this PR and names no diffs/ key. It then adds an R2 lifecycle rule per project, projects/<id>/diffs/, with --expire-days 1, and removes the rules once the dashboard shows the prefixes empty. Nothing here has been run.

Specs

Tests

pnpm -r typecheck is clean. pnpm test passes in about 44 s: cli 553, store 661, ui 160 including workerd, and render 147. Tests of the removed routes and cache are deleted. The auth-adapter test now covers /images and POST /derived/read. The pruned-batch test checks images only. The --baseline test checks the exported image instead of review.json.

🤖 Generated with Claude Code

nedtwigg and others added 5 commits November 30, 2026 04:17
The server serves no diff image or stats, push sends records only, and
selfie review writes no review.json. StoredDiffs keeps only derived blobs,
so it is DerivedBlobs, and a project's field for it is derived.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Specs drop the diff routes, review.json, and push's diff upload.
OPERATIONS.md says how to delete R2's diffs/ once the Worker that
read it is gone, and the plan marks steps 0 to 6 done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the auth test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@selfie-bot selfie-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found nothing to change in the code, specs, or the R2 cleanup steps. I'm holding back approval because of the PR's own condition: merge only once app.selfie.dev runs a main that includes #119. That isn't met yet. #119 merged as f23301ca03c16cb3f07b572153b026a804caf40a, and the newest deploy tag, app/2026-11-29--r2, doesn't contain that commit.

@nedtwigg

Copy link
Copy Markdown
Member Author

Agreed, and that's intended: the coordinator holds this until app.selfie.dev is deployed from a main that includes #119 (f23301c). Nothing to change in the meantime. Once it's deployed, a re-review can approve.

@nedtwigg

Copy link
Copy Markdown
Member Author

@selfie-bot app.selfie.dev is now deployed from main at f23301c, which includes #119: run 46461427051, tagged app/2026-11-30. POST /diffplug/selfie/api/derived/read answers {"held":[]} there. Please review again.

@nedtwigg
nedtwigg merged commit 59b63a2 into main Nov 30, 2026
7 checks passed
@nedtwigg
nedtwigg deleted the delete-diff-images branch November 30, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants