Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli/webNetworkCaptureCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const registerWebNetworkCaptureCommands = (
.describe("Fully qualified message type in the descriptor set"),
record: z
.array(cliIntegerArgument(0))
.min(1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

.optional()
.describe("Zero-based producer ordinals; repeat to select several"),
...explicitSensitiveValueOptions,
Expand Down
27 changes: 27 additions & 0 deletions tests/boundary/cli/cliDomainFieldSchema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,30 @@ it("advertises the domain constraints for android, adb settings, and browser sel
parser.args.safeParse({ path: "app.apk", className: "" }).success,
).toBe(false);
});

it("advertises domain minItems for inspect-web-network-capture record selection", async () => {
const cli = createCli({});
const ajv = new Ajv2020({ strict: false, validateFormats: false });
const advertised = await serve(cli, [
"inspect-web-network-capture",
"--schema",
"--json",
]);
const schema = advertised.options;
expect(schema, "inspect-web-network-capture options").toBeDefined();
const validate = ajv.compile(schema as AnySchema);

expect(validate({ record: [] })).toBe(false);
expect(validate({ record: [0] })).toBe(true);

const parser = registeredCommands
.get(cli)
?.get("inspect-web-network-capture");
expect(
parser && "options" in parser && parser.options instanceof z.ZodObject,
).toBe(true);
if (parser && "options" in parser && parser.options instanceof z.ZodObject) {
expect(parser.options.safeParse({ record: [] }).success).toBe(false);
expect(parser.options.safeParse({ record: ["0"] }).success).toBe(true);
}
});
Loading