Repository navigation
refactor(cli): project JSON-document workflow commands from their contracts - #10668
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The PR appears safe to merge; no blocking issue remains. SummaryMoves 16 JSON-document commands onto one contract-based description and registration path.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Named contract and CLI choices] --> B[Document description]
B --> C[Advertised argument schema]
B --> D[Shared command registration]
D --> E[Decode inline JSON, file, or stdin]
E --> F[Resolve declared caller paths]
F --> G[Owning service checks input]
G --> H[Run workflow and await cleanup]
H --> I[Return result or error]
Reviews (2) · Last reviewed commit: "test(cli): include WASM interface and na..." · Reviewed by Greptile |
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 14, 2026 20:33
bca9646 to
7092a1f
Compare
morluto
force-pushed
the
refactor/cli-contract-json-document
branch
from
November 14, 2026 20:33
e0d0dfd to
4f61b76
Compare
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 15, 2026 01:45
7092a1f to
e21b171
Compare
morluto
force-pushed
the
refactor/cli-contract-json-document
branch
from
November 15, 2026 01:45
e267296 to
1fd7db5
Compare
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 15, 2026 05:58
e21b171 to
d85f894
Compare
morluto
force-pushed
the
refactor/cli-contract-json-document
branch
from
November 15, 2026 05:58
1fd7db5 to
dcc1991
Compare
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 15, 2026 07:34
d85f894 to
af4cad5
Compare
morluto
force-pushed
the
refactor/cli-contract-json-document
branch
from
November 15, 2026 07:34
dcc1991 to
46f4815
Compare
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 15, 2026 09:34
af4cad5 to
edbf64e
Compare
morluto
force-pushed
the
refactor/cli-contract-json-document
branch
from
November 15, 2026 09:37
46f4815 to
85df160
Compare
Base automatically changed from
refactor/cli-contract-session-target
to
refactor/cli-contract-path-lists-flattened
November 15, 2026 09:39
morluto
changed the base branch from
refactor/cli-contract-path-lists-flattened
to
main
November 15, 2026 09:45
morluto
force-pushed
the
refactor/cli-contract-json-document
branch
from
November 15, 2026 10:08
85df160 to
2dd9aec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the eleventh slice of plan W1. It is stacked on #10656 (base
refactor/cli-contract-session-target); retarget it as the lower PRs merge. Refs #10583.This PR adds a JSON-document projection for contracts whose whole input is one JSON document. It moves 16 hand-written JSON-input commands onto that projection:
compare-wasm-interfacesmatch-native-functionscompare-artifactsinspect-analysis-viewimport-managed-reconstruction,verify-managed-native-boundariesandproject-managed-application-graphtrace-application-feature,trace-javascript-semantics,compare-application-versions,compare-javascript-export-shapesandproject-{android,apple,harmony}-application-graphreconcile-javascript-runtimecapture-electron-scenarioProblem and expected behavior
Each JSON-input command hand-wrote the same pieces:
contentSchema(or omitted it);These copies had drifted:
compare-wasm-interfacesandmatch-native-functionsadvertised a bare string in--schema, with nocontentSchema. This is the [Bug] CLI --schema on JSON-input commands emits only the outer inputJson string wrapper #9195 class.project-managed-application-graph) when JSON decoding failed, but the contract operation (project_managed_application_graph) when the decoded input was refused.contentSchemasource by hand: the frame schema, the request schema or nothing.Expected: one projection owns the argument, its advertised content, decoding and caller-path resolution. Every failure from one command names the same contract operation.
Change and scope
contractCliDescription.ts:CliDocumentProjectionanddescribeContractDocumentCommand.getEvidenceInputContract(...).frameSchemaleaves inline Evidence carriers to their owner, as before.omitdeclares fields the one-shot command does not admit.trace-application-featureuses it for the MCP-onlyview.callerPathslists property paths inside the document.cliOptionsdeclares CLI-only options such as--evidence-bundle.inputJson.contractNamedaccepts any named contract list.flattenandCliSessionTarget).contractCommand.ts:registerContractDocumentCommandrenders the projection as an IncurinputJsonargument withcontentMediaType/contentSchema. Under the shared command cancellation, it then does the following:parseCliJsonInput, using the contract name as the operation;spelled).The decoded document is still admitted by each command's owning service (its frame or request parser), as before.
Commands:
managedProjectGraphCommand.tsis deleted. The three managed workflows are one table inmanagedCommands.ts.registerEvidenceJsonCommandinapplicationCommands.tsnow delegates to the projection and binds each command to its contract by name. The hand-built document schema constants are removed.Application workflow failed,Electron analysis failed, and the unlabeled managed results).Parity guard (
cliContractCommandParity.test.ts):inputJsonargument, whosecontentSchemais its described content.Not included (next slices):
compare-source-to-bundle,compare-static-and-observed-endpoints,capture-browser-scenarioandvalidate-browser-scenariouse CLI-specific document schemas or delivery options.build-reconstruction-obligation-ledgerandevaluate-reconstruction-coverageadvertise a schema that differs from their contract frame.inspect-evidence-bundlehas no contract.observe-native-callsis a session target plus a document.Contribution scope: not applicable.
Contract and boundary impact
--schema: identical for 14 commands. Forcompare-wasm-interfacesandmatch-native-functions, the positional is nowinputJson, as on the other JSON commands. It now advertisescontentMediaType: application/jsonand its contract'scontentSchema.<input>became<inputJson>). Positional names do not appear in argv, so invocations are unchanged.inspect-analysis-view, the 7 application workflows and the 3 managed workflows. The fields affected aredetails.operation,recovery.operationand the remediation text.finishAnalysisCommandcleanup run in the same order.npm run docs:checkpasses).Expected effects:
(No effect changes.)
Evidence and regression coverage
User-visible CLI output was captured through
createCli().servebefore and after the change. The capture covered--schema --format jsonand--helpfor all 16 commands, plus 107 argv runs:{bad,{},[], a missing relative file, and an unknown field, for each command;compare-artifactsandinspect-analysis-view;--evidence-bundle;trace-application-featurewith the omittedview;match-native-functionssummary without--evidence_output, and with a relative--source_bundle;capture-electron-scenariowith relative executable and application paths.Results:
inputJsoninstead ofinput.--schemaand help are identical except forcompare-wasm-interfacesandmatch-native-functions.Tests updated for the intended operation name:
jsonInputStatus.test.ts(10 commands plus the file and overlong cases)analysisViewCli.test.tscliJsonInput.test.ts(permission denial)Remaining proof gaps: none known for this slice.
Validation performed
npm run check:fast: passed.npm run knip: no findings.npm run docs:check: passed.npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts: 275 passed.npm run test:focused --with 21 JSON-input, caller-path, electron, analysis-view, managed, WASM-comparison, native-matching, application-workflow, session-parity and finalization-cancellation test files:Compatibility, safety, and release
details.operationof a JSON decoding failure would now see the contract operation.Author readiness
Human owner:
Before merge
type(scope): outcome.