Repository navigation
refactor(cli): project endpoint comparison and browser scenario documents with delivery options - #10711
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. |
[Medium impact] The PR appears safe to merge; the previous document-check ordering issue is fixed. SummaryMoves endpoint comparison and browser scenario commands onto shared contract-derived document registration.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CLI arguments and options] --> B[Check delivery options]
B --> C[Read JSON document]
C --> D[Refuse omitted or flagged fields]
D --> E{Command}
E --> F[Check endpoint document fields]
F --> G[Read selected Evidence bundle]
G --> H[Service checks sources and compares]
E --> I[Check browser scenario]
I --> J[Validate only or capture]
H --> K[Deliver requested output]
J --> K
Reviews (3) · Last reviewed commit: "fix(cli): admit the endpoint comparison ..." · Reviewed by Greptile |
44c8628 to
b81ed2a
Compare
ce4fa7c to
abd18b3
Compare
… endpoint and browser scenario commands A JSON-document projection can now take the contract's detail and view fields as --detail, --evidence_output and --view beside the document. The document refuses those fields with the option to use, and the delivery is admitted by the contract's own view schema before the document is read. compare-static-and-observed-endpoints, capture-browser-scenario and validate-browser-scenario now register from their contracts; validation projects the capture contract without detail.
…vidence bundle The document command context carries the document's transport frame, so a handler that reads an Evidence bundle first can refuse a malformed document beforehand, as the hand-written command did.
b81ed2a to
e8b0a9e
Compare
abd18b3 to
05ed54d
Compare
|
Restacked onto the rebased #10600 (after #10589 merged to main). Main's new |
…ents with delivery options (#10711) * refactor(cli): carry document command delivery as options and project endpoint and browser scenario commands A JSON-document projection can now take the contract's detail and view fields as --detail, --evidence_output and --view beside the document. The document refuses those fields with the option to use, and the delivery is admitted by the contract's own view schema before the document is read. compare-static-and-observed-endpoints, capture-browser-scenario and validate-browser-scenario now register from their contracts; validation projects the capture contract without detail. * fix(cli): admit the endpoint comparison document before reading its Evidence bundle The document command context carries the document's transport frame, so a handler that reads an Evidence bundle first can refuse a malformed document beforehand, as the hand-written command did. * refactor(cli): pass only object documents to the document field refusal
… its contract document (#10700) * refactor(cli): project observe-native-calls onto a session target and its contract document * refactor(cli): project endpoint comparison and browser scenario documents with delivery options (#10711) * refactor(cli): carry document command delivery as options and project endpoint and browser scenario commands A JSON-document projection can now take the contract's detail and view fields as --detail, --evidence_output and --view beside the document. The document refuses those fields with the option to use, and the delivery is admitted by the contract's own view schema before the document is read. compare-static-and-observed-endpoints, capture-browser-scenario and validate-browser-scenario now register from their contracts; validation projects the capture contract without detail. * fix(cli): admit the endpoint comparison document before reading its Evidence bundle The document command context carries the document's transport frame, so a handler that reads an Evidence bundle first can refuse a malformed document beforehand, as the hand-written command did. * refactor(cli): pass only object documents to the document field refusal * refactor(cli): project inspect-artifact and extract-artifact with open_binary target options (#10722) * refactor(cli): project inspect-artifact and extract-artifact with open_binary target options A declared session target can now take fields of the contract an MCP client opens the target with as options. They are admitted by that contract, with the target as its path, before the target is opened, and the projection can narrow an enum to the values the command supports. inspect-artifact and extract-artifact are derived from their contracts with open_binary's format and ESP flash fields. MCP open_binary and the CLI share one mapping from those fields to the target selection. extract-artifact now runs under the command's cancellation signal. * fix(cli): read open_binary from its session contract so startup stays lazy * build(lint): refuse value imports of the complete tool catalog in CLI startup modules
Summary
Next slice of plan W1, stacked on #10700 (base
refactor/cli-contract-native-call-document; retarget as the lower PRs merge). Refs #10583.A JSON-document projection can now take the contract's
detailandviewfields as--detail,--evidence_outputand--viewbeside the document.compare-static-and-observed-endpoints,capture-browser-scenarioandvalidate-browser-scenarioare derived from their contracts with it.Problem and expected behavior
These three commands were the last JSON-document commands outside the contract-document projection, because they take contract fields as flags beside the document:
compare-static-and-observed-endpointsimported the facts schema separately from its contract. It parsed--viewwith a private delivery schema and a hand-writtensuperRefine.capture-browser-scenarioandvalidate-browser-scenarioadvertisedbrowserScenarioSchemadirectly and resolvedbrowser.executable_paththrough their own helper.detailorviewkey inside the document was refused only as an unrecognized key, without naming the option to use.Expected behavior is unchanged apart from these refusal messages: the same arguments and options, the same delivery defaults (
--detail complete), and the same services.Change and scope
contractCliDescription.ts:CliDocumentProjectiongainsevidenceDeliveryandviewDelivery, with the same meaning as on the flag projection.deliveryOptions, and lists them inflagged.documentRefusalsgives each omitted or flagged field its refusal, for exampledetail is not accepted in the document: pass --detail beside it.admitDeliverydecodes--viewand admits it with the contract's ownviewschema. A page needs--detail summary, and summary needs--evidence_output.contractCommand.ts: renders the delivery options and admits the delivery before the document is read.ContractDocumentContext.deliverycarries the admitted choice.staticObservedEndpointsCommand.ts: registered fromcompare_static_and_observed_endpoints. The service still owns document admission.cliBrowserScenarioCommands.ts:capture_browser_scenario, withbrowser.executable_pathas a declared caller path.detailand gives the reason.browserScenarioSchemastill owns semantic diagnostics, which cite the document as the caller spelled it.match-native-functionskeepsdetailinside its document (default summary). Moving it to a flag would change its CLI contract.browser.executable_path's spelling in Evidence (W1 step 7).Contract and boundary impact
--schemadocuments are unchanged; the browser scenario--schemanow also advertises thatbrowser.executable_pathaccepts a caller-relative path, which the command already resolved.--viewdescription now readsJSON page selection; requires --detail summary and --evidence_output.detailorviewkey names its option. Acapture-browser-scenariodelivery refusal no longer carries theBrowser scenario capture failedheadline; itscodeand issues are unchanged.Expected effects (unchanged from the existing commands):
Evidence and regression coverage
jsonInputStatus.test.ts: the three commands refusedetail(and endpointsview) inside the document, naming the option to use, through the compiled CLI.cliContractCommandParity.test.ts:complete, malformed and invalid views, summary without a sink) and the projection invariants.jsonInputStatus.test.ts:compare-static-and-observed-endpoints '{}' --evidence-bundle <missing>is refused for the document's missing fields before the bundle is read. The handler admits the document withContractDocumentContext.frame, the advertised transport frame, as the hand-written command did. This test fails with that check removed.jsonInputSchema.test.ts: the browser scenario documents declarebrowser.executable_pathas a caller path.staticObservedEndpoints.test.ts(CLI--view, summary, missing sink and invalid view),browserScenarioValidation.test.ts,browserScenarioSummaryCli.test.ts,scenarioCliInputDiagnostics.test.ts,cliJsonCallerPath.test.ts,cliJsonStdinCli.test.ts.detailkey is refused only as an unrecognized key. This is source-derived; the new message assertions cannot pass there.Validation performed
npm run test:focused -- tests/acceptance/applications/staticObservedEndpoints.test.ts tests/boundary/cli/browserScenarioValidation.test.ts tests/boundary/cli/browserScenarioSummaryCli.test.ts tests/boundary/cli/scenarioCliInputDiagnostics.test.ts tests/boundary/cli/jsonInputStatus.test.ts tests/boundary/cli/cliJsonCallerPath.test.ts tests/boundary/cli/cliJsonStdinCli.test.ts tests/boundary/cli/cliContractCommandParity.test.ts tests/boundary/cli/jsonInputSchema.test.ts: 9 files, 376 tests passed.npm run test:focused -- tests/boundary/cli/jsonInputStatus.test.ts tests/acceptance/applications/staticObservedEndpoints.test.ts: 43 passed; with the frame check removed, the new case failed (1 failed, 41 passed).npm run check:fast: passed.npm run docs:check: passed.npx oxfmt --checkon the changed files: passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.