Skip to content

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

Merged
morluto merged 8 commits into
mainfrom
test/cli-contract-schema-parity
Nov 15, 2026
Merged

morluto merged 8 commits into
mainfrom
test/cli-contract-schema-parity

Conversation

@morluto

@morluto morluto commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

CLI fields can admit inputs their corresponding tool contracts reject, or reject relative paths that the CLI is expected to resolve. This adds a report-only parity check for comparable fields, shares the command-to-contract mapping with the coverage test, and records known differences without allowing the baseline to silently grow.

The check probes constrained strings even when no generic valid sample is available, and compares fields shared by every branch of a union. CLI-only commands and contract shapes without a common field are explicitly accounted for. The expanded coverage exposed two web trace commands that rejected relative manifest paths; both now resolve caller paths at the CLI boundary, as does the source-map path, preserving symlink-sensitive traversal.

Validation

  • Two CLI parity/coverage files and both web trace acceptance files: 13 tests passed, including relative paths through a symlink and ...
  • Advertised CLI input schema test: 25 tests passed. npm run check:fast passed.
  • Numeric probe fix (f5a6c8e): npm run test:focused -- tests/boundary/cli/cliContractSchemaParity.test.ts — 4 passed, baseline unchanged; npm run check:fast — passed.
  • CI fixes (0796709): the relative-path CLI arguments now carry descriptions (productCatalog.test.ts failed without them), and the web trace acceptance tests use native manifest paths, because absoluteCallerPath renders Windows paths with native separators (the Windows lane failed on forward-slash expectations). Forward-slash Windows manifest coverage (fix(browser): normalize selected script manifest roots on Windows #1078) is kept in c5416d0: each parity test also calls MCP with the forward-slash spelling and expects the same trace with that path echoed. (CLI normalization of absolute Windows paths is deliberate, [Bug] Windows: rea analyze rejects backslash absolute paths with "Ambiguous Windows path component is unsupported" (Win32 50) #4707.) npm run test:focused -- tests/boundary/filesystem/productCatalog.test.ts tests/acceptance/webModuleCli.test.ts tests/acceptance/webSourceLocationCli.test.ts tests/boundary/cli/cliContractSchemaParity.test.ts — 23 passed on macOS; Windows not run locally. npm run check:fast — passed.
  • Tests ran on macOS; no browser or real external analysis provider was required.

No issue was filed; the gap was found during CLI contract review.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T08:46:05.351643Z 3ee1623 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no new actionable issue was found.

Summary

Adds a CLI-to-contract field check, shares command aliases, and lets both web trace commands resolve relative caller paths.

  • A boundary check compares CLI fields with their MCP tool contracts.
  • Web trace commands accept paths relative to the current directory.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI[Registered CLI fields] --> Match[Match command and field names]
  Contracts[Tool contracts] --> Match
  Match --> Probes[Probe field admission]
  Probes --> Compare[Compare parsed values]
  Compare --> Baseline[Reject unrecorded or stale differences]
Loading

Reviews (8) · Last reviewed commit: "Merge branch 'main' into test/cli-contra..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6af13e2961

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.
…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.
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.
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

The failing "Native package baseline (darwin arm64)" check (list_segments reply "did not match the list_segments contract") comes from main, not this PR: #10662 started validating every Hopper bridge reply, and the fake Hopper fixture that this lane drives still served an old list_segments shape. Fixed in #10734; this check should pass after that merges and this PR's CI reruns.

@morluto
morluto merged commit 4822082 into main Nov 15, 2026
15 checks passed
@morluto
morluto deleted the test/cli-contract-schema-parity branch November 15, 2026 09:07
@morluto morluto added the area: cli CLI adapter and one-shot commands label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant