[PR #4890] fix(artifacts): report the architecture of executable members #6457

Open
opened 2026-10-31 01:14:36 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4890
Author: @robotaro
Created: 10/17/2026
Status: 🔄 Open

Base: main ← Head: fix/artifact-member-architecture


📝 Commits (1)

  • 1bb4616 fix(artifacts): report the architecture of executable members

📊 Changes

3 files changed (+82 additions, -8 deletions)

View changed files

📝 src/artifacts/inventory/ArtifactGraphConstruction.ts (+28 -5)
📝 src/artifacts/inventory/scanReader.ts (+2 -2)
📝 tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts (+52 -1)

📄 Description

Summary

inventory_artifact and inspect_artifact always reported architecture: null on artifact graph nodes, so a ZIP of x86-64 Linux shared libraries showed no architecture for any ELF member. Nodes now report the single architecture their ELF, thin Mach-O, PE or DOS MZ header declares.

Problem and expected behavior

Trigger: inventory a ZIP containing x86-64 ELF .so members. Every ELF node has format: "elf" and architecture: null, although the header (e_machine = 0x3e) declares x86-64. createArtifactNode hard-coded architecture: null.

Expected: a member whose header declares one architecture reports it; universal Mach-O containers (several architectures), non-executable members and malformed headers stay null.

Change and scope

classifiedArtifactBytes classifies a member's format and, for elf, mach-o, pe and dos-mz, reads its architecture with the existing parseExecutableHeader. It is used for embedded members and the root node. The host-architecture argument only selects a universal Mach-O slice, which is excluded. Not included: per-slice architectures inside universal containers.

Contract and boundary impact

  • Semantic owner and earliest changed stage: artifact inventory node classification (src/artifacts/inventory).
  • Contribution scope fit and linked maintainer decision: format inspection; not applicable.
  • CLI and MCP/tool-catalog contract: no schema change; architecture was already string | null and is now populated.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: node content and graph_sha256 change for archives with executable members; artifact_id (content digest) is unchanged. compare_artifacts now sees architecture differences.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • 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

  • Tests added or updated: tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts ("records the architecture each member's executable header declares": x86-64 and AArch64 ELF members, a non-ELF .so, and the ZIP root).
  • Base reproduction or other evidence: on origin/main the new test fails with expected null to be 'x86_64'.
  • User-visible CLI/MCP output: rea inspect-artifact on a third-party Linux plugin ZIP (9 members) now reports {"format":"elf","architecture":"x86_64"} for all 7 ELF members, null for the 2 non-executable files and the ZIP root.
  • Remaining proof gaps: PE and Mach-O members are covered by the shared header parser's existing tests, not by a new archive test.

For evidence-bearing changes:

  • 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 test:focused -- tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts — 2 passed (fails on origin/main without the source change).
  • npm run test:focused -- <87 artifact-related test files> — 87 files, 1186 passed, 1 skipped.
  • npm run check:changed — passed.
  • rea inspect-artifact <third-party Linux plugin ZIP> --format json — 7 ELF members report x86_64.
  • Rebased onto origin/main 23f984b1a without conflicts, then re-ran npm run check:changed (54 passed), npm run docs:check and the rea inspect-artifact run above (7 ELF members report x86_64; all null on origin/main) — all passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; a previously null field is populated.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable (no provider involved). Linux x64 host.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: reads the same classification prefix already read for format detection.

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.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4890 **Author:** [@robotaro](https://github.com/robotaro) **Created:** 10/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/artifact-member-architecture` --- ### 📝 Commits (1) - [`1bb4616`](https://github.com/morluto/rea/commit/1bb4616e941fef871c925b451e92fb285378ed79) fix(artifacts): report the architecture of executable members ### 📊 Changes **3 files changed** (+82 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/inventory/ArtifactGraphConstruction.ts` (+28 -5) 📝 `src/artifacts/inventory/scanReader.ts` (+2 -2) 📝 `tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts` (+52 -1) </details> ### 📄 Description ## Summary `inventory_artifact` and `inspect_artifact` always reported `architecture: null` on artifact graph nodes, so a ZIP of x86-64 Linux shared libraries showed no architecture for any ELF member. Nodes now report the single architecture their ELF, thin Mach-O, PE or DOS MZ header declares. ## Problem and expected behavior Trigger: inventory a ZIP containing x86-64 ELF `.so` members. Every ELF node has `format: "elf"` and `architecture: null`, although the header (`e_machine = 0x3e`) declares x86-64. `createArtifactNode` hard-coded `architecture: null`. Expected: a member whose header declares one architecture reports it; universal Mach-O containers (several architectures), non-executable members and malformed headers stay `null`. ## Change and scope `classifiedArtifactBytes` classifies a member's format and, for `elf`, `mach-o`, `pe` and `dos-mz`, reads its architecture with the existing `parseExecutableHeader`. It is used for embedded members and the root node. The host-architecture argument only selects a universal Mach-O slice, which is excluded. Not included: per-slice architectures inside universal containers. ## Contract and boundary impact - Semantic owner and earliest changed stage: artifact inventory node classification (`src/artifacts/inventory`). - Contribution scope fit and linked maintainer decision: format inspection; not applicable. - CLI and MCP/tool-catalog contract: no schema change; `architecture` was already `string | null` and is now populated. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: node content and `graph_sha256` change for archives with executable members; `artifact_id` (content digest) is unchanged. `compare_artifacts` now sees architecture differences. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. Expected effects: - [x] 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: `tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts` ("records the architecture each member's executable header declares": x86-64 and AArch64 ELF members, a non-ELF `.so`, and the ZIP root). - Base reproduction or other evidence: on origin/main the new test fails with `expected null to be 'x86_64'`. - User-visible CLI/MCP output: `rea inspect-artifact` on a third-party Linux plugin ZIP (9 members) now reports `{"format":"elf","architecture":"x86_64"}` for all 7 ELF members, `null` for the 2 non-executable files and the ZIP root. - Remaining proof gaps: PE and Mach-O members are covered by the shared header parser's existing tests, not by a new archive test. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts` — 2 passed (fails on origin/main without the source change). - `npm run test:focused -- <87 artifact-related test files>` — 87 files, 1186 passed, 1 skipped. - `npm run check:changed` — passed. - `rea inspect-artifact <third-party Linux plugin ZIP> --format json` — 7 ELF members report `x86_64`. - Rebased onto origin/main `23f984b1a` without conflicts, then re-ran `npm run check:changed` (54 passed), `npm run docs:check` and the `rea inspect-artifact` run above (7 ELF members report `x86_64`; all `null` on origin/main) — all passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none; a previously null field is populated. - Real Hopper/Ghidra, browser, or OS coverage: not applicable (no provider involved). Linux x64 host. - Package or release metadata impact: none. - Security, privacy, process, or containment review: reads the same classification prefix already read for format detection. ## Author readiness Human owner: <!-- @GitHub-handle --> - [ ] 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6457
No description provided.