fix: a refusal about a size names the key the recipe actually carries - #74
Merged
Conversation
The format is handed a count of bytes and answers about bytes, so every size refusal it produces says "size" - the only size key it knows. A target that draws its sizes from a range has no "size" key at all. Measured on 2026-09-06: a recipe carrying "size-range: 143-200" was refused at "targets[1].size", which sent a script reading validate --json, and a person reading the window, to a box that was neither on their screen nor in their file. It now reads "targets[1].size-range", and ordinary targets are unchanged. The substitution happens in atTarget, where the target is in hand. The format cannot make it, because it never learns which key held the number. Nothing else moved, and that was measured rather than reasoned about: refusalcorpus reports 96 identical and 0 differing across 48 recipes and two commands, and bytesweep reports all 23 formats byte for byte identical. The comment on drawSizes is corrected in the same commit, because it promised an invariant the code does not provide. It said a range "either works for every file or for none". That holds only if a format's reachable sizes are one unbroken interval from its minimum, and for four of them they are not - PNG has an unreachable band of eleven byte counts above every picture's encoded size, and the OPC three declare the same shape. So a drawn size can land in a band and be refused later, and whether that happens depends on the count: one 64x64 PNG recipe at one seed with size-range 143-200 is accepted at counts 1 and 2 and refused at 3, 5, 8, 12, 20 and 40. Closing that needs the format to declare its bands so the whole interval can be judged before anything is drawn, which changes format.Descriptor and is the owner's call. This commit does not do it, and the comment no longer claims otherwise. Two mutations in opposite directions, both caught. The pair matters more than either half: a build answering "size-range" for every size refusal would satisfy the first case and misaddress every ordinary target in the tree. Checked rather than assumed that this was not already guarded - the table in TestEveryRecipeRefusalSaysWhichSettingItIsAbout has a size-range case, but that refusal comes from the recipe reader, which knows which key it read. Both cases were tried there first and came back valid, because nothing on that path plans a file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stability report finding T1, the half that does not need a contract decision. Reproduced on today's tree first.
One thing in the report is wrong, and it matters
T1 says the refusal "carries no address. There is no
atnaming the target". It does. Measured:But that surfaced a real defect underneath. The recipe says
size-range. The address sayssize- a key that recipe does not have. Sovalidate --jsonsends a script, and the window sends a person, to a box that is neither on their screen nor in their file.The format is handed a count of bytes and answers about bytes, so every size refusal it produces says
size, the only size key it knows. It cannot know which key held the number. The substitution now happens inatTarget, where the target is in hand.Nothing else moved, and that was measured
refusalcorpus.py- 48 recipes x 2 commandsbytesweep.py- every formatOnly the address moved. Every refusal is word for word what it was.
The comment is corrected in the same commit
drawSizespromised: "the range either works for every file or for none". The code does not provide that. The low-end check is sufficient only if a format's reachable sizes are one unbroken interval from its minimum, and for four of them they are not - PNG has an unreachable band of eleven byte counts above every picture's encoded size, and the OPC three declare the same shape.So a drawn size can land in a band and be refused later, and whether that happens depends on the count. One 64x64 PNG recipe, one seed,
size-range 143-200:That is left open deliberately. Closing it needs the format to declare its unreachable bands so the whole interval can be judged before anything is drawn - a change to
format.Descriptor, and yours to call. What this commit does is stop the comment claiming otherwise, because it was persuasive enough that a future reader would trust it.Guard
TestASizeRefusalIsAddressedToTheKeyTheRecipeCarries, two mutations in opposite directions, both caught. The pair matters more than either half: a build answeringsize-rangefor every size refusal would satisfy the first case and misaddress every ordinary target in the tree.Checked first that this was not already guarded. The table in
TestEveryRecipeRefusalSaysWhichSettingItIsAbouthas asize-rangecase, but that refusal comes from the recipe reader, which knows which key it read. Both of my cases were tried there first and came back valid, because nothing on that path plans a file.preflight --quickgreen on all 12. One self-inflicted catch worth recording: the punctuation guard rejected a 🔴 I had left in a shipped source comment, which is rule 13 doing its job.🤖 Generated with Claude Code