Skip to content

fix(cli): retain browser and Inspector input correction details - #2230

Merged
morluto merged 1 commit into
morluto:mainfrom
369Apps:fix/cli-input-diagnostics-2180
Oct 12, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
369Apps:fix/cli-input-diagnostics-2180

Conversation

@369Apps

@369Apps 369Apps commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2180.

Preserve safe correction details when supplied arguments fail the named input contracts for list-browser-targets, inspect-web-page, analyze-web-bundle, observe-web-session, list-javascript-runtime-targets, and observe-javascript-runtime.

Problem and expected behavior

For example, rea list-browser-targets 'not a url' --json correctly exits 1 with invalid_request, but its remediation asks callers to correct listed arguments without returning any issues. The handler discards issues already produced by its input contract.

The same rejection should identify the field and authored correction or bound without echoing rejected values. This patch adds details.operation and details.issues through the existing shared projection. Classification, retryability, message, and exit status remain unchanged.

Change and scope

  • Retain each canonical input object and pass its Zod issues to analysisInputErrorFromIssues.
  • Remove the obsolete no-issues Inspector wrapper.
  • Add compiled CLI regressions for all six reported inputs, two endpoint-credential non-echo cases including debug stderr, authored cross-field guidance, and omitted positional input.
  • No admission-schema, provider, or success-path changes.

Contract and boundary impact

  • Semantic owner and earliest changed stage: CLI named-contract validation; the existing domain projector owns safe correction metadata.
  • CLI and MCP/tool-catalog contract: restore the existing typed invalid-input details in six CLI handlers; MCP and advertised schemas are unchanged.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Process execution, authorization, cleanup, or containment impact: no new runtime authority; regression processes and their temporary workspaces are fixture-owned.
  • Generated metadata, package, or installation impact: none; no generated outputs or dependency changes included.

Evidence and regression coverage

Executed locally on Linux x64 using pinned Node.js 24.18.0 and npm 11.16.0, against fork base bfa805decf83744bd3ecb0d1402667cf3ed5c3b2.

  • Before the production fix, the new test file had 9 failures on missing details and 1 passing omitted-endpoint parser control. This reproduced all six reported command failures.
  • After the fix, all ten new cases pass. Existing successful browser and Inspector CLI workflows and sibling scenario/screenshot diagnostics also pass in the focused selection below.
  • A malformed endpoint now includes:
    {"operation":"list_browser_targets","issues":[{"path":["cdp_endpoint"],"reason":"invalid_value","message":"Invalid CDP endpoint URL"}]}
  • An empty target identifier includes {"path":["target_id"],"reason":"out_of_range","minimum":1}.
  • Successful provider coverage uses local protocol fixtures. No real browser, Electron, Inspector, Hopper, or Ghidra execution is claimed. The full deterministic suite and coverage were not run locally.

Validation performed

npm run test:focused -- \
  tests/boundary/cli/browserInputDiagnostics.test.ts \
  tests/boundary/cli/browserCli.test.ts \
  tests/boundary/cli/javascriptRuntimeObservationCli.test.ts \
  tests/boundary/cli/scenarioCliInputDiagnostics.test.ts \
  tests/boundary/cli/browserCompareJsonFiles.test.ts
  • Focused command above: 19 tests passed across 5 files; required compiled artifacts prepared by the runner.
  • npm run check: passed, including typecheck, formatting, metadata/dependency checks, lint, module boundaries, and architecture guards. Repository-wide lint reported 911 warnings and 0 errors; no warnings named the changed files.
  • npm run verify:test-discovery: all 933 test files discovered exactly once; this is discovery validation, not full-suite execution.
  • Targeted oxlint on the three changed files and git diff --check: passed.
  • Forward and reverse patch application verified; clean base application reproduces the tested files byte-for-byte.

Dependencies were installed with lifecycle scripts disabled. Turbo telemetry was disabled during local checks. docs:check, package checks, and real-provider lanes were not run; this patch changes no schema, package, or generated-metadata source.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real OS coverage: Linux x64 compiled CLI processes; other platforms and real providers unverified.
  • Package or release metadata impact: none.
  • Security/privacy review: reuse the canonical safe projection; tests verify rejected endpoint values and synthetic credentials are absent from stdout and debug stderr.

Review checklist

  • Concrete issue linked; one focused conventional-title fix.
  • Changed observable behavior and meaningful failures covered.
  • No owning schema, documentation, or generated-metadata changes required.
  • Representative output and verification limits included.
  • Final diff reviewed for unrelated changes, real secrets, and unsupported claims.

AI assistance

The implementation, regression tests, and PR description were developed with OpenAI Codex assistance. The local validation listed above was executed, and a separate AI-assisted source review found no actionable findings. Maintainer review is pending.

Reuse the shared safe issue projection for all six CLI validation boundaries
and cover malformed inputs, credential safety, and parser diagnostics.

Fixes morluto#2180

Developed with assistance from OpenAI Codex.
@morluto

morluto commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Keeping this earlier PR and your commit as the canonical #2180 contribution. Maintainer edits are disabled on your branch, so I opened 369Apps#1 against this exact branch with the adjacent browser diagnostics from #2247 and expanded tests. It changes only two files, retains your commit as parent and credits @chqcjq as a coauthor.

The exact contribution head passed 16 public CLI tests and the full source checks. Standards and issue-spec review found no remaining actionable findings. #2247 will stay open while this contribution is pending, so its useful work remains tracked until it is integrated here.

@morluto
morluto marked this pull request as ready for review October 12, 2026 18:29
@morluto
morluto merged commit 916ac97 into morluto:main Oct 12, 2026
30 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T18:34:45.369672Z 05ba40e Draft marked ready
ℹ️ 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.

@morluto

morluto commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Squash-merged as 916ac97 after CI passed. The additional browser-command diagnostics from #2247 are now offered in #2294 against main, with @chqcjq credited as coauthor. This preserves the original contribution and gives the adjacent fixes their own follow-up. The fork-target contribution PR is superseded.

@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: 05ba40e3cb

ℹ️ 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".

Comment thread src/cli/browserCommands.ts Resolved
morluto added a commit that referenced this pull request Oct 12, 2026
…2294)

* fix(cli): retain correction details across browser commands

Fold the complementary implementation from #2247 into the earlier #2230 proposal, retaining the original contribution history.

Co-authored-by: LouisChen <3361008+chqcjq@users.noreply.github.com>

* fix(browser): retain diagnostics from the selected input branch

* fix(cli): recognize incomplete browser scenarios by their owned fields

---------

Co-authored-by: LouisChen <3361008+chqcjq@users.noreply.github.com>
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): rejected browser and Inspector inputs lose correction details

2 participants