Let the bucket be authoritative for cabinets and bezels #69

Open
charles wants to merge 0 commits from feat/r2-authoritative into main
Owner

One HEAD per file answers both questions:

  • the mirror has a different file -> take the mirror copy
  • the mirror no longer has it -> delete it
  • the mirror cannot be reached -> change nothing

Difference is judged on content: R2 returns each object MD5 as its ETag. Multipart uploads fall back to length.

Deleting is narrower than overwriting and is confined to files recorded as having come from the bucket, so LaunchBox and libretro art is never taken away. Wheels are excluded entirely: the mirror is their last resort by design.

One HEAD per file answers both questions: - the mirror has a different file -> take the mirror copy - the mirror no longer has it -> delete it - the mirror cannot be reached -> change nothing Difference is judged on content: R2 returns each object MD5 as its ETag. Multipart uploads fall back to length. Deleting is narrower than overwriting and is confined to files recorded as having come from the bucket, so LaunchBox and libretro art is never taken away. Wheels are excluded entirely: the mirror is their last resort by design.
Artwork removed from the mirror stayed on the cabinet forever, and artwork the
mirror held a better copy of was never taken: the fetcher skips any game that
already has a file, so the first source to answer won permanently. Wiring the
bucket up changed almost nothing for a cabinet that had already fetched art --
it only ever filled gaps.

One HEAD per file answers both questions, so they run as a single pass:

  the mirror has a different file  ->  take the mirror's
  the mirror no longer has it      ->  delete it
  the mirror cannot be reached     ->  change nothing

Difference is judged on content. R2 returns each object's MD5 as its ETag, so
both sides are a real hash for the price of a header that arrives anyway;
length is the fallback for a multipart upload, whose ETag is a hash of hashes
and is not the MD5 of anything.

Deleting is deliberately narrower than overwriting. Overwriting replaces a
worse copy with the cabinet's own; deleting removes art that would otherwise
still be on screen, so it is confined to files recorded as having come from
the bucket -- LaunchBox and libretro art in the same directories is somebody
else's to keep. That is what the new .arcade-nix-r2 manifest is for.

The three-way answer is the point of the whole thing. A cabinet that loses its
network, its credentials or the bucket would otherwise read 404 everywhere and
delete every piece of artwork it has.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nz3es8PajUzXmqJJiK6yRB
Cabinets and bezels follow the mirror: its copy wins where they differ, and
what it drops is dropped here. Wheels are excluded on purpose -- the mirror is
their last resort, behind LaunchBox's Clear Logos and libretro's Named_Logos,
and overwriting on difference would quietly promote it to first.

Bezels get the same three-way answer and the same asymmetry: overwrite freely,
delete only what a manifest records as having come from the bucket, so an
archive.org pack or a hand-made bezel is never taken away.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nz3es8PajUzXmqJJiK6yRB
This branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/r2-authoritative:feat/r2-authoritative
git switch feat/r2-authoritative

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff feat/r2-authoritative
git switch feat/r2-authoritative
git rebase main
git switch main
git merge --ff-only feat/r2-authoritative
git switch feat/r2-authoritative
git rebase main
git switch main
git merge --no-ff feat/r2-authoritative
git switch main
git merge --squash feat/r2-authoritative
git switch main
git merge --ff-only feat/r2-authoritative
git switch main
git merge feat/r2-authoritative
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/arcade-nix!69
No description provided.