test(cli): report CLI fields that admit values their contract refuses (#10575)

* test(cli): report CLI fields that admit values their contract refuses

For every CLI command that reaches an MCP contract, compare each
name-matched CLI field with its contract field on empty, NUL,
caller-relative host path and numeric argv spellings. The 16 mismatches on
main are recorded in a baseline with a counted ceiling that can only go
down: a new mismatch fails, and so does a listed one that no longer occurs.

* test: cover constrained CLI contract fields

* fix(cli): admit relative web trace paths

* test(cli): probe numeric contract fields by type, including bounds

Numeric probes no longer require the contract to admit 0 or 1, so ranged fields such as inspect-byte-entropy --block-size (256..65536) are compared, with probes just past each declared bound.

* fix(cli): describe caller-relative web trace paths and expect native Windows spellings

The relative-path CLI arguments lost their contract descriptions; they now describe the caller-relative resolution. absoluteCallerPath renders native separators on Windows, so the web trace acceptance tests use native manifest paths for CLI and MCP parity.

* test(cli): keep forward-slash Windows manifest coverage through MCP

The CLI renders caller paths with native separators through absoluteCallerPath; MCP keeps the caller's spelling. The web trace parity tests now also call MCP with the forward-slash manifest spelling and expect the same trace with that path echoed, restoring the #1078 coverage.
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 17:07:09 +08:00
1 parent d0fee4e58e
commit 48220827c4
10 files changed
+450 -45

No files matched your search

+6 -2
View File
@@ -8,6 +8,8 @@ import type { Logger } from "pino";
import type { CliInstance } from "./types.js";
import { cliDecimalField } from "./options.js";
import { withCommandCancellation } from "./commandCancellation.js";
import { localPathStringSchema } from "../domain/localPath.js";
import { absoluteCallerPath } from "../filesystem/callerPath.js";
import { finishAnalysisCommand } from "./finishAnalysisCommand.js";
const importMapInputSchema =
@@ -24,7 +26,9 @@ export const registerWebModuleCommands = (
description:
"Trace one captured script's native imports to URLs and captured source candidates",
args: z.object({
manifestPath: webModuleTraceInputSchema.shape.manifest_path,
manifestPath: localPathStringSchema.describe(
"export_web_scripts manifest path; a relative path resolves against the current directory",
),
scriptIndex: cliDecimalField(
webModuleTraceInputSchema.shape.script_index.describe(
"Zero-based manifest script index",
@@ -49,7 +53,7 @@ export const registerWebModuleCommands = (
() =>
service.trace(
{
manifest_path: args.manifestPath,
manifest_path: absoluteCallerPath(args.manifestPath),
script_index: args.scriptIndex,
...(options.importerUrl === undefined
? {}