W21: a field the schema does not declare - #16
Merged
Conversation
W14 stops one level short. It asks whether a NAME exists, and a name that exists satisfies it — so `pick.name` passes while the step saving `pick` declares only `index`. The engine resolves a missing field to an empty string exactly as it does a missing name, so a condition on it is never true and the branch is quietly never taken. Found on a live catalogue: a bail-out branch keyed on `pick.name` had not run once since it was written, while its author believed the behaviour was in effect and had committed it as the important one of that change. Only variables with a DECLARED schema are checked, and only the first level of the path. A tool's result has no shape this package can know, and inventing one would produce findings about fields that are really there — the fastest way to teach an author to skip the report. The engine's own suffixes (`mem`, `skipped`, `failed`) are legitimate on any variable and are not fields of the answer.
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.
W14 stops one level short. It asks whether a NAME exists, and a name that
exists satisfies it — so
pick.namepasses while the step savingpickdeclares only
index. The engine resolves a missing field to an empty stringexactly as it does a missing name, so a condition on it is never true and the
branch is quietly never taken.
Found on a live catalogue: a bail-out branch keyed on
pick.namehad not runonce since it was written, while its author believed the behaviour was in
effect and had committed it as the important one of that change.
Scope, and what it deliberately does not do
Only variables with a declared schema are checked, and only the first level
of the path. A tool's result has no shape this package can know, and inventing
one would produce findings about fields that are really there — the fastest way
to teach an author to skip the report. The engine's own suffixes (
mem,skipped,failed) are legitimate on any variable and are not fields of theanswer.
Verified against a live catalogue
Zero findings on a clean catalogue, and — reintroducing the original defect for
one run — the rule fires with the difference spelled out:
Carries a fixture (
schema-field.yaml) so it cannot stop firing unnoticed.🤖 Generated with Claude Code