Skip to content

fix(apple): match Swift runtime libraries by file name - #9796

Draft
liugedragon wants to merge 1 commit into
morluto:mainfrom
liugedragon:fix/swift-runtime-library-leaf
Draft

liugedragon wants to merge 1 commit into
morluto:mainfrom
liugedragon:fix/swift-runtime-library-leaf

Conversation

@liugedragon

Copy link
Copy Markdown

Summary

Apple application projections infer swift-objective-c from an ordinary resource below a directory named libswiftCore.dylib:

Payload/Fixture.app/Resources/libswiftCore.dylib/readme.txt

The shared Swift predicate examined every path segment. It now examines the file name, preserving the existing case-insensitive matching for actual libswift*.dylib entries, including SwiftSupport entries.

No dedicated issue is linked: the false positive was reproduced while inspecting the existing convention owner. Related #1506 and #7256 concern bounded runtime conventions; this fixes the remaining Swift-specific ancestor match.

Problem and expected behavior

An IPA containing Info.plist and the resource above reports runtime_families: ["swift-objective-c"]. After this change it reports []. A leaf named libswiftCore.dylib still reports the Swift convention. These are path-based inferences; they do not establish runtime loading.

Change and scope

Change isSwiftRuntimeLibrary in src/domain/nativeConvention.ts, its only consumer being Apple runtime-family projection. Keep other runtime/framework conventions unchanged. Four regressions create real ZIP files, inventory them through the production artifact reader, and project the resulting Evidence. They cover two directory-name false positives and two valid library leaves, including mixed case and SwiftSupport.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the shared Swift file-name predicate, consumed by identifyRuntimeFamilies in Apple projection. No additional representation or parsing path.
  • Contribution scope fit and linked maintainer decision: routine correction within existing static inventory projection; a separate scope decision is not applicable.
  • CLI and MCP/tool-catalog contract: schemas unchanged; affected projections stop including the unsupported Swift family.
  • Provider, bridge, target-format, or platform compatibility: no provider or format-admission changes.
  • Evidence, artifact, provenance, or reconstruction contract: source inventory identities and provenance remain unchanged; the corrected inference affects the derived projection.
  • Target selection, authority, upstream behavior and cleanup: existing caller-selected ZIP reads and fixture cleanup; no added target execution, instrumentation, mutation or network activity.
  • Generated metadata, package or installation impact: none.

Expected effects:

  • 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

On base 55b6d2ca200649d433480f0aa45d8ac202436cae, the four retained ZIP cases give 2 assertion failures and 2 passing controls. After the predicate correction, all four pass. The tests also check that inventory coverage stays complete.

The earlier runtime-convention fix was checked for sibling behavior: non-Swift runtime matching already restricts library names to the leaf while allowing framework ancestors. This change applies the same file distinction to Swift.

Validation performed

Windows x64, Node 24.22.1, npm 11.16.0, locked dependencies. Optional provider installation scripts were not run; repository preparation ran separately.

  • node node_modules/vitest/vitest.mjs run tests/boundary/filesystem/appleApplication.test.ts -t "classifies the Swift library leaf" — final four cases passed.
  • npm run check:fast — normal pre-push hook passed both typecheck and lint tasks, with zero cache hits.
  • node scripts/run-typescript.mjs --noEmit — passed.
  • npm run lint — passed: 6,958 files, zero errors, 3,625 warnings; resolved module boundaries checked in 4,069 source files.
  • node scripts/verify-test-discovery.mjs — all 3,336 test files discovered exactly once.
  • Touched-file oxfmt --check and git diff --check — passed.
  • A broader preliminary run of both Apple test files gave 71 passed, one failed. That run included four redundant domain cases subsequently removed from this PR. The failure was the existing macOS directory-fixture test: Windows refused creation of Core.framework/Versions/Current with EPERM. The same original test failed identically in a clean detached worktree of the base revision. No privilege or test-expectation change was made.

Compatibility, safety, and release

No migration or package change. This is source-level production inventory/projection coverage on synthetic ZIPs; a packaged CLI/MCP workflow, macOS host and real Swift application were not exercised. No runtime-loading claim is made. The existing Windows symlink test remains unverified on a host with symlink permission.

Author readiness

Human owner: @liugedragon

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant