Sync artwork from mame-sync, and give the index its parents back #70

Open
charles wants to merge 0 commits from feat/artwork-r2-in-mame-sync into main
Owner

Stage one and two of moving artwork fetching out of shell.

The mirror decisions and the sync itself, with tests for the three things the shell could not demonstrate: a clone is fetched under its parent name, an unreachable mirror deletes nothing, a failed download leaves the old copy in place.

Also fixes parentage at the source. cloneof was only filled from catalog.json, which this cabinet does not have, so all 51031 rows had a null parent while the datfile declared one for 27730 machines. The parser header claimed the datfile carried none; it does.

268 tests pass across 32 files.

Stage one and two of moving artwork fetching out of shell. The mirror decisions and the sync itself, with tests for the three things the shell could not demonstrate: a clone is fetched under its parent name, an unreachable mirror deletes nothing, a failed download leaves the old copy in place. Also fixes parentage at the source. cloneof was only filled from catalog.json, which this cabinet does not have, so all 51031 rows had a null parent while the datfile declared one for 27730 machines. The parser header claimed the datfile carried none; it does. 268 tests pass across 32 files.
Stage one of taking artwork fetching out of shell. Nothing calls this yet; it
is the R2 half expressed as pure functions over a probe result, so the awkward
cases are settled by tests instead of on a cabinet somebody is playing on.

The shell version worked, but every bug in it had the same shape -- invisible
to shellcheck and to the build, found only by running it. A missing awk in
runtimeInputs built cleanly and exited 127, taking an apply with it. A bare
`[ x ] && y` under set -e ended the script silently. A permission denial and a
missing `file` binary were each counted as "the mirror does not have this",
and each reported a confident wrong number.

It also fixes punisher, which is why it was written now. The mirror is keyed
by the name the artwork was filed under, and for a clone that is usually the
parent: punisheru 404s, punisher is there. The shell fetcher only ever tried
the exact name, so every clone fell through to a title-matched source and came
back wearing another game's photograph. mame-sync already carries cloneof on
every row; in shell the same fix meant another tool and another parser.

    404  attractmode/mame/punisheru.png
    200  attractmode/mame/punisher.png

24 tests, including the three properties the shell version asserted in prose
and could not demonstrate: a 404 deletes only what we sourced, an unreachable
mirror changes nothing, and a multipart ETag is not an MD5 -- comparing it to
one would re-download that file every night forever.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nz3es8PajUzXmqJJiK6yRB
Stage two: the mirror sync as a command, and the parentage it needs to work.

Three things the shell could not do, each now a test:

  a clone is fetched under its parent's name
  an unreachable mirror deletes nothing, even for files we sourced
  a failed download leaves the old copy and its record in place

The parentage turned out to be missing at the source. cloneof was only ever
filled from catalog.json, which this cabinet does not have, so all 51,031 rows
carried a null parent -- while the datfile sitting beside them declared one for
27,730 machines:

    <machine name="punisheru" sourcefile="capcom/cps1.cpp"
             cloneof="punisher" romof="punisher">

The parser's own header said the datfile carried no cloneof. It does, and the
comment is corrected rather than worked around. cloneof, not romof: romof also
names a BIOS set a machine merely borrows from, which is not where its artwork
is filed.

Installed games are read from the play set, not from the index. `have` there
means "in the collection on the NAS", which is a different question from "on
this cabinet" -- filtering on it returned zero games while 191 were installed.
An unreadable play set stops the run rather than reconciling against a partial
list, because a share that is not mounted must not look like every game having
been uninstalled.

Wheels are absent on purpose: the mirror is their last resort, and syncing
them here would quietly promote it to first.

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/artwork-r2-in-mame-sync:feat/artwork-r2-in-mame-sync
git switch feat/artwork-r2-in-mame-sync

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/artwork-r2-in-mame-sync
git switch feat/artwork-r2-in-mame-sync
git rebase main
git switch main
git merge --ff-only feat/artwork-r2-in-mame-sync
git switch feat/artwork-r2-in-mame-sync
git rebase main
git switch main
git merge --no-ff feat/artwork-r2-in-mame-sync
git switch main
git merge --squash feat/artwork-r2-in-mame-sync
git switch main
git merge --ff-only feat/artwork-r2-in-mame-sync
git switch main
git merge feat/artwork-r2-in-mame-sync
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!70
No description provided.