[PR #6942] fix(artifacts): retain completed Rust, BEAM, and pyc facts through finalization #7463

Open
opened 2026-11-01 21:48:01 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6942
Author: @rudycelekli
Created: 10/24/2026
Status: 🔄 Open

Base: main ← Head: fix/retain-completed-artifact-facts-siblings


📝 Commits (1)

  • 41bb5d6 fix(artifacts): retain completed Rust, BEAM, and pyc facts through finalization

📊 Changes

9 files changed (+307 additions, -3 deletions)

View changed files

📝 docs/erlang-beam.md (+6 -0)
📝 docs/python-pyc.md (+6 -0)
📝 docs/rust-binaries.md (+6 -0)
📝 src/erlang/BeamProvider.ts (+18 -1)
📝 src/python/PythonPycProvider.ts (+18 -1)
📝 src/rust/RustBinaryProvider.ts (+18 -1)
➕ tests/boundary/erlang/beamFinalization.test.ts (+78 -0)
➕ tests/boundary/python/pythonPycFinalization.test.ts (+78 -0)
➕ tests/boundary/rust/rustBinaryFinalization.test.ts (+79 -0)

📄 Description

Current upstream status (2026-10-27)

This draft is superseded by upstream’s shared completed-artifact projection in src/artifacts/StableArtifactFailure.ts, used by the Rust, BEAM and Python providers. Reintroducing its former inline handling would duplicate the current owner.

Verification on isolated upstream integration: the original 12 finalization scenarios plus 11 current cleanup scenarios pass (23 total). This proves the original requested behavior is already covered on the tested upstream revision; it does not validate this stale conflicted PR head. No replacement code was pushed. Recommend closing as superseded after the human owner reviews this disposition; leaving draft status unchanged.

The historical description and its validation scope follow below.


Summary

inspect_rust_binary, inspect_erlang_beam, and inspect_python_pyc drop the
completed artifact facts (selected path, SHA-256, byte length) when a stable
read finishes but descriptor finalization then fails or is cancelled. The
returned error has no partial_observation, although the read completed.

3f519c55 ("fix(go): retain completed artifact facts through finalization",
#6093) fixed this for GoBinaryProvider; the GPU and model providers already
retain the same facts. The Rust, BEAM, and pyc providers share the same
single-read acquisition and failureFor shape but were not updated. This PR
applies the Go provider's retention, as it exists on current main after
4610843e, to those three boundaries.

Problem and expected behavior

Smallest trigger: inspect a valid input of each format where the owned
descriptor's close() rejects (EIO), or where the caller's signal aborts
during close.

  • Before: the error is built from artifactFilePrimaryFacts(cause) only;
    error.partialObservation is undefined and the projected error has no
    details.partial_observation.
  • After: the error retains { kind: "file-snapshot-hash", path, sha256, bytes }
    for the completed read. It does not claim the format was decoded; failed
    cleanup stays cleanupIncomplete; cancellation keeps the caller's reason.

Change and scope

  • src/rust/RustBinaryProvider.ts, src/erlang/BeamProvider.ts,
    src/python/PythonPycProvider.ts: after mapping the primary failure, read
    completedStableArtifact(cause) and retain its facts through
    fileSnapshotPartialObservationSchema, identical to GoBinaryProvider.
  • docs/rust-binaries.md, docs/erlang-beam.md, docs/python-pyc.md: the same
    finalization paragraph docs/go-binaries.md gained.
  • Not included: WABT and EVM. Each performs several stable reads and already
    builds its own partial evidence, so the single-read retention does not apply
    directly.

Contribution scope: ordinary fix within an existing boundary; a maintainer
scope decision is not applicable. Related to #6093 (Go-only).

Contract and boundary impact

  • Semantic owner and earliest changed stage: each provider's error mapping (failureFor / beamFailure).
  • Contribution scope fit and linked maintainer decision: existing boundary; not applicable.
  • CLI and MCP/tool-catalog contract: no schema change; finalization failures now include the existing partial_observation detail.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: the completed read identity is preserved as a file-snapshot-hash partial observation.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): cleanup ownership and incomplete-cleanup projection are 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 added: tests/boundary/rust/rustBinaryFinalization.test.ts,
    tests/boundary/erlang/beamFinalization.test.ts,
    tests/boundary/python/pythonPycFinalization.test.ts. Each mirrors
    tests/boundary/go/goBinaryFinalization.test.ts across four modes (control,
    close failure, close plus cancel, both) and asserts the retained
    partialObservation and its projection, cleanupIncomplete state and
    descriptor release, and the preserved cancellation reason.
  • Base reproduction: with only the three test files on main at 9c8f4044,
    npx vitest run on them reported 9 failures (control passes; the other three
    modes fail per provider) with
    AssertionError: expected undefined to deeply equal { kind: 'file-snapshot-hash', …(3) }.
  • User-visible CLI/MCP output (if applicable): finalization failures now carry
    details.partial_observation; no CLI capture was taken.
  • Remaining proof gaps: finalization faults are injected by spying on
    OwnedFileHandle.prototype.close; no real-filesystem close failure was produced.

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

  • npx vitest run tests/boundary/rust/rustBinaryFinalization.test.ts tests/boundary/erlang/beamFinalization.test.ts tests/boundary/python/pythonPycFinalization.test.ts on 9c8f4044 without the fix — 9 failed, 3 passed.
  • npx vitest run tests/boundary/rust/ tests/boundary/erlang/ tests/boundary/python/ src/rust src/erlang src/python with the fix — 9 files, 154 tests passed.
  • npm run check:fast — typecheck and lint passed.
  • npm run verify:test-discovery — "Discovered all 2315 test files exactly once."
  • npm run docs:check — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; ran on macOS with Node 24.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new reads, processes, or network access; only already-computed snapshot facts are attached to the error.

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.

🔄 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/6942 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/retain-completed-artifact-facts-siblings` --- ### 📝 Commits (1) - [`41bb5d6`](https://github.com/morluto/rea/commit/41bb5d662b2cf73c7568cbf8f493b6670d0e0d33) fix(artifacts): retain completed Rust, BEAM, and pyc facts through finalization ### 📊 Changes **9 files changed** (+307 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/erlang-beam.md` (+6 -0) 📝 `docs/python-pyc.md` (+6 -0) 📝 `docs/rust-binaries.md` (+6 -0) 📝 `src/erlang/BeamProvider.ts` (+18 -1) 📝 `src/python/PythonPycProvider.ts` (+18 -1) 📝 `src/rust/RustBinaryProvider.ts` (+18 -1) ➕ `tests/boundary/erlang/beamFinalization.test.ts` (+78 -0) ➕ `tests/boundary/python/pythonPycFinalization.test.ts` (+78 -0) ➕ `tests/boundary/rust/rustBinaryFinalization.test.ts` (+79 -0) </details> ### 📄 Description ## Current upstream status (2026-10-27) This draft is superseded by upstream’s shared completed-artifact projection in `src/artifacts/StableArtifactFailure.ts`, used by the Rust, BEAM and Python providers. Reintroducing its former inline handling would duplicate the current owner. Verification on isolated upstream integration: the original 12 finalization scenarios plus 11 current cleanup scenarios pass (23 total). This proves the original requested behavior is already covered on the tested upstream revision; it does not validate this stale conflicted PR head. No replacement code was pushed. Recommend closing as superseded after the human owner reviews this disposition; leaving draft status unchanged. The historical description and its validation scope follow below. --- ## Summary `inspect_rust_binary`, `inspect_erlang_beam`, and `inspect_python_pyc` drop the completed artifact facts (selected path, SHA-256, byte length) when a stable read finishes but descriptor finalization then fails or is cancelled. The returned error has no `partial_observation`, although the read completed. 3f519c55 ("fix(go): retain completed artifact facts through finalization", #6093) fixed this for `GoBinaryProvider`; the GPU and model providers already retain the same facts. The Rust, BEAM, and pyc providers share the same single-read acquisition and `failureFor` shape but were not updated. This PR applies the Go provider's retention, as it exists on current `main` after 4610843e, to those three boundaries. ## Problem and expected behavior Smallest trigger: inspect a valid input of each format where the owned descriptor's `close()` rejects (`EIO`), or where the caller's signal aborts during close. - **Before:** the error is built from `artifactFilePrimaryFacts(cause)` only; `error.partialObservation` is `undefined` and the projected error has no `details.partial_observation`. - **After:** the error retains `{ kind: "file-snapshot-hash", path, sha256, bytes }` for the completed read. It does not claim the format was decoded; failed cleanup stays `cleanupIncomplete`; cancellation keeps the caller's reason. ## Change and scope - `src/rust/RustBinaryProvider.ts`, `src/erlang/BeamProvider.ts`, `src/python/PythonPycProvider.ts`: after mapping the primary failure, read `completedStableArtifact(cause)` and retain its facts through `fileSnapshotPartialObservationSchema`, identical to `GoBinaryProvider`. - `docs/rust-binaries.md`, `docs/erlang-beam.md`, `docs/python-pyc.md`: the same finalization paragraph `docs/go-binaries.md` gained. - Not included: WABT and EVM. Each performs several stable reads and already builds its own partial evidence, so the single-read retention does not apply directly. Contribution scope: ordinary fix within an existing boundary; a maintainer scope decision is not applicable. Related to #6093 (Go-only). ## Contract and boundary impact - Semantic owner and earliest changed stage: each provider's error mapping (`failureFor` / `beamFailure`). - Contribution scope fit and linked maintainer decision: existing boundary; not applicable. - CLI and MCP/tool-catalog contract: no schema change; finalization failures now include the existing `partial_observation` detail. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: the completed read identity is preserved as a `file-snapshot-hash` partial observation. - Target selection, authority, upstream behavior, and cleanup details (if applicable): cleanup ownership and incomplete-cleanup projection are 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 added: `tests/boundary/rust/rustBinaryFinalization.test.ts`, `tests/boundary/erlang/beamFinalization.test.ts`, `tests/boundary/python/pythonPycFinalization.test.ts`. Each mirrors `tests/boundary/go/goBinaryFinalization.test.ts` across four modes (control, close failure, close plus cancel, both) and asserts the retained `partialObservation` and its projection, `cleanupIncomplete` state and descriptor release, and the preserved cancellation reason. - Base reproduction: with only the three test files on `main` at `9c8f4044`, `npx vitest run` on them reported 9 failures (control passes; the other three modes fail per provider) with `AssertionError: expected undefined to deeply equal { kind: 'file-snapshot-hash', …(3) }`. - User-visible CLI/MCP output (if applicable): finalization failures now carry `details.partial_observation`; no CLI capture was taken. - Remaining proof gaps: finalization faults are injected by spying on `OwnedFileHandle.prototype.close`; no real-filesystem close failure was produced. 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 - `npx vitest run tests/boundary/rust/rustBinaryFinalization.test.ts tests/boundary/erlang/beamFinalization.test.ts tests/boundary/python/pythonPycFinalization.test.ts` on `9c8f4044` without the fix — 9 failed, 3 passed. - `npx vitest run tests/boundary/rust/ tests/boundary/erlang/ tests/boundary/python/ src/rust src/erlang src/python` with the fix — 9 files, 154 tests passed. - `npm run check:fast` — typecheck and lint passed. - `npm run verify:test-discovery` — "Discovered all 2315 test files exactly once." - `npm run docs:check` — passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; ran on macOS with Node 24. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new reads, processes, or network access; only already-computed snapshot facts are attached to the error. ## Author readiness <!-- The human owner completes these declarations before requesting review. The PR author is the owner by default. A different owner must explicitly accept ownership on this PR. AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA. Draft PRs may leave them unchecked. These declarations record initial readiness when opening the PR for review; later pushes do not require a new human sign-off. Keep the description and validation evidence current as the work changes. See CONTRIBUTING.md#pull-request-ownership-and-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 <!-- Draft PRs may leave pending items unchecked. Resolve material scope and authority questions before integration. --> - [ ] 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. --- <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#7463
No description provided.