Skip to content

refactor(artifacts): take the host from HOST_PLATFORM or the caller instead of process.platform - #11090

Merged
morluto merged 1 commit into
mainfrom
refactor/host-platform-artifacts
Nov 15, 2026
Merged

morluto merged 1 commit into
mainfrom
refactor/host-platform-artifacts

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

HostPlatform migration (W8), src/artifacts. Artifact readers and the artifact provider take the platform from their caller or from HOST_PLATFORM explicitly instead of reading process.platform. The asset-catalog tests select macOS by passing it instead of redefining process.platform.

Problem and expected behavior

Ten ambient process.platform reads remained in src/artifacts. analyzeAppleAssetCatalogs gated on the ambient platform, so AppleAssetCatalogAnalysis.test.ts and assetCatalogCancellationReason.test.ts redefined process.platform to reach the macOS path on other hosts. Expected: pure helpers take the platform; host-bound operations read HOST_PLATFORM explicitly; tests inject.

Change and scope

  • Required parameter: artifactCapabilities(platform) (both callers already passed it).
  • Host seams defaulting to HOST_PLATFORM.platform: ArtifactProvider constructor (composition passes the platform), SafeOutputTree.create, hostExecutableMarking, and a new optional platform input on analyzeAppleAssetCatalogs (assetutil runs on this host).
  • Host-bound reads now name HOST_PLATFORM: native DMG traversal (this host's hdiutil), the darwin-only inventory reader gate, ASAR component admission, dylib resolution path syntax, keyed-archive remediation fallback.
  • Tests: AppleAssetCatalogAnalysis.test.ts and assetCatalogCancellationReason.test.ts pass platform: "darwin"; the latter no longer skips on hosts whose process.platform cannot be redefined.
  • Baseline: 10 ambient-host-platform entries removed.
  • Not included: other folders (separate PRs).
  • Scope: internal refactor; no target execution, injection, mutation or protection recovery.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/platform/HostPlatform; consumers are artifact readers and the artifact provider.
  • Contribution scope fit and linked maintainer decision: not applicable (approved cleanup plan, W8).
  • CLI and MCP/tool-catalog contract: unchanged.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): 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 updated: src/artifacts/apple/AppleAssetCatalogAnalysis.test.ts, tests/process-global/assetCatalogCancellationReason.test.ts.
  • Base reproduction or other evidence: source-derived (refactor); macOS host, so the darwin gate is exercised both before and after.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: Linux/Windows not run locally; on those hosts the cancellation test now runs (previously skipped where process.platform was not configurable).

Validation performed

  • npx tsc --noEmit -p . — passed.
  • node scripts/verify/architecture-guards.mjs --shrink-baselines — passed; baseline lowered.
  • npm run test:focused -- src/artifacts/apple/AppleAssetCatalogAnalysis.test.ts tests/process-global/assetCatalogCancellationReason.test.ts tests/boundary/mcp/asarListingAdmissionMcp.test.ts tests/boundary/mcp/dylibResolutionMcp.test.ts tests/boundary/filesystem/keyedArchiveStandaloneSelection.test.ts tests/boundary/filesystem/safeOutputTreeCloseFailures.test.ts src/artifacts/ArtifactProviderCleanup.test.ts src/artifacts/apple/KeyedArchiveHostDenial.test.ts tests/boundary/mcp/artifactMcp.test.ts — 9 files passed (92 passed, 2 skipped).
  • npm run check:fast — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none (internal API).
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no change.

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-15T12:11:15.527492Z
We couldn’t complete this review. Comment @codex review to try again.
5ac07f2 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 Tier: plus

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

Replaces ten direct process.platform reads in artifact code with caller values or HOST_PLATFORM.

  • Artifact providers use the shared host platform by default.
  • Apple asset-catalog checks can use a caller-selected platform.
  • Artifact readers use the shared host platform for host-specific rules.

Reviews (1) · Last reviewed commit: "refactor(artifacts): take the host from ..." · Reviewed by Greptile

@morluto
morluto merged commit b06c340 into main Nov 15, 2026
7 checks passed
@morluto
morluto deleted the refactor/host-platform-artifacts branch November 15, 2026 12:19
@morluto morluto added the area: evidence Evidence, artifacts, and reconstruction label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant