Repository navigation
fix(cli): reject empty web capture record selections - #9802
ahmed-husssain wants to merge 1 commit into
Conversation
The inspect_web_network_capture CLI accepted --record with an empty array in its schema and option parser, whereas the runtime domain schema (inspectWebNetworkCaptureInputSchema.shape.record_ordinals) requires at least one nonnegative record ordinal when record selection is supplied. Add .min(1) to the record CLI option schema and assert rejection in both the advertised schema and the option parser. Fixes morluto#9767
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5328645c4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| .describe("Fully qualified message type in the descriptor set"), | ||
| record: z | ||
| .array(cliIntegerArgument(0)) | ||
| .min(1) |
There was a problem hiding this comment.
Derive record selection from its domain owner
When the domain's record_ordinals contract changes, this locally copied .min(1) can drift again: inspectWebNetworkCaptureInputSchema.shape.record_ordinals already owns the nonempty-selection rule, and the pre-change mismatch was caused by maintaining this second CLI interpretation. Adapt or extract the owning domain field for CLI decimal tokens instead of copying its cardinality so the advertised schema, parser, and service cannot diverge again.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
Summary
Fixes #9767
Aligns the
inspect_web_network_captureCLI--recordoption schema with runtime domain validation by requiring at least one record ordinal when record selection is provided (.min(1)).Problem and expected behavior
The
inspect_web_network_captureCLI previously accepted--recordwith an empty array in its advertised JSON schema (--schema) and argument parser, whereas runtime domain validation (inspectWebNetworkCaptureInputSchema.shape.record_ordinals) requires at least one nonnegative record ordinal when record selection is specified.With this change, the CLI options schema specifies
minItems: 1onrecord, rejecting empty record selections at the CLI schema boundary.Change and scope
.min(1)torecord: z.array(cliIntegerArgument(0))insrc/cli/webNetworkCaptureCommands.ts.tests/boundary/cli/cliDomainFieldSchema.test.ts.Follow the contribution scope: Ordinary CLI schema alignment; not applicable.
Contract and boundary impact
src/cli/webNetworkCaptureCommands.ts.inspect-web-network-capture --schemanow publishesminItems: 1for optionrecord.Expected effects:
Evidence and regression coverage
tests/boundary/cli/cliDomainFieldSchema.test.tsverifiesminItems: 1in advertised--schemaand parser rejection of{ record: [] }.inspect-web-network-capture --schemalackedminItems: 1onrecord.recordoption in--schemanow advertises"minItems": 1.Validation performed
npm run test:focused -- tests/boundary/cli/cliDomainFieldSchema.test.ts— passed (2 tests passed)npx oxfmt --check src/cli/webNetworkCaptureCommands.ts tests/boundary/cli/cliDomainFieldSchema.test.ts— passednpm run check:fast— passed (typecheck and lint clean)Compatibility, safety, and release
--recordwas never valid at runtime.Author readiness
Human owner: @ahmed-husssain
Before merge
type(scope): outcome.