Skip to content

fix(distribute): keep the receipt of a skipped files: artifact - #191

Merged
arcaven merged 2 commits into
mainfrom
build/sideshow/190-files-receipt
Oct 8, 2026
Merged

arcaven merged 2 commits into
mainfrom
build/sideshow/190-files-receipt

Conversation

@arcaven

@arcaven arcaven commented Oct 8, 2026

Copy link
Copy Markdown
Member

An unedited files: artifact stopped receiving pack updates after any run that wrote a sibling file from the same pack, because the receipt of a skipped file was dropped from the registry and the next run read it as user-authored. This keeps that receipt, so a pack bump reaches an unedited file and an edit is still reported as an edit.

Behavior change: a files: skip for "already current" or "modified since sideshow wrote it" now keeps its receipt in the registry. For the edited case the receipt kept is the one sideshow recorded, not the pack's current bytes, so an edit the user later reverts is read as unedited again. A user-authored file with no record is still given no receipt.

Closes #190

Also from the #189 review: the rules skips set RecordReceipt even under --dry-run, with only the caller's !dryRun guard stopping the write. The rules and files skips now set it only when not a dry run, as the no-receipt rules case already did.

Repro, before and after, isolated SIDESHOW_HOME, a pack with a.cfg and b.cfg: run 1 creates both; delete b.cfg; run 2 says a.cfg is already current and recreates b.cfg; install and use pack 0.2.0 with a changed a.cfg; run 3 at main 6fdd2c85 left a.cfg at the old bytes with "no record of writing it (user-authored)". With this branch run 3 updates it ("updated (sideshow-managed, unmodified)") and a.cfg holds the new bytes.

Acceptance:

  • an unedited file still updates after a sibling was written in the previous run (TestFiles_AnUneditedFileStillUpdatesAfterASiblingIsWritten, red before the fix)
  • an edited file stays "modified since sideshow wrote it" across runs in which a sibling is written, and its bytes are kept (red before the fix)
  • a user-authored file with no record is not given a receipt
  • the kept receipt is what sideshow wrote: edit, delete the sibling, bump the pack, restore the original bytes, and the bump reaches the file
  • a dry run asks to record no receipt, for files and for rules

Commits: (1) tests, red; (2) the fix and the dry-run consistency.

Blast radius: two branches of distributeFile and two lines in distributeRule; RecordResults is unchanged.

Mutants, each compiles and fails a test:

  • the edited skip keeps the pack's current sha instead of the recorded one: killed by TestFiles_TheKeptReceiptIsWhatSideshowWroteNotTheCurrentPack
  • the edited skip drops its receipt: killed by TestFiles_AnEditedFileStaysModifiedAfterASiblingIsWritten
  • the "already current" skip drops its receipt: killed by TestFiles_AnUneditedFileStillUpdatesAfterASiblingIsWritten
  • the files skip records under dry-run: killed by TestDryRunNeverAsksToRecordAReceipt
  • the rules lagging-receipt skip records under dry-run: killed by the same test
  • the rules edited skip records under dry-run: killed by the same test

Not changed, asked separately: files: still tests "modified" before "already current", so a receipt that lags with current bytes reads as an edit, the state #189 fixed for rules.

@arcavenai arcavenai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving. An unedited files: artifact now keeps receiving pack updates after a run that wrote a sibling, and a user's edit stays reported as an edit. The receipt it keeps is the one sideshow recorded, and a user-authored file still gets none.

End to end, main against this head. I used both binaries with an isolated SIDESHOW_HOME and a pack shipping a.cfg and b.cfg, reading a.cfg's registry receipt after each run:

Path main 3776d96
Sibling recreated, then a pack bump receipt dropped; a.cfg reads user-authored and stays at v1 receipt kept; the bump updates a.cfg to v2, then already current
Edit, sibling recreated, then a bump edit kept; reads user-authored edit kept; modified ... every run, receipt stays at the v1 sha
Edit, then a bump edit kept; receipt dropped edit kept; receipt stays at the v1 sha
Edit, --dry-run, then a real run edit kept edit kept; the dry run leaves the receipt untouched
Edit, a.cfg removed from the pack, re-added later edit kept (user-authored on re-add) same
User-authored a.cfg, sibling recreated, a bump never written, no receipt same; no receipt on any run

The kept receipt in the edited rows is sideshow's v1 sha, not the pack's current one. A registry written by main works with this binary: unedited, the bump reaches a.cfg; edited, it stays modified and the bytes are kept.

Rules from #189 are unchanged. I reran my #189 CLI rows with this binary, covering an edit before upgrade, removal and re-add, a sibling write, dry run, a removed marker, a lagging receipt, and an unedited bump. The output matches 8736668 line for line.

Red, and mutants. At 675f3d0 these three fail for the stated reasons:

  • TestFiles_AnUneditedFileStillUpdatesAfterASiblingIsWritten (the bump never reaches a.cfg);
  • TestFiles_AnEditedFileStaysModifiedAfterASiblingIsWritten (reads user-authored);
  • TestDryRunNeverAsksToRecordAReceipt.

TestFiles_AUserAuthoredFileIsNotGivenAReceipt passes there, as a guard, which the body does not claim red. Head passes the full suite and two runs of -count=20.

The six listed mutants each fail their named test. So do two I added: a user-authored skip given a receipt, and the files edited case removed.

CI on 3776d96 passes.

Non-blocking, both as already noted:

  • The files: order you asked about separately is reachable here. I wrote v2's bytes into a.cfg under its v1 receipt, then installed v2. Every run after that reads modified since sideshow wrote it, and because the receipt is now kept, it stays that way. On main the same file decays to user-authored. It is stuck either way and nothing is lost.
  • A files: skip under --dry-run prints modified since sideshow wrote it (user edit preserved) without the would skip: prefix that rules use. That is unchanged from main.

Seat: reviewer / reviewer

@arcaven
arcaven marked this pull request as ready for review October 8, 2026 11:27
@arcaven
arcaven merged commit ad2457b into main Oct 8, 2026
10 checks passed
@arcaven
arcaven deleted the build/sideshow/190-files-receipt branch October 8, 2026 11:31
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.

files: skips drop their receipt when another file in the pack is written

2 participants