Skip to content

refactor(providers): move the native command runner into the shared provider core - #11462

Merged
morluto merged 2 commits into
mainfrom
refactor/native-command-runner-provider-core
Nov 15, 2026
Merged

morluto merged 2 commits into
mainfrom
refactor/native-command-runner-provider-core

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Moves src/native/CommandRunner.ts to src/providers/NativeCommandRunner.ts, the shared provider core, with git mv and specifier rewrites. The file content is unchanged apart from its relative imports.

The runner (XcrunCommandRunner, NativeCommandRunner, NativeCommandFailure, resolveXcrunTool, failureCapture) runs allowlisted host Xcode tools under owned-process supervision. Two provider folders use it: native (otool, nm, codesign and others) and artifacts (MachOSliceArtifactReader runs lipo -detailed_info). With the runner in the provider core, both import it inward, so:

  • crossProvider artifacts -> native 1 -> 0;
  • the recorded mutual import artifacts <-> native leaves the cycles baseline (7 -> 6).

Follows #11460, which moved the lipo parser to src/domain/apple. Refs #11359. Part of plan W9.

Problem and expected behavior

MachOSliceArtifactReader imported the native provider's command runner, and native imported artifacts, so the two provider folders formed a cycle. Expected: code that two providers share lives below them.

Change and scope

  • Why the provider core and not a port in src/ports/: the runner's imports are already at or below the provider core (providers/OwnedCommandCleanup, process/*, platform, resources, domain), and NativeCommandFailure depends on processInspectionFailure from providers/OwnedCommandCleanup. A port could not hold the failure type without a second failure model. The provider core already holds the runner's building blocks (runOwned, OwnedCommandCleanup).
  • Baselines: captured-output-copy re-keys the runner's entry (same count); the layer baseline loses artifacts -> native and the artifacts <-> native cycle.
  • 35 importers rewritten (14 native source files, artifacts, and tests).

Not included: native's remaining imports of artifacts (withArtifactTargetIdentity, hashStableRootArtifact, the PE resource layout and parser, a test fixture). Those are native -> artifacts edges, tracked in #11426 and #11359.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the runner keeps its code; its location moves from the native provider to the shared provider core. No behaviour change.
  • Contribution scope fit and linked maintainer decision: [Design] Provider-to-provider import rule with declared exceptions #11359. No new capability.
  • CLI and MCP/tool-catalog contract: none.
  • 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): not applicable; the runner's process supervision and cleanup are unchanged.
  • 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: specifier updates only.

  • Base reproduction or other evidence: node scripts/verify-module-boundaries.mjs reported cross-provider import artifacts -> native: 0, baseline 1 and recorded mutual import no longer present: artifacts <-> native.

  • User-visible CLI/MCP output (if applicable): none.

  • Remaining proof gaps: none.

  • 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 check:fast: passed, including the architecture guards.
  • node scripts/verify-module-boundaries.mjs: passed after lowering the baseline.
  • npm run test:focused -- with src/artifacts/MachOSliceArtifactReader.test.ts, src/native/{NativeCommandAnalysisError,NativeCommandDeadline,NativeCommandPreparation,NativeMachoCommandDiagnostics,NativeMachoInspection}.test.ts, tests/boundary/providers/native/{machoSliceReader,nativeCommandResolver,nativeCommandTermination,lldbPrelaunchCleanup,artifactProvider.machOSlices}.test.ts and tests/boundary/filesystem/ownedArtifactReaderCleanup.test.ts: 12 files, 135 tests passed (8.8 s).

Compatibility, safety, and release

  • Breaking changes or migration steps: none. These are internal modules.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: not applicable.

This is a pure move (git mv plus specifier and baseline-key rewrites), so the squash commit goes in .git-blame-ignore-revs after merge.

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.

@chatgpt-codex-connector

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-15T20:32:17.431806Z
We couldn’t complete this review. Comment @codex review to try again.
4afb13f PR opened
ℹ️ 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.

@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.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This refactor appears safe to merge.

Summary

Moves NativeCommandRunner.ts into the shared provider core so native and artifact providers can share it without importing each other.

  • Native and artifact code share the command runner from the provider core.

No actionable issues found. Tests were not run during this review. The full PR was reviewed because the previous and current commits have different merge bases with the target commit. Live supersession status could not be checked because GitHub authentication was unavailable.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  N["Native provider"] --> R["Shared NativeCommandRunner"]
  A["MachOSliceArtifactReader"] --> R
  R --> C["OwnedCommandCleanup"]
  R --> P["OwnedCommand and process supervision"]
Loading

Reviews (7) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@morluto
morluto changed the base branch from refactor/lipo-parser-port to main November 15, 2026 20:38
@morluto
morluto force-pushed the refactor/native-command-runner-provider-core branch from 4afb13f to e05d931 Compare November 15, 2026 20:41
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review the latest commit (e05d931). It is the same move rebased onto main after #11460 merged.

@morluto
morluto force-pushed the refactor/native-command-runner-provider-core branch from e05d931 to 6dc8434 Compare November 15, 2026 21:15
@morluto
morluto force-pushed the refactor/native-command-runner-provider-core branch from 8e04c42 to 01af385 Compare November 15, 2026 21:49
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review the latest commit (01af385). It replays this PR's own commit on current main; the earlier head also contained merge commits from main.

…e-command-runner-provider-core

# Conflicts:
#	scripts/lib/module-layers.baseline.json
@morluto
morluto merged commit a20c659 into main Nov 15, 2026
7 checks passed
@morluto
morluto deleted the refactor/native-command-runner-provider-core branch November 15, 2026 22:26
morluto added a commit that referenced this pull request Nov 15, 2026
#11462, #11496, #11513, #11525 and #11544 moved files without changing their code (only import specifiers and path strings).
@morluto morluto added the area: providers Provider and capability discovery, including provider proposal triage label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Provider and capability discovery, including provider proposal triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant