Skip to content

refactor(domain): move the native section directory and ELF string readers into domain - #11449

Merged
morluto merged 2 commits into
mainfrom
refactor/native-section-directory-domain
Nov 15, 2026
Merged

morluto merged 2 commits into
mainfrom
refactor/native-section-directory-domain

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Moves the native section directory and the ELF string readers into src/domain/native/, using git mv and specifier rewrites:

  • src/native/metadata/NativeSectionDirectory.ts becomes nativeSectionDirectory.ts;
  • ElfSectionNameTable.ts becomes elfSectionNameTable.ts;
  • ElfStringTable.ts and its test become elfStringBytes.ts and elfStringBytes.test.ts.

All three are I/O-free format readers over admitted bytes. They depend only on domain modules and node:zlib, which decodes compressed ELF sections in memory.

The gpu provider imports them, so gpu -> native (5) leaves the crossProvider baseline.

Refs #11359. Part of plan W9.

Problem and expected behavior

gpu read ELF, PE and Mach-O section directories and ELF strings from the native provider's internals (native/metadata/*). Expected: format readers that do no I/O live with the other domain format readers (#11415, #11331), and providers import them inward.

Change and scope

  • Pure moves and renames, with 18 importers rewritten. The rename follows the domain naming convention, matching refactor(domain): move the Mach-O load command and binary plist readers into src/domain/apple #11415.
  • src/native/metadata/NativeSectionDirectory.test.ts stays in native. It builds inputs from native fixtures (BinaryHardening.fixture, ElfUnwindTables.fixture, ElfNotes.fixture), which a domain test cannot import. It now imports the reader from domain.
  • tests/support/analysis-efficiency/android-jni-library.mjs: the fingerprint list names the new path. Greptile found this; it is a computed path string, so the specifier rewrite did not see it.
  • Baselines:
    • crossProvider gpu -> native is removed.
    • The raw-buffer-read entry for ElfSectionNameTable (6) is re-keyed to the new path, with the same count.

Not included: the il2cpp, go and rust imports of readBinaryContainer, MachoSliceSelection, ElfPointerRelocations and AppleMacho*. Those form a larger set and get a separate PR.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the owners are unchanged in code, and their location moves from native to domain.
  • 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.
  • 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 --shrink-layer-baseline reported cross-provider import gpu -> native: 0, baseline 5.

  • 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. The pre-push hook passed.
  • node scripts/verify/architecture-guards.mjs: passed after the re-key.
  • npm run test:focused -- src/native/metadata/NativeSectionDirectory.test.ts src/domain/native/elfStringBytes.test.ts src/native/elf/ElfNoteParser.test.ts src/native/initializers/ElfInitializerRelocationCoverage.test.ts plus the first 8 src/gpu/*.test.ts files: 154 passed, 1 skipped.

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-15T20:18:00.255181Z
We couldn’t complete this review. Comment @codex review to try again.
33c2920 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] The reviewed changes appear safe to merge and are already present in local main history.

Summary

Moves the shared section and ELF string readers into src/domain/native/ without changing their parsing behavior.

  • ELF and PE readers now live in the domain layer.

No new actionable issues or security regressions found. The manual qualification script was not run because its external corpus was unavailable.

Reviews (3) · Last reviewed commit: "test(native): fingerprint the moved sect..." · Reviewed by Greptile

Comment thread src/native/android/AndroidJniLibrary.ts Resolved
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Greptile issue 1 (JNI qualification script) is valid and fixed in d704050. The root cause: tests/support/analysis-efficiency/android-jni-library.mjs fingerprints parser dependencies through computed relative path strings, which the specifier rewrite does not see. The entry now names ../../domain/native/nativeSectionDirectory, and src/domain/native/nativeSectionDirectory.ts exists at that path. A sweep of tests/support and scripts for computed paths to modules moved by W9 (#11415, #11445 and this PR) found no other references. I did not run the manual qualification script, because it needs the external JNI library corpus.

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