[PR #5495] [CLOSED] fix(artifacts): distinguish non-directory output paths from identity changes #6938

Closed
opened 2026-11-01 21:44:11 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5495
Author: @x1mm4nu3l
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/output-directory-admission


📝 Commits (1)

  • 66a42c9 fix(artifacts): distinguish non-directory output paths from identity changes

📊 Changes

3 files changed (+45 additions, -1 deletions)

View changed files

📝 src/artifacts/SafeOutputTreeIdentity.ts (+5 -1)
📝 tests/boundary/cli/environmentExportCli.test.ts (+37 -0)
📝 tests/boundary/filesystem/safeOutputTree.test.ts (+3 -0)

📄 Description

Summary

Fixes #5457. An existing file at the bundle destination gets blamed on a directory identity change.

Problem and expected behavior

With the valid manifest/capture pair from #5457:

printf 'keep\n' > existing-file
rea environment-export manifest.json existing-file --evidence capture.json --json

Before: Extraction directory identity changed. After: Output path is not a directory. Both exit 1 and leave the file untouched.

Change and scope

Correct the initial directory admission message. Actual replacement checks keep their existing message. Routine fix; advance scope approval is not applicable.

Contract and boundary impact

  • Owner: readDirectoryIdentity, before identity capture.
  • Contribution scope: existing output validation; no new authority.
  • CLI/MCP: error text only; code and issue path stay unchanged.
  • Providers, formats and platform policy: unchanged.
  • Evidence and provenance: unchanged.
  • Target selection and cleanup: unchanged.
  • Generated metadata, packaging and installation: unchanged.

Expected effects in the existing export workflow:

  • Read existing files or captured data.
  • Write bundle files through the existing export workflow.

Evidence and regression coverage

  • CLI regression checks both messages, exit 1, contents and inode preservation. It fails on current upstream and passes with the fix.

  • Existing root-replacement regression checks the original replacement diagnostic.

  • Manual CLI controls: occupied file and non-empty directory refused; fresh directory exported seven files.

  • Gaps: Windows/macOS and the full suite were not run. An earlier combined run had four transient mock-related failures; isolated and later combined runs passed, cause unconfirmed.

  • 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

Linux, Node 24.18.0, npm 11.16.0:

  • npm run test:focused on six export/output-tree files: 51 passed.
  • npm run check: passed.
  • npm run verify:test-discovery: 1798 files discovered exactly once.
  • git diff --check: passed.

Compatibility, safety, and release

No migration or package changes. Linux filesystem and public CLI verified; no external provider needed. Permissions, ownership and cleanup behavior stay unchanged.

Author readiness

Human owner: @x1mm4nu3l

  • 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/5495 **Author:** [@x1mm4nu3l](https://github.com/x1mm4nu3l) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/output-directory-admission` --- ### 📝 Commits (1) - [`66a42c9`](https://github.com/morluto/rea/commit/66a42c967fb4a1e36041594303bd1e6c73bd8d21) fix(artifacts): distinguish non-directory output paths from identity changes ### 📊 Changes **3 files changed** (+45 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/SafeOutputTreeIdentity.ts` (+5 -1) 📝 `tests/boundary/cli/environmentExportCli.test.ts` (+37 -0) 📝 `tests/boundary/filesystem/safeOutputTree.test.ts` (+3 -0) </details> ### 📄 Description ## Summary Fixes #5457. An existing file at the bundle destination gets blamed on a directory identity change. ## Problem and expected behavior With the valid manifest/capture pair from #5457: ```sh printf 'keep\n' > existing-file rea environment-export manifest.json existing-file --evidence capture.json --json ``` Before: `Extraction directory identity changed`. After: `Output path is not a directory`. Both exit 1 and leave the file untouched. ## Change and scope Correct the initial directory admission message. Actual replacement checks keep their existing message. Routine fix; advance scope approval is not applicable. ## Contract and boundary impact - Owner: `readDirectoryIdentity`, before identity capture. - Contribution scope: existing output validation; no new authority. - CLI/MCP: error text only; code and issue path stay unchanged. - Providers, formats and platform policy: unchanged. - Evidence and provenance: unchanged. - Target selection and cleanup: unchanged. - Generated metadata, packaging and installation: unchanged. Expected effects in the existing export workflow: - [x] Read existing files or captured data. - [x] Write bundle files through the existing export workflow. ## Evidence and regression coverage - CLI regression checks both messages, exit 1, contents and inode preservation. It fails on current upstream and passes with the fix. - Existing root-replacement regression checks the original replacement diagnostic. - Manual CLI controls: occupied file and non-empty directory refused; fresh directory exported seven files. - Gaps: Windows/macOS and the full suite were not run. An earlier combined run had four transient mock-related failures; isolated and later combined runs passed, cause unconfirmed. - [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 Linux, Node 24.18.0, npm 11.16.0: - `npm run test:focused` on six export/output-tree files: 51 passed. - `npm run check`: passed. - `npm run verify:test-discovery`: 1798 files discovered exactly once. - `git diff --check`: passed. ## Compatibility, safety, and release No migration or package changes. Linux filesystem and public CLI verified; no external provider needed. Permissions, ownership and cleanup behavior stay unchanged. ## Author readiness Human owner: @x1mm4nu3l - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] 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>
bsakaguchi 2026-11-01 21:44:11 +00:00
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#6938
No description provided.