Skip to content

refactor(domain): move the Mach-O load command and binary plist readers into src/domain/apple - #11415

Merged
morluto merged 3 commits into
mainfrom
refactor/macho-plist-readers-domain
Nov 15, 2026
Merged

morluto merged 3 commits into
mainfrom
refactor/macho-plist-readers-domain

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

Moves the pure Mach-O load command reader, the Mach-O encryption reader and the binary property list codecs from src/artifacts/apple/ into src/domain/apple/. These are MachoLoadCommandReader, MachoEncryptionReader, PlistScalars, BinaryPlistLayout, PropertyListDecodeBudget and BinaryPlistMaterializer. The domain already holds the Mach-O and plist format declarations that these files implement. Native, Kuna and Electron then read Mach-O and binary plists without importing the artifacts provider.

This is a pure move: git mv, specifier rewrites, and renamed per-guard baseline keys. Part of plan W9. Refs #11359.

Problem and expected behavior

  • native -> artifacts was the second-largest cross-provider pair (11 imports). Seven of those imports were these readers.
  • Kuna and Electron imported MachoLoadCommandReader from artifacts too.
  • Application imported PropertyListDecodeBudget and BinaryPlistMaterializer from the artifacts provider.
  • The readers do no I/O. MachoLoadCommandReader takes an injected ReadAt. Their production imports are only src/domain modules, the plist package and each other.

Expected: the format readers live with the format declarations they implement, and each provider that reads Mach-O or binary plists depends on the domain, not on another provider.

Owner choice: this PR picks src/domain/apple/ and not src/resources/, because src/resources is the I/O toolkit (stable reads, scopes, leases) and these readers do no I/O. src/domain/apple/ already holds similar pure decoders (keyedArchive, interfaceBuilderKeyedArchive, appleAssetCatalog), and #11331 makes the same call for BinaryContainer and the devicetree parser.

Change and scope

  • 6 production files and 3 unit tests: git mv to camelCase names in src/domain/apple/. The tests are plistScalars, binaryPlistMaterializer and propertyListDecodeBudget's own unit tests where they import only domain code.
  • 3 tests stay in src/artifacts/apple/, because they exercise artifact readers and the Mach-O image fixture, which the pure-layer rule does not allow from src/domain:
    • MachoLoadCommandReader.test.ts
    • MachoEncryptionReader.test.ts
    • PropertyListDecodeBudget.test.ts
  • Import specifiers are rewritten in 26 importers. The vi.mock paths in two invariant tests are reformatted by oxfmt because the longer path wraps.
  • scripts/verify/baselines/raw-buffer-read.json: 4 keys renamed. Counts are unchanged.
  • tests/boundary/filesystem/appleXmlDeclarations.test.ts: the built dist/ path follows the move.

Not included:

  • The other native -> artifacts imports: withArtifactTargetIdentity (2) and hashStableRootArtifact (1). They do I/O and belong with the stable-read toolkit in src/resources (next slice).
  • The artifacts -> native lipo edges.
  • MachoImage.fixture.ts, which stays in artifacts.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Mach-O load command, encryption and binary plist decoding. The owner moves from src/artifacts/apple/ to src/domain/apple/, and the code is unchanged.
  • Contribution scope fit and linked maintainer decision: maintainer-approved W9 burn-down ([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.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none. The built path of propertyListDecodeBudget.js changes; only one test loads it by path.

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

Validation performed

  • npm run check:fast: passed (typecheck, lint with module boundaries, architecture guards). The pre-push hook also passed.
  • npm run test:focused -- <the 16 moved or rewritten test files>: 392 passed.
  • npm run verify:test-discovery: all 3678 test files discovered exactly once.
  • node scripts/verify-module-boundaries.mjs: passed. It reports two lowerable entries that already exist on main (process -> artifacts and application <-> dotnet), which this PR does not cause.

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.

The move commit will be listed 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-15T19:34:30.931445Z
We couldn’t complete this review. Comment @codex review to try again.
b809c25 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: apex

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

Summary

Moves six Mach-O and plist readers into src/domain/apple so consumers share format code without importing the artifacts provider.

  • Mach-O readers now live in the shared Apple domain layer.
  • Binary plist readers now live in the shared Apple domain layer.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Application["Application"] --> Plist["Domain: plist readers"]
  Artifacts["Artifacts provider"] --> Plist
  Artifacts --> MachO["Domain: Mach-O readers"]
  Native["Native provider"] --> Plist
  Native --> MachO
  Electron["Electron provider"] --> MachO
  Kuna["Kuna provider"] --> MachO
  Plist --> Formats["Domain format declarations"]
  MachO --> Formats
Loading

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

# Conflicts:
#	src/native/hardening/MachoHardening.ts
…readers-domain

# Conflicts:
#	src/artifacts/ReleaseExposureReader.ts
#	src/native/NativeMacOSProvider.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant