Skip to content

test: guard the help --json contract structs against silent drift#84

Merged
andyrewlee merged 1 commit into
mainfrom
audit/37-help-json-drift-guard
Jun 15, 2026
Merged

test: guard the help --json contract structs against silent drift#84
andyrewlee merged 1 commit into
mainfrom
audit/37-help-json-drift-guard

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

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.


Part of a 38-PR stacked diff (audit/01audit/38), reviewed and merged bottom-up. This PR is based on audit/36-flags-declare-once.

@andyrewlee andyrewlee force-pushed the audit/36-flags-declare-once branch from 4192998 to 68dee03 Compare June 15, 2026 06:51
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.
@andyrewlee andyrewlee changed the base branch from audit/36-flags-declare-once to main June 15, 2026 06:52
@andyrewlee andyrewlee force-pushed the audit/37-help-json-drift-guard branch from 369f927 to eb6bbac Compare June 15, 2026 06:52
@andyrewlee andyrewlee merged commit 4c7835c into main Jun 15, 2026
4 checks passed
@andyrewlee andyrewlee deleted the audit/37-help-json-drift-guard branch June 15, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant