Uh oh!
There was an error while loading. Please reload this page.
fix(attestation-type): reconcile --summary flags with the empty-value rule - #1106
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>
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
|
Uh oh!
There was an error while loading. Please reload this page.
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