format: a setting value is spelled the way the format declares it - #39
Merged
Conversation
The registry compared a closed set with EqualFold and a boolean with
ToLower, so a value the declaration does not contain walked past the one
check meant to stop it and arrived at the generator. What happened next
was each generator's own decision, and measured across the eight formats
that declare a closed set there were four of them:
refuse in its own words csv, ico, log, wav
fold and understand it pdf page_size, directory_entries in archives
swallow it and build the targz entry_owner - USER and ROOT produced a
DEFAULT file, exit 0 file byte for byte identical to unset
read it as another value zip encryption=NONE, which then asked for a
password to lock an archive "with NONE"
The third is a file that is not what was ordered, reported as success.
Allows now compares exactly, which is one place rather than twenty one
settings, and no generator is handed a value its own declaration does
not spell. ReadOwnership gains the default branch it never had, because
that function is callable directly and silence there would be the same
wrong file through another door. And targz records entry_mode and
entry_owner in the manifest - neither reached it before, which is why a
swallowed owner left nothing to disagree with.
Three guards walk the whole registry rather than a list copied beside
them: 63 values in a case the declaration does not use, plus the 14 that
carry no letters, counted and printed so a day when this guard walks
nothing is a day it says so.
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.
Closes the two voice refusal recorded as O168 - and the measurement that
went with it found something larger, so this fixes that instead.
What was wrong
The registry compared a closed set with
EqualFoldand a boolean withToLower. A value the declaration does not contain therefore passed theone check meant to stop it and reached the generator, and what happened
next was each generator's own decision.
Measured across all eight formats that declare a closed set, twenty one
settings, every declared value offered in a case the declaration does not
use. Zero of them were refused by the registry. Four behaviours, none
of them declared:
csv3/3,ico,log6/6,wav contentpdf page_size,directory_entriesin both archivestargz entry_ownerzip encryption=NONE--set entry_owner=USERproduced an archive owned by nobody - byte forbyte the default file - with exit 0 and nothing said.
--set encryption=NONEwent on to demand a password to lock an archive "withNONE", quoting a value the format does not have.
What this does
Property.Allowscompares exactly. One place, rather than twenty onesettings, and no generator is ever handed a value its declaration does
not spell.
ReadOwnershipgains thedefaultbranch it never had. The registrystops a misspelling earlier now, so this is about the other door: the
function is callable directly, and silence there is the same wrong file.
targzrecordsentry_modeandentry_ownerin the manifest. Neitherreached it before - which is exactly why a swallowed owner was
invisible: a run asking for
userand a run asking forUSERproducedidentical manifests.
Breaking, and named as such in the changelog
--set page_size=A4and--set directory_entries=TRUEused to work andnow refuse with exit 4. No file changes its bytes. A recipe writing
header: trueis unaffected, because a YAML boolean arrives astrueeither way - only a value quoted into another case is refused.
Guards
Three, in
internal/guard/closedsets_test.go, all red before the change:63 values walked from the registry itself rather than from a list copied
beside it, plus the 14 values that carry no letters, counted and printed
so that a day when this guard walks nothing is a day it says so.
Five mutation entries, all caught. One existing entry went stale on this
change and was repaired -
staleness.pyis clean at 724.Full suite green (
internal/guard297.9s), preflight green on ten gatesincluding
staticcheck,lintandgovulncheck.🤖 Generated with Claude Code