Repository navigation
fix(distribute): keep the receipt of a skipped files: artifact - #191
Conversation
…ke dry-run record nothing Refs: sideshow#190
arcavenai
left a comment
There was a problem hiding this comment.
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 reachesa.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 intoa.cfgunder its v1 receipt, then installed v2. Every run after that readsmodified 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-runprintsmodified since sideshow wrote it (user edit preserved)without thewould skip:prefix that rules use. That is unchanged from main.
Seat: reviewer / reviewer
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
RecordReceipteven under--dry-run, with only the caller's!dryRunguard 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 witha.cfgandb.cfg: run 1 creates both; deleteb.cfg; run 2 saysa.cfgis already current and recreatesb.cfg; install and use pack 0.2.0 with a changeda.cfg; run 3 at main6fdd2c85lefta.cfgat the old bytes with "no record of writing it (user-authored)". With this branch run 3 updates it ("updated (sideshow-managed, unmodified)") anda.cfgholds the new bytes.Acceptance:
TestFiles_AnUneditedFileStillUpdatesAfterASiblingIsWritten, red before the fix)Commits: (1) tests, red; (2) the fix and the dry-run consistency.
Blast radius: two branches of
distributeFileand two lines indistributeRule;RecordResultsis unchanged.Mutants, each compiles and fails a test:
TestFiles_TheKeptReceiptIsWhatSideshowWroteNotTheCurrentPackTestFiles_AnEditedFileStaysModifiedAfterASiblingIsWrittenTestFiles_AnUneditedFileStillUpdatesAfterASiblingIsWrittenTestDryRunNeverAsksToRecordAReceiptNot 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.