Skip to content

fix(native)!: report a target-selected plist against the target, not the unsent path input - #10798

Merged
morluto merged 9 commits into
mainfrom
fix/plist-target-issue
Nov 15, 2026
Merged

morluto merged 9 commits into
mainfrom
fix/plist-target-issue

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part of plan W1 (CLI commands derived from their contracts). inspect_plist reported an unreadable plist that the open target itself selects as an input issue on the contract's path field, even when the caller never sent path. MCP callers received invalid_request with issues: [{ path: ["path"] }] for a field they did not supply, and the CLI could not be projected from the contract because that issue would have been relabelled as --relative-path.

The failure is now reported against the input that chose the plist, and rea inspect-plist is projected from its contract.

This PR also carries the collapsed W1 stack above it (#10808, #10914, #10961, #10962, #10976, #11012, #11027, #11043, #11045, #11046, #11053, #11084, #11085, #11196 and #11248, with the PRs collapsed into them): every contract-named CLI command is projected from its contract, and CLI_COMMANDS is derived from the contract registry (#11248: ToolContract.cli, cliCommandFor, only the 32 CLI-owned names stay hand-written). Two carried changes are breaking (from #10808, carrying #10845, and from #10961); see Compatibility and the BREAKING CHANGE: footers.

Refs #10583

Review fix carried here (a73b254): compare-managed-members now runs full inspect_managed_members inspections, which decode #US literals. A literal capacity failure discarded the member facts already decoded (the shared budget threw through the whole inspection). inspectManagedMembersBytes now retries without literals once the members are decoded and reports user_strings as partial with the resource-limit issue scoped metadata.#US; MCP inspect_managed_members gains the same behaviour.

Problem and expected behavior

Trigger: open_binary { path: "/x/bad.plist" }, then inspect_plist {} where bad.plist is malformed, missing, a directory, a symlink loop, or has an over-long name. Before: invalid_request, details.issues[0].path = ["path"]. Expected: the caller sent no path, so the failure names the open target.

Change and scope

  • src/native/NativePlistSource.ts (owner): NativePlistSelection.origin gains "target", set when path is omitted and the target is a plist artifact. unreadablePlist maps each origin to its own failure: selected (caller's path) → AnalysisInputError on path (unchanged); target → BinaryTargetError for the target path (target_unavailable, details.path/details.reason, captured plutil output kept); default → unchanged capability_unavailable.
  • src/cli/utilityCommands.ts: inspect-plist now registers through registerContractCommand (session target positional, path spelled --relative-path, --native-command-timeout-ms derived from the contract). The hand-written args/options, mapping and the comment explaining the exclusion are removed. Input issues on --relative-path are now named by the CLI key (relativePath), like other migrated commands.
  • docs/reference/mcp-contracts.md: one sentence on the target-level failure.

Sibling sweep (other producers of path: ["path"] issues): WindowsShortcutProvider and PwntoolsFailures report on a path the caller must send, so they are correct. KeyedArchiveReader reports an omitted path for a bundle target under path; there the field is the remedy (it must be sent), so it is left unchanged.

Not included: other W1 families (analyze, managed, android, …).

  • Startup stays lazy: commands read their contracts from their own groups (contractNamed(OFFICIAL_TOOL_CONTRACTS, …), ENHANCED_TOOL_CONTRACTS, NATIVE_TOOL_CONTRACTS, ELECTRON_TOOL_CONTRACTS, OPEN_BINARY_TOOL_CONTRACT) instead of toolContract from toolContracts.ts, which loaded the complete catalog at CLI startup (tests/boundary/cli/cliStartupImports.test.ts). The lint rule added in refactor(cli): project inspect-artifact and extract-artifact with open_binary target options #10722 keeps it out.

Contract and boundary impact

  • Semantic owner and earliest changed stage: resolveNativePlistSelection records which input selected the plist; unreadablePlist is the only producer of the selection failure. Consumers (NativeMacOSProvider decode paths, nativePlistFailure) are unchanged and use it.
  • Contribution scope fit and linked maintainer decision: not applicable (fix within existing boundaries).
  • CLI and MCP/tool-catalog contract: MCP schema unchanged. MCP inspect_plist without path on a plist target now fails with target_unavailable instead of invalid_request. CLI rea inspect-plist <bad.plist> likewise; with --relative-path, issues name relativePath. Same CLI flags.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • tests/boundary/mcp/nativePlistDiagnosticsMcp.test.ts (MCP regression): inspect_plist {} on a malformed plist target returns target_unavailable with details.path, the plutil diagnostic and captured output, and no issues.
    • tests/boundary/providers/native/nativePlistSelection.test.ts: target origin; missing/directory/ELOOP/ENAMETOOLONG plist targets report against the target.
    • tests/boundary/cli/nativePlistSelectionFailureCli.test.ts: direct target → target_unavailable; --relative-path → issue on relativePath.
    • tests/acceptance/applications/nativePlistNesting.test.ts: CLI (target) and MCP (path sent) failures each name their input.
    • tests/boundary/cli/cliContractCommandParity.test.ts: inspect-plist added to the migrated list.
  • Base reproduction or other evidence: with src/native/NativePlistSource.ts restored to the base revision, nativePlistDiagnosticsMcp.test.ts fails (1 failed).
  • User-visible CLI/MCP output (if applicable): {"code":"target_unavailable","details":{"path":"/…/chosen.plist","reason":"cannot inspect it as a property list: plutil could not decode it as a property list (…)","captured_output":{…}}}
  • Remaining proof gaps: macOS only (plutil); Linux/Windows lanes skip these cases as before.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/mcp/nativePlistDiagnosticsMcp.test.ts with base NativePlistSource.ts — 1 failed (expected)

  • npm run test:focused -- <cli plist suite: nativePlistSelectionFailureCli, nativePlistCli, utilityIntegerOptions, cliOptionAliases, emptyLocalTargetAdmission, nativePlistPrototypeKeyCli> — 96 passed

  • npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts tests/boundary/mcp/nativePlistDiagnosticsMcp.test.ts tests/boundary/mcp/nativeInputContracts.test.ts tests/boundary/providers/native/plistSourceFormat.test.ts tests/boundary/filesystem/appleBundleTargets.test.ts tests/boundary/filesystem/keyedArchiveSelection.test.ts tests/acceptance/applications/resourceOnlyPlistSelection.test.ts tests/acceptance/applications/bundleResourceRootCliMcp.test.ts src/native/NativePlistResourceRoot.test.ts tests/boundary/cli/nativeSignatureCallerSelection.test.ts — passed (selection test updated separately below)

  • npm run test:focused -- <8 native plist provider files incl. nativePlistSelection> — 119 passed

  • npm run test:focused -- <plist acceptance files incl. nativePlistNesting, keyedArchiveInputFields, localToolContracts> — passed after updating nativePlistNesting

  • npm run check:fast — passed

  • After rebasing onto main with the startup-import fix: npm run check:fast passed (pre-push) at this branch; at the top of the stack npm run test:focused -- tests/boundary/cli/cliStartupImports.test.ts tests/boundary/cli/cliContractCommandParity.test.ts tests/boundary/cli/nativePlistCli.test.ts tests/boundary/cli/nativePlistSelectionFailureCli.test.ts tests/boundary/cli/contractCommandInputFields.test.ts tests/boundary/cli/nativeMachoEvidenceDeliveryCli.test.ts: 660 passed.

  • After rebasing the collapsed stack onto main 6136c6f: npx oxfmt --check ., npm run check:fast, node scripts/verify/architecture-guards.mjs and npm run verify:advertised-schemas passed (summary current, no --update-summary needed); npm run test:focused -- tests/boundary/filesystem/productCatalog.test.ts tests/boundary/cli/cliContractCommandParity.test.ts tests/boundary/cli/cliToolCoverage.test.ts tests/boundary/cli/cliDirectExecution.test.ts tests/boundary/mcp/advertisedCatalogSummary.test.ts: 1060 passed.

  • Literal-capacity fix: the new ManagedMemberInspector.test.ts case fails with the base inspector and passes with the fix. npm run test:focused -- src/dotnet/ManagedMemberInspector.test.ts tests/boundary/cli/managedMemberComparisonCli.test.ts tests/boundary/providers/managed/managedMemberComparison.test.ts tests/boundary/providers/managed/managedStaticProvider.test.ts tests/boundary/cli/managedMemberSummaryCli.test.ts tests/boundary/mcp/managedMemberSummaryMcp.test.ts: 299 of 300 passed; the failure is main's stale target_row_resolved expectation in "inspects metadata members, signatures, CIL hashes, call edges, and field anchors", fixed by test(managed): expect resolved target rows on inspected call edges and field accesses #11213, not by this PR.

  • d34f182 updates stale expectations carried by the stack: builder admission names issues by CLI key (beforeJson, afterJson, normalizationJson, endpoint), and the --integrity-policy help states its default. Before the fix the 4 files failed (11 tests) on this branch and at the old refactor(cli): project compare-web-screenshots and analyze-web-bundle from their contracts with builder JSON inputs #11012 head; on main they pass. After the fix, npm run test:focused -- over every existing test file this PR changes (82 files): 2789 passed, 5 skipped and 1 failed; the failure is main's stale target_row_resolved expectation, which test(managed): expect resolved target rows on inspected call edges and field accesses #11213 fixes.

  • Rebased onto main after refactor(verify): keep each counted guard's baseline in its own file #11316 (c36bb9e). utilityCommands.ts keeps main's member-mutation allowance import (feat(javascript): make the member-mutation work allowance a runtime setting #11181). The contract-built analyze-web-bundle command now passes the launch environment to createBrowserObservationProvider(undefined, environment), which carries feat(javascript): make the member-mutation work allowance a runtime setting #11181's threading into the contract builder. The moved src/cli/cliJsonInput.ts entry now lives in scripts/verify/baselines/completed-abort-reclassification.json.

  • node scripts/verify/architecture-guards.mjs --shrink-baselines and npm run check:fast passed.

  • briefs/local-gate.sh 10798 fix/plist-target-issue passed: merge into main, oxfmt, check:fast, guards, advertised schemas and affected tests.

  • 15aea5a (Greptile: checked captures copied again; stale --evidence-bundle example): the new tests/boundary/cli/contractJsonInputChecks.test.ts fails on the previous head (1 walk of the checked field) and passes with the fix. npm run test:focused -- over contractJsonInputChecks, processComparisonInputOrder, processCli, routedCommand, jsonInputSchema, jsonInputSize, jsonInputStatus, cliContractCommandParity and localPathAdmissionCli: 1114 passed and 1 failed (the parity case for compare-process-captures); cliContractCommandParity again after counting a checked field's refusal by its check: 1041 passed. npm run check:fast and oxfmt --check on the changed files passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none in schema. The error code for an unreadable plist target (no path sent) changes from invalid_request to target_unavailable; caller-selected path failures are unchanged.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS plutil exercised by the tests above; no deep provider involved.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

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.

BREAKING CHANGE: inspect-managed-members writes its Evidence bundle with --evidence_output <path> instead of --evidence-bundle <path>; with --detail summary the output is {summary, evidence_bundle}.

BREAKING CHANGE: a failed compare-managed-members keeps the baseline's Evidence in details.argument_observations (entry argument: "left") instead of details.partial_observation; partial_observation holds only the failing step's own partial.

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T19:00:31.470482Z
We couldn’t complete this review. Comment @codex review to try again.
15aea5a 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 15, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The reviewed changes appear safe to merge, with no new blocking issue found.RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[High impact] The reviewed changes appear safe to merge, with no new blocking issue found.

Summary

The PR reports unreadable target-selected plists against the target and moves contract-named CLI commands onto shared contract builders. The latest revision removes repeated capture parsing and fixes the managed-summary example.

  • Unreadable plist targets are reported against the target that selected them.
  • Many CLI commands now take their names and inputs from tool contracts.
  • Managed comparisons retain each completed side's Evidence when a later step fails.
  • Managed member inspection keeps decoded members when #US decoding reaches its limit.
  • Contract-based CLI commands check structured inputs before reading their other files.
  • Frida CLI and MCP requests use shared mappings from contract inputs.
  • Managed member Evidence output uses --evidence_output and returns its bundle receipt.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Read capture JSON] --> B[Check Evidence and capture facts]
  B -->|Refused| C[Return input failure]
  B -->|Accepted| D[Keep checked capture]
  D --> E[Check remaining comparison options]
  E --> F[Compare checked captures]
Loading

Reviews (9) · Last reviewed commit: "fix(cli): admit checked JSON inputs thro..." · Reviewed by Greptile

@morluto
morluto force-pushed the fix/selector-contracts-refuse-empty branch from de7d5ad to f0671e1 Compare November 15, 2026 07:35
@morluto
morluto force-pushed the fix/plist-target-issue branch from 022a45c to 827c6e0 Compare November 15, 2026 07:35
@morluto
morluto force-pushed the fix/selector-contracts-refuse-empty branch from f0671e1 to 5d54b49 Compare November 15, 2026 08:00
@morluto
morluto force-pushed the fix/plist-target-issue branch 2 times, most recently from 38e0374 to c3467eb Compare November 15, 2026 09:37
@morluto
morluto force-pushed the fix/selector-contracts-refuse-empty branch 2 times, most recently from 6c83ed9 to 8829bc3 Compare November 15, 2026 10:08
@morluto
morluto force-pushed the fix/plist-target-issue branch 3 times, most recently from cd01173 to ec089db Compare November 15, 2026 11:18
@morluto
morluto force-pushed the fix/selector-contracts-refuse-empty branch from 313e44e to b45a717 Compare November 15, 2026 11:18
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto force-pushed the fix/selector-contracts-refuse-empty branch from b45a717 to f580815 Compare November 15, 2026 11:26
@morluto
morluto force-pushed the fix/plist-target-issue branch from ec089db to 173d40e Compare November 15, 2026 11:26
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto force-pushed the fix/selector-contracts-refuse-empty branch from f580815 to 5e16992 Compare November 15, 2026 12:19
@morluto
morluto force-pushed the fix/plist-target-issue branch from 173d40e to 34938f6 Compare November 15, 2026 12:19
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto force-pushed the fix/selector-contracts-refuse-empty branch from 5e16992 to 79b6610 Compare November 15, 2026 13:05
@morluto
morluto force-pushed the fix/plist-target-issue branch from 34938f6 to b50e1eb Compare November 15, 2026 13:05
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto force-pushed the fix/plist-target-issue branch from b50e1eb to b4cb8d3 Compare November 15, 2026 13:56
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto changed the base branch from fix/selector-contracts-refuse-empty to main November 15, 2026 14:03
@morluto
morluto force-pushed the fix/plist-target-issue branch from b4cb8d3 to 1f95454 Compare November 15, 2026 14:10
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…he unsent path input

inspect_plist resolved a plist that the open target itself selects with the same origin as a caller's path input, so an unreadable target plist was reported as an input issue on path even when the caller never sent path. The selection now records a target origin, and unreadablePlist reports it as a BinaryTargetError for the target. The inspect-plist CLI command is projected from its contract, so its --relative-path issues are named by the CLI key.
)

* refactor(cli): route analyze to the contract its target selects

analyze hand-declared both lanes: native open options for binary_overview and the JavaScript integrity policy and source selection for analyze_javascript_application, with its own routing and refusals. registerTargetRoutedCommand now projects each route from its contract, takes the union of their options, runs the first route that owns every given option and takes the target, and refuses options the chosen route does not own by their CLI key. Omitted union fields, including a root discriminator, no longer need an argv projection.

* fix(cli): give a routed command's chosen route its CLI-only option defaults

Routing strips option defaults so an omitted option routes no target. Contract fields regain theirs on admission, but CLI-only options have no later parse, so a defaulted one reached the handler as undefined. The chosen route's omitted CLI-only options now receive their defaults before the handler runs.

* refactor(cli): deliver decompile and inspect-macho Evidence by the contract's detail (#10813)

* refactor(cli): deliver decompile and inspect-macho Evidence by the contract's detail

decompile and inspect-macho omitted the contract's detail field and always printed complete Evidence. Both now declare evidenceDelivery, adding --detail and --evidence_output from the contract. Publishing a result never used the provider id it required, so publication takes no provider and runOnSessionTarget no longer needs one to deliver.

* refactor(cli): project managed artifact and native-boundary inspectors from their contracts (#10816)

inspect-managed-artifact and inspect-managed-native-boundaries re-declared the managed budget fields by hand. Both now register from their contracts on a session target, and inspect-managed-artifact gains --detail and --evidence_output from its detail field.

* fix(cli): name every contract command's input issues by their CLI key

Commands applied their CLI field binding only where a session-target or
direct handler returned an undelivered result. With evidenceDelivery,
decompile publishes through the shared delivery, which returned a
provider failure unprojected, so an issue about the procedure would be
reported at ["procedure"] instead of the advertised positional
"address". Handlers that run a service or publish themselves never
applied it: inspect-il2cpp-metadata reported ["generic_instances"],
inspect-go-binary ["max_string_literals"] and inspect-apple-ips
["join_path"] rather than the CLI keys other commands report.

The contract command now projects whatever its handler returns through
the binding it owns, for plain and target-routed commands alike, and
the handler context no longer carries the binding.

* fix(analysis-view): summarize pseudocode that selected an independent fresh decompile

The pseudocode view parsed its parent's parameters with a selection
schema that admitted only procedure and document. A procedure_pseudo_code
observation made with analysis independent_fresh records that field, so
its summary view refused the parent. Through the CLI's new summary
delivery, `decompile --analysis independent_fresh --detail summary
--evidence_output <file>` would fail after a successful decompile and
never save the bundle; an inline inspect_analysis_view of such Evidence
failed the same way.

The selection schema now admits the analysis the contract offers, and
the contract reads that enum from the same owner.

* test(cli): restore the worker's exit status after synthetic contract command runs

logCliCommand sets process.exitCode on a refused or failed command. The
synthetic routed and input-field harnesses ran in the cli-boundary
project's shared workers (isolate: false) and left that status for later
tests. Each invocation now restores the previous status.

* refactor(cli)!: deliver inspect-managed-members Evidence through the shared --evidence_output (#10845)

inspect-managed-members was the last command with its own Evidence
delivery: a hand-written registration passed --detail and
--evidence-bundle to runProviderAnalysis, whose members-only delivery
variant re-checked heap headroom and published through
deliverAnalysisEvidence. Every other producer writes its bundle with
--evidence_output through publishCliAnalysisEvidence, and elsewhere on
the CLI --evidence-bundle names an input bundle to read.

The command now registers from the inspect_managed_members contract on
a session target with evidenceDelivery, like inspect-managed-artifact;
--type is the contract's type_names. runProviderAnalysis loses its
delivery parameter and its two refusals, and deliverAnalysisEvidence,
now unused, is deleted. Its lifecycle tests drive publishEvidenceDelivery
directly or the CLI delivery; the managed-only headroom pre-check tests
are removed, since the shared delivery deliberately does not
re-authenticate immutable Evidence and keeps the writer's check for
mutable sources.

BREAKING CHANGE: `rea inspect-managed-members --evidence-bundle <path>`
is now `--evidence_output <path>`; the old flag is refused as an unknown
flag. With `--detail summary`, stdout is now
`{"summary": <summary Evidence>, "evidence_bundle": {"path", "bytes"}}`
instead of the summary Evidence alone, and a publication failure is the
shared delivery's error projection without the `error` label or
`input_path`. A summary without a destination names `evidence_output`
in its issue path. Migrate by renaming the flag and reading
`.summary`. Compatibility is not kept: one spelling cannot mean "read
this bundle" on view and workflow commands and "write this bundle" on
one producer.

* refactor(cli): project analyze-javascript-application and analyze's JavaScript route from one contract projection

analyze-javascript-application declared its options by hand, mapped
about twelve option names to contract fields itself, parsed its delivery
separately and resolved its own caller path. analyze's JavaScript route,
projected from the same contract, omitted every field but the path,
source selection and integrity policy, so the two commands for one
contract offered different options.

Both now use javaScriptApplicationCliProjection and
runJavaScriptApplicationCommand: the path positional, --artifact-format,
--source-path, and the two options that accept a JSON file
(--source-paths-json, --semantic-precision), with contract delivery.
analyze therefore takes the JavaScript budgets, --artifact-format,
--semantic-precision and --detail/--evidence_output/--view for
JavaScript targets, and refuses them by CLI key for native targets.
javascriptApplicationOptions is deleted.

The command's missing-target refusal now names its CLI key, "path",
as every contract command does.

* refactor(cli): project the apktool commands from their contracts (#10878)

* refactor(cli): project the apktool commands from their contracts

* refactor(cli): project the Flutter commands from their contracts (#10882)

* refactor(cli): project the Flutter commands from their contracts

* refactor(cli): project the JEB commands from their contracts (#10888)

* refactor(cli): project the JEB commands from their contracts

* refactor(cli): project the Android package, class, method and reference commands from their contracts (#10893)

* refactor(cli): compose compare-managed-members from its contract over two inspected targets (#10914)

* refactor(cli): compose compare-managed-members from its contract over two inspected targets

The contract command builder takes Evidence targets: required contract
fields that each take the Evidence a source contract produces for one
positional target, with the source's options admitted for every target.
compare-managed-members now inspects each path through the typed managed
runner, as inspect-managed-members does, and compares the records as MCP
compare_managed_members does. A failing candidate names its argument and
retains the baseline's Evidence; a cancellation as the comparison settles
retains the comparison. The path-only comparison service is removed.

* fix(cli): drain queued interrupts before a composed command settles

Select snapshot faults by file identity, guard real permission denial to
hosts that enforce it, and release retained owners when a test fails.

* refactor(cli): project the ADB commands from their contracts (#10934)

Each ADB command is registered from its ADB_TOOL_CONTRACTS entry through
registerContractCommand, keeping its positionals, flags and kebab-case path
keys. start-adb-activity keeps its repeatable --extra type:key:value option,
which supplies the contract's extras.

* refactor(cli): project Frida discovery from its contracts and share Frida request mapping with MCP (#10951)

list-frida-devices and list-frida-processes are registered from their
contracts, with each remote member as its own option, and admit the request
MCP would send. instrument-with-frida keeps its argv but builds and admits
the instrument_with_frida contract input. One application owner maps Frida
contract inputs to service requests for both adapters.

* refactor(cli): finalize the Evidence-target composition through runOwned

runOnEvidenceTargets turned a completed comparison into a cancellation by reading the abort signal by hand, which main's architecture guard now refuses outside runOwned. The composition now finalizes through runOwned: its close drains queued interrupts (it owns no resource), and a cancellation observed as it settles keeps the completed Evidence as the partial observation, as before.

* fix(errors)!: keep every completed argument's observation beside a composite failure's own partial (#10961)

* fix(errors): keep every completed argument's observation beside a composite failure's own partial

* test(errors): cover argument observations through cleanup composition and the partial-free fallback

* test(errors): settle the cleanup through its owner's release in the argument-observation case
…lder (#10962)

* refactor(cli): project instrument-with-frida through the contract builder with CLI-only positionals and handler-filled fields

* fix(cli): keep omitted flattened members omitted so partial capture limits keep their Evidence

* refactor(cli): project the CDP page-target browser commands from their contracts (#10976)

* refactor(cli): project the CDP page-target browser commands from their contracts

* refactor(cli): project inspect-web-page from its contract with a branch-selecting flag

* test(cli): enroll the browser commands in the parity registration check and refuse unenrolled argv fixtures

* refactor(cli): project the V8 Inspector and Electron commands from their contracts (#10977)

* refactor(cli): project the V8 Inspector runtime commands from their contracts

* test(cli): enroll the V8 Inspector runtime commands in the parity registration check

* refactor(cli): project the Electron page observation commands from their contracts (#10987)

* refactor(cli): project the Electron page observation commands from their contracts

* test(cli): enroll the Electron page observation commands in the parity registration check

* refactor(cli): project inspect-electron-fuses from its contract with the shared caller-path rule

The command now registers through registerContractCommand with `path` as a
caller path, so the builder's absoluteCallerPath owns relative-path
anchoring and the command's own absoluteElectronFusePath copy is removed.
inspectWithService records the caller's spelling as caller_input_path.

The named file is unchanged: every `..` is kept for the filesystem, and
Win32 resolves as before. The recorded selected_path drops `.` segments
and repeated separators (`App.app/./` -> `App.app/`), and an empty path is
now refused at argv parsing (VALIDATION_ERROR) like every other
caller-path command.

* test(cli): derive contract-built commands from the builder registries instead of a hand list

Every command named after a public tool contract must register through a contract builder unless it is in a shrinking list of hand registrations, and the renamed contract commands are listed exactly, so an earlier migration that reverts fails instead of dropping out of the parity cases. The JSON-document command hand list is covered by the same check and removed.

* test(cli): drop the empty inspect-electron-fuses path mismatch the CLI now refuses

* refactor(cli): project compare-web-screenshots and analyze-web-bundle from their contracts with builder JSON inputs (#11012)

* refactor(cli): project compare-web-screenshots from its contract with builder JSON inputs read from inline text or a file

The contract command builder gains jsonInputs: structured fields taken as inline JSON or a JSON file path (- reads stdin), read when the command runs and admitted with the contract input before any target is opened. Inline text that is not JSON is refused under its CLI key; a file that cannot be read keeps its own failure. compare-web-screenshots takes both artifacts this way, replacing its hand-written JSON argument parsing.

* refactor(cli): project analyze-web-bundle from its contract

analyze-web-bundle now registers through registerContractCommand with Evidence and view delivery, semantic_precision as a builder JSON input, and source_map_limits flattened onto the existing --source-map-* flags. Page-inspection extras stay omitted, and script sources stay on as the contract default. The superseded javascriptRouteDelivery options, passive browser scope options, observation duration helper and fetched source-map option set are removed.

* refactor(cli): take semantic_precision of JavaScript application analysis as a builder JSON input

analyze-javascript-application and the analyze route read --semantic-precision through the contract builder's jsonInputs instead of a CLI-only option decoded in the handler, so the decoded budgets are admitted with the contract input before analysis.

* refactor(cli): route compare-web-captures to the contract input shape its documents select (#11027)

* refactor(cli): route compare-web-captures to the contract input shape its documents select

* fix(cli): keep routed defaults advertised and reuse the admitted capture parse

* fix(cli): keep explicit routed options distinct from advertised defaults

* refactor(cli): project inspect-ntfs-journal from its contract (#11043)

* refactor(cli): project inspect-ntfs-journal from its contract

* refactor(cli): project the pcap commands from their contracts (#11045)

* refactor(cli): project the pcap commands from their contracts

* refactor(cli): project inspect-playwright-trace, the Cutter commands and execute-rizin-command from their contracts (#11046)

* refactor(cli): project inspect-playwright-trace from its contract

* refactor(cli): project the Cutter commands from their contracts (#11047)

* refactor(cli): project the Cutter commands from their contracts

* refactor(cli): project execute-rizin-command from its contract (#11048)

* fix(cli): refuse a selected page without summary delivery before opening the target

* refactor(cli): project export-web-scripts and trace-web-module-imports from their contracts (#11053)

* refactor(cli): project export-web-scripts and trace-web-module-imports from their contracts

* fix(cli): describe export-web-scripts paths as resolved against the working directory

* refactor(cli): project the web runtime and JavaScript recovery commands from their contracts (#11084)

* refactor(cli): project the web runtime commands from their contracts

* refactor(cli): project recover-javascript-sources from its contract

* refactor(cli): select a contract input branch by its literal field and project guided-workflows (#11085)

* refactor(cli): select a contract input branch by its literal field and project guided-workflows

* fix(cli): refuse delivery options before reading JSON inputs

* fix(cli): keep branch-only defaults to their branch and name admission issues by CLI key

A branch-only field no longer carries its default into the shared options, so another branch never receives it; the selected branch applies the default on parse. Contract admission failures are projected to CLI keys like handler failures. CLI defaults are typed only on top-level fields, the one place that applies them.

* refactor(cli): project compare-process-captures from its contract, checking each capture before reading the next (#11114)

* refactor(cli): project compare-process-captures from its contract, checking each capture before reading the next

The contract builder gains jsonInputChecks: each check runs on a decoded JSON input as soon as it is read, in argv order, so a refused input stops the command before the next is read; the handler receives what each check admitted. compare-process-captures authenticates the left capture before reading the right and the right before the trace specification, then compares the authenticated facts. It now also takes inline JSON, stdin and --max-capture-age-ms like MCP. Empty JSON input text is refused at argv. A JSON input whose final file close fails is reported as cleanup_incomplete naming the file instead of an unclassified failure. compareProcessEvidenceFiles and its trace-spec parser are removed.

* fix(cli): retry a refused JSON input close and keep the read's refusal beside incomplete cleanup

parseCliJsonInput gives the file's owner a resource scope, so a transient close refusal is retried before the command fails. A close that still fails reports cleanup_incomplete composed with the read's own refusal. Routed commands refuse routes that check a shared JSON input differently, since it is checked before the route is chosen.

* refactor(cli): project inspect-web-network-capture from its contract with nested protobuf options

The contract builder flattens a nested optional object member in turn (protobuf.schema), resolves a flattened caller-path member and reports it as spelled under its dotted path in callerInputs, keeps a flattened member's contract default out of argv so an omitted member stays omitted, and takes an array of numbers as repeated decimal tokens within its bounds. inspect-web-network-capture registers from its contract with the same option names; Evidence keeps the capture and descriptor paths as the caller spelled them. CLI input issues name the capturePath argument.

* fix(cli): name a selector field by its own option in admission issues

A selector parameter's positional may share another key (decompile's procedure positional is address), so mapping the field to its positional key renamed selection issues that already name the option, such as a missing or conflicting --procedure. Map a selector field to its option.

* fix(cli): retain a JSON input file whose close fails and keep why its read stopped

parseCliJsonInput dropped its per-read scope after the owner's close retry failed, so the handle lost its owner, and a read or cancellation failure recorded before the close was replaced by the cleanup failure. The read's scope now stays with the CLI process until final CLI cleanup retries it, and the recorded outcome is translated once into the primary failure with the cleanup attached. The module moves into src/cli so it can register with the CLI process owner without a layer cycle.

* refactor(cli): project inspect-with-objdump and inspect-api-contract from their contracts (#11142)

* refactor(cli): project inspect-with-objdump, list-objdump-architectures and inspect-api-contract from their contracts

The contract builder selects input branches by a field that is a literal in
one branch and an enum in another, takes the default of the one branch that
admits omission, and lets a command take a subset of a union's branches by
their discriminating values, fixing the field when one value is selected.

* refactor(cli): project trace-web-source-location from its contract with flattened positional objects (#11167)

* refactor(cli): project trace-web-source-location from its contract with flattened positional objects

The contract builder flattens required objects as well as optional ones; a
flattened field listed in positionals takes its members as positionals in
member order. The hand-written source-map limit options and the separate CLI
delivery schema are removed.

* fix(cli): refuse to flatten a required object without a required member

* fix(cli): refuse a malformed Evidence-input document before reading the selected bundle

runEvidenceInputCommand admits the document with its transport frame before
it reads --evidence-bundle, so every Evidence-input command refuses a
malformed document first, as compare-static-and-observed-endpoints already
did by hand.

* test(cli): expect a selector field to be named by its option in input issues

* fix(cli): report a refused view before the delivery rule it would trip

Refusing delivery options before JSON inputs are read checked --evidence_output before the view's own schema, so a summary view naming an unknown field reported only the missing bundle. Admit the view with the contract's view field first, as full admission does.

* refactor(cli): project inspect-android-jni-bindings from its contract with a grouped --query option (#11196)

* refactor(cli): project inspect-android-jni-bindings from its contract with a grouped --query option

A projection's fieldGroups take several optional top-level contract fields as the members of one JSON object option. The text is decoded when the command runs, refused with the group's message when it is not a JSON object, a member that is not one of the group's fields is refused by its path, and the contract admits each member as its field. inspect-android-jni-bindings keeps its --query selection through a group and now registers through the contract builder, so the hand-registered contract command list is empty; the superseded parseCliAnalysisEvidenceDelivery and androidJniDeliverySchema are removed.

* fix(cli): refuse an object rule that names a grouped field

A grouped field is a JSON member, not an option, so a contract rule such as dependentRequired naming it would be advertised over an option that does not exist. Registration now refuses that combination.

* fix(cli): describe the --view and --maxCaptureAgeMs options of projected commands

A projected view field kept no help because the contract's own description was skipped and none replaced it, and compare-process-captures exposed max_capture_age_ms without help. The canonical CLI catalog test refused both. The view option now takes the same help in both builders.

* refactor(cli): derive the CLI command inventory from the contract registry (#11248)

A contract now declares `cli: true` when the CLI exposes it as the command
named by its kebab-case name. The primary CLI inventory (CLI_COMMAND_NAMES,
now owned by catalogIdentity.ts) is derived from those declarations plus the
commands no contract names, and a contract projection omits `command`: the
builder names the command from the contract and refuses a contract that does
not declare one. CLI_COMMANDS keeps only the 32 commands no contract names;
the 164 contract-named entries and the copied MCP-only list in
cliToolCoverage.test.ts are removed.
…ceed capacity

A capacity failure while decoding #US literals discarded the member facts already decoded, because the shared representation budget threw through the whole inspection. Literals carry their own coverage, so the inspection is retried without them and reports user_strings as partial with the capacity issue. compare-managed-members, which now runs full inspections, keeps comparing members it used to read with literals disabled.
…with its default

Builder admission of compare-web-captures, compare-web-screenshots and analyze-web-bundle names input issues by the CLI key (beforeJson, afterJson, normalizationJson, endpoint), and --integrity-policy help states its default. Four test files still expected the contract field names and the old help, so they failed on the stack.
…at every case names one

Every invalid browser input now carries its CLI key, so the fallback branch narrowed to never and failed the TypeScript compiler's typecheck.
…er-guard file

Rebased on main after #11316 split the guard baselines and #11181 threaded the launch environment into the web bundle command; the contract-built analyze-web-bundle command now passes that environment to the browser provider.
@morluto
morluto force-pushed the fix/plist-target-issue branch from ba7e7d5 to c36bb9e Compare November 15, 2026 16:20
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai please review the latest commit (c36bb9e): rebased on main after #11316 split the guard baselines; the contract-built analyze-web-bundle command now passes the launch environment from #11181 to the browser provider, and the moved cliJsonInput entry is carried into its per-guard baseline file.

…instead of parsing again (#11301)

* refactor(cli): hand whole-input contract handlers the admitted parse instead of parsing again

* refactor(cli): parse an argv whole input only when the handler reads it

Admission parsed every argv whole-input command eagerly, so handlers that
hand the raw input to a service (inspectWithService) parsed it twice.
parseWholeInput now parses on the first admittedContractInput call and
reuses the result; run-time JSON and view delivery still parse at
admission. The test counts whole-schema evaluations.

* refactor(cli): hand JSON-document handlers the admitted parse of their document (#11332)

observe-native-calls, capture-electron-scenario and match-native-functions
parsed their resolved document against the contract schema in the handler.
registerContractDocumentCommand now gives each document handler
parseWholeInput, a memoized parse of the resolved document as the whole
contract input whose refusal names the caller's spelling, so
admittedContractInput serves argv and document commands alike. A handler
whose document is not the whole input never calls it, so it adds no parse.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai please review the latest commit (bf87762), which includes the rebase on main after #11316 and the collapsed #11301.

Comment thread src/cli/processCommands.ts Resolved
Comment thread docs/getting-started/cli.md Resolved
compare-process-captures walked and copied both capture records again in
the whole-input parse after their checks had admitted them. Admission now
parses the remaining fields with the contract and hands the handler the
checked documents uncopied. The managed summary example names
--evidence_output.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto merged commit 8977840 into main Nov 15, 2026
14 of 18 checks passed
@morluto
morluto deleted the fix/plist-target-issue branch November 15, 2026 19:22
morluto added a commit that referenced this pull request Nov 16, 2026
…ptional() (#11661)

* fix(cli): describe a contract option whose description sits inside .optional()

zod does not carry a wrapped schema's description to its .optional()
wrapper. Since #10798 projected analyze_javascript_application from its
contract, source_paths is javaScriptSourcePathsSchema.optional(), so
'analyze --help' and 'analyze-javascript-application --help' listed
--source-path with no description and cliOptionAliases.test.ts fails on
main.

The contract option projection now reads the field's description through
its wrappers (describedThroughWrappers), once for every argv branch, in
place of three per-branch copies that read only the outer schema. The
opener and member option projections use the same reader.

* test(cli): assert the exact help text of a wrapped contract field and of a projection override
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 22, 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.

1 participant