fix(attestation-type): reconcile --summary flags with the empty-value rule - #1106
Merged
Conversation
…e rule The summaries PR (#1099) and the empty-flag audit PR (#1103) were both green on their own branches and red together on main. #1103 made every flag refuse an empty value while pflag is still parsing, which lands before the summary flags' own validation, so three cases pinned behaviour that can no longer happen: - `--summary-json ''` was accepted as a no-op; it is now refused. - `--summary ''` reported its NAME=EXPRESSION wording; the empty-value rule speaks first. - `--summary X --summary-json ''` reported the mutual exclusion; parsing refuses before PreRunE runs. Each still fails for the reason it was written to pin, in the one wording every flag now uses. '[]' stays accepted: a summary with no entries is not a missing value. Also registers the two new flags with the audit, which pins its coverage to the command tree and so fails on a flag it does not know about. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
parseSummaryJSON trimmed before testing for a blank value, so `--summary-json " "` was read as the flag being left out and the summary was silently dropped. That is the trap the empty-value rule exists to close, reached with a space instead of nothing: `--summary-json "$VAR"` with VAR set to a space created the type with no summary and said nothing. Only "" is the flag being left out, because the rule refuses an empty value on the command line. Whitespace was written on purpose, so it now falls through to json.Unmarshal and is reported as invalid JSON. The same gap is open on every other flag, since the rule tests `value == ""` rather than trimming. Closing it there changes behaviour on all 165 flags and wants its own audit run, so it is left alone here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Claude finished @FayeSGW's task in 2m 24s —— View job Claude Code Review
Static analysis
SummaryThis is a tightly-scoped, well-reasoned fix. The behaviour is correct against the actual empty-value machinery, and the tests + comments do a good job explaining the why. I traced each claim in the PR body to the code and it holds up. No blocking issues. Verification of the core claimThe pivot of the PR is that
The narrowing from Observations (non-blocking)
Nice work
|
FayeSGW
enabled auto-merge (squash)
August 19, 2026 13:33
mbevc1
approved these changes
Aug 19, 2026
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.
What
The repo-wide empty-value rule refuses an empty value for a flag that was given on the command line. The
--summary/--summary-jsonflags oncreate attestation-typewere never reconciled with it, so their tests asserted errors the rule now produces earlier, andparseSummaryJSONtreated whitespace as "flag not given".Changes
parseSummaryJSONonly treats""as no summary. An unset flag arrives as""; the empty-value rule guarantees an explicitly empty one never reaches the parser. Whitespace was written on purpose, so it falls through and is rejected as invalid JSON rather than silently dropping the summary — which is what--summary-json "$VAR"withVAR=" "would otherwise do in CI.--summary '',--summary-json '', and the both-flags-given case now assertflag '<name>' was given an empty value, since parsing refuses the value beforePreRunE(and beforeMuXRequiredFlags) runs.--summary-json '[]'is still accepted — a summary with no entries, not a missing value.--summary-json, at both the command and unit level.Testing
make test_integration_single TARGET=CreateAttestationTypeTestSuite🤖 Generated with Claude Code