Repository navigation
refactor(cli): project core native commands with open_binary target options - #10736
Conversation
Codex Review Summary: ❌ FailedThis 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 with the reviewed dependent stack; no blocking defect remains. SummaryMoves native and core binary commands onto contract-derived CLI registration and a shared
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CLI arguments and options] --> B[Contract-derived schemas]
B --> C[Check selector agreement and delivery]
C --> D[Admit selected opening fields]
D --> E[runDirectOnTarget]
E --> F[admitOneShotOperation]
F --> G[Open target and run analysis]
G --> H[Finish cleanup]
H --> I{Evidence delivery selected?}
I -->|No| J[Return result]
I -->|Yes| K[Publish complete Evidence or summary]
Reviews (3) · Last reviewed commit: "refactor(cli): project procedure-referen..." · Reviewed by Greptile |
5310117 to
589c9f3
Compare
2394666 to
0b50b74
Compare
589c9f3 to
f766b78
Compare
b8f774f to
8b730fc
Compare
519cfcf to
4255498
Compare
8b730fc to
314a029
Compare
4255498 to
d6b961c
Compare
314a029 to
74f1dec
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
74f1dec to
e05806c
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
6047cc5 to
d270416
Compare
e05806c to
59190c5
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…ptions A session target's opening fields may now be caller paths, admitted resolved and passed on as the caller spelled them, and a union of text forms such as the provider selector renders as one argv token. nativeTarget declares a native executable opened with open_binary's format, architecture, entry point and provider fields, plus the snapshot where a command loads one. runDirectOnTarget runs an operation on that target through runDirectAnalysis, with Evidence delivery when declared. Eleven core native commands are now derived from their contracts. Their inputs are admitted by the service's contract parse, which replaces the CLI's copies of the byte-pattern and data-type selector checks. inspect-native-dispatch-metadata now exposes the contract's Objective-C class import address fields.
…th named selector options (#10738) * refactor(cli): project procedure-references and inspect-native-api with named selector options A contract projection may let the caller give a positional selector with a named option instead, for values that begin with a dash. The positional becomes optional; equal values agree (native addresses by identity), and different values, or neither for a required field, are refused before the target is opened. selectCliAnalysisSelector owns that rule and returns a Result; resolveCliAnalysisSelector remains for the hand-written core binary commands. procedure-references and inspect-native-api are now derived from their contracts on the native session target, which completes the core native family. * fix(cli): refuse empty named and positional selectors before opening the target * refactor(cli): project inspect, xrefs, trace, function and instructions from their contracts (#10747) The five core binary commands are derived from their contracts on the native session target with the snapshot option, using named selector options for the procedure, address and query. A selector projection may require a selector the contract lets the MCP caller omit: xrefs' address defaults to Hopper's cursor, which a one-shot CLI command does not have. A selector names one object, so neither spelling may be empty, as before, even where the contract's text admits it. open_binary's pairing rules now refuse an unpaired --target-format, --architecture or --entry-point for inspect before the target is opened, naming the CLI key. * fix(cli): read core binary contracts from their contract groups so startup stays lazy
59190c5 to
a8bd2c7
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Next slice of plan W1, stacked on #10722 (base
refactor/cli-contract-artifact-target-open; retarget as the lower PRs merge). Refs #10583.Eleven core native commands are now derived from their tool contracts, on a native session target opened with
open_binary's format, architecture, entry point, provider and snapshot fields. This extends thesessionTarget.openmechanism from #10722 with arunDirectAnalysisrunner.Problem and expected behavior
annotate-native-function,search-bytes,inspect-native-load-image,read-bytes,address-to-file-offset,trace-native-values,inspect-native-data-type,inspect-native-instruction,resolve-native-call-targets,trace-native-ui-actionandinspect-native-dispatch-metadatawere hand-written:search-bytesandinspect-native-data-typekept CLI copies of the byte-pattern and selector-choice checks thatrunDirectAnalysisalready runs (admitOneShotOperation) before any target access.inspect-native-dispatch-metadatadid not expose the contract'sobjc_class_import_addressesandobjc_class_import_addresses_completefields.trace-native-valuesheld its own copy of the "source Evidence missing" refusal.Expected behavior: the same arguments, options, defaults and help, with the contract as the single owner of the input.
Change and scope
contractCliDescription.ts:callerPath: the value is admitted by the opening contract in its resolved form and passed on as the caller spelled it, like the target itself. Registration refusescallerPathon a non-string field.autoor a provider ID) renders as one argv token.options.ts:nativeTarget(description, snapshot?)declares a native executable opened withopen_binary'sformat(narrowed todos-com,raw-binary,gamecube-dolas before),architecture,entry_point,provider_idand, where the command loads one,snapshot_path. Flag names (--target-format,--architecture,--entry-point,--provider,--snapshot) and help text are unchanged and shared with the hand-written flags through one help table.contractCommand.ts:runDirectOnTargetmaps the admitted opening throughopenBinaryTargetSelectionand runs the operation withrunDirectAnalysis. WithevidenceDeliveryit publishes complete Evidence or a summary;requireSourceEvidencekeepstrace-native-values' refusal when the session returns no source Evidence.coreNativeCommands.ts: the eleven commands are registered from their contracts; the Hopperdocumentfield is declared omitted where the contract has it.procedure-referencesandinspect-native-api, and the core binary commands, take a selector either positionally or as an option (resolveCliAnalysisSelector). The projection has no such form yet.decompile-directory, utility and managed families.Contribution scope: not applicable. Target selection and authority are unchanged.
contractNamed(OFFICIAL_TOOL_CONTRACTS, …),ENHANCED_TOOL_CONTRACTS,NATIVE_TOOL_CONTRACTS,ELECTRON_TOOL_CONTRACTS,OPEN_BINARY_TOOL_CONTRACT) instead oftoolContractfromtoolContracts.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
admitOneShotOperation) owns cross-field and grammar admission. Removed: the CLI's hand-built inputs, its byte-pattern and data-type selector admission copies, and the per-command opening option mapping (replaced byopenBinaryTargetSelection).inspect-native-dispatch-metadataoptions:--objc-class-import-address(repeatable) and--objc-class-import-addresses-complete.inspect-native-data-type --type ""/--address ""is now refused by argv validation (VALIDATION_ERROR) like other contract-derived empty selectors, instead ofinvalid_request. Still before the target is opened.search-bytesare unchanged for callers (invalid_requestwith the field path, before target access); they now come from the service's admission.--target-format raw-binary/gamecube-dolwith--architecture/--entry-pointis now refused byopen_binary's input schema before the target is opened:invalid_requestwithdetails.issues[].pathnaming the CLI key. The message is the same. Before, the target resolver refused it withdetails.reason.Expected effects (unchanged from the existing commands; left for the human owner to check):
(
annotate-native-functionedits annotations in the ephemeral analysis database, as before.)Evidence and regression coverage
cliContractCommandParity.test.ts: the eleven commands join the parity checks (every contract field exposed or omitted, argv maps to an admitted contract input, renamed fields named by CLI key). For every native-target command: opening values stay out of the contract input,admitOpeningreturns them in contract spelling with the snapshot as typed, the raw-binary pairing rule refuses namingentry-point, and--target-formatrefusesesp-flash-image. Registration refusescallerPathon a non-path field.searchBytesAdmission.test.ts: the mocked-runner rejection cases are removed; they asserted the CLI-local admission copy.searchBytesAdmissionCli.test.ts(real CLI) covers the same refusals before target access and gains the all-zero-mask case.analysisSelectorCli.test.ts: empty--type/--addressnow expectVALIDATION_ERROR.coreNativeCommands.tswas rendered with incur from the parent tree and this branch and diffed: only the reorders and the two new options above differ.For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts: 407 passed.npm run test:focused --12 native CLI boundary files (nativeMachoArm64_32Cli,cliInputSchemaRequired,nativeLoadImageSummaryCli,searchBytesAdmission,nativeDispatchInputBudget,traceNativeValuesEvidenceCli,emptyLocalTargetAdmission,traceNativeValuesCompletenessCli,analysisSelectorCli,nativeDispatchRecordBudget,cliDecimalArguments,nativeDispatchPropertyAttributes): failures insearchBytesAdmissionandanalysisSelectorClibefore the test updates above; passing after.npm run test:focused --searchBytesAdmission,analysisSelectorCli,acceptance/searchBytesAdmissionCli,acceptance/localPathAdmissionCli,acceptance/nativeDispatchSnapshot,acceptance/nativeDispatchFallbackFailure,process-global/cliSelectedEnvironment,filesystem/productCatalog: 57 passed.npm run check:fast: passed.npm run knip: no findings.npx oxfmt --check src/cli tests/boundary/cli tests/acceptance/searchBytesAdmissionCli.test.ts: clean.mainwith the startup-import fix:npm run check:fastpassed (pre-push) at this branch; at the top of the stacknpm 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.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.