test: guard the help --json contract structs against silent drift#84
Merged
Conversation
4192998 to
68dee03
Compare
The help --json payload (commandInfo/flagInfo) is a documented agent contract in docs/AGENT.md, but nothing pinned it: TestAgentDocDocuments- ContractStructs reflected only over submitResult/OpResult/initResult, no golden captures help --json, and TestHelpJSONIncludesFlags decodes into the same structs so it follows any json-tag rename. Renaming flagInfo's `type`->`kind` tag — a direct contradiction of AGENT.md — left the cmd suite fully green. Add commandInfo and flagInfo to the reflection list so a renamed/added json tag on the help payload fails the drift-guard, matching the pattern already applied to the other documented result structs.
369f927 to
eb6bbac
Compare
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.
The help --json payload (commandInfo/flagInfo) is a documented agent
contract in docs/AGENT.md, but nothing pinned it: TestAgentDocDocuments-
ContractStructs reflected only over submitResult/OpResult/initResult, no
golden captures help --json, and TestHelpJSONIncludesFlags decodes into
the same structs so it follows any json-tag rename. Renaming flagInfo's
type->kindtag — a direct contradiction of AGENT.md — left the cmdsuite fully green.
Add commandInfo and flagInfo to the reflection list so a renamed/added
json tag on the help payload fails the drift-guard, matching the pattern
already applied to the other documented result structs.
Part of a 38-PR stacked diff (
audit/01…audit/38), reviewed and merged bottom-up. This PR is based onaudit/36-flags-declare-once.