[PR #7287] fix(process): tolerate missing observer roots #7808

Open
opened 2026-11-05 01:47:49 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7287
Author: @ducanhnguyen223
Created: 10/26/2026
Status: 🔄 Open

Base: main ← Head: codex/fix-7281-observer-scratch


📝 Commits (3)

  • 8c4b723 fix(process): tolerate missing observer roots
  • e2b665c test(process): cover observer path resolution errors
  • 6ad7550 test(process): skip POSIX observer errors on Windows

📊 Changes

2 files changed (+129 additions, -1 deletions)

View changed files

📝 src/process/capture/FilesystemCoverage.test.ts (+117 -0)
📝 src/process/capture/FilesystemSnapshot.ts (+12 -1)

📄 Description

Fixes #7281

Summary

Treat a disappeared observer scratch path as absent so capture-process can still collect the caller-selected filesystem snapshot.

Problem and expected behavior

snapshotRoots canonicalizes its internal observer paths before visiting selected roots. If the observer directory is already gone, realpath() rejects with ENOENT (or ENOTDIR) and prevents unrelated selected roots, including an empty selection, from being snapshotted.

Change and scope

Skip only observer paths whose resolution proves absence (ENOENT or ENOTDIR). Continue to exclude a present observer directory as before, and propagate permission and other unexpected errors. No lifecycle ownership, target authority, CLI/MCP schema, provider, or package behavior is changed.

Ordinary filesystem-snapshot bug fix within the existing process-capture scope; no maintainer scope decision is required.

Contract and boundary impact

  • Semantic owner and earliest changed stage: snapshotRoots, at observer-path canonicalization before selected-root traversal; callers are the existing process-capture admission and final-snapshot paths.
  • Contribution scope fit and linked maintainer decision: existing filesystem snapshot behavior; no new capability or side effect.
  • CLI and MCP/tool-catalog contract: no input/output schema changes; an absent internal observer path no longer aborts snapshot collection.
  • Provider, bridge, target-format, or platform compatibility: not applicable.
  • Evidence, artifact, provenance, or reconstruction contract: no Evidence schema changes; selected-root facts and existing coverage behavior are retained.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged; the patch does not select or execute a different target and does not change cleanup ownership.
  • 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: five snapshot regressions cover an observer nested in a selected root, outside selected roots, and an empty root selection; an observer path beneath a regular file (ENOTDIR); and propagation of an unexpected symlink-loop error (ELOOP). The ENOTDIR and symlink-loop fixtures are POSIX-only; Windows continues to use the existing missing-path (ENOENT) regressions. The selected-root cases verify retained paths and file state are unchanged and not truncated.
  • Base reproduction: before the fix, the three issue cases failed on main (0d1a454e25db825567782e461da21530bad4b158) at observer realpath() with ENOENT. The ENOTDIR and ELOOP cases additionally guard the intended error classification and propagation boundaries.
  • CLI/MCP output: no schema or formatted output changes. The existing process-filesystem adapter boundary suite passes through both CLI and MCP.
  • Remaining proof gaps: the new regression directly exercises snapshotRoots; it does not simulate an external actor removing the scratch path during a full live target run. The POSIX-only ENOTDIR and symlink-loop fixtures were not run on Windows; no Windows run was performed in this environment. Cleanup ownership behavior is unchanged.

Applicable boundary coverage: snapshot absence and retained selected-root facts, plus the existing CLI/MCP filesystem-coverage adapter suite. No provider or real reverse-engineering target is involved.

Validation performed

  • npm run test:local -- src/process/capture/FilesystemCoverage.test.ts — 26/26 passed; the three issue regression cases fail on the base revision and pass with this change.
  • npm run test:focused -- tests/boundary/process/processFilesystemCoverageAdapters.test.ts — 18/18 passed across CLI and MCP cases.
  • npm run check:fast — passed.
  • npm run format:check — passed.
  • git diff --check — passed.

Checks used the repository-pinned Node.js 24.22.1 runtime. No live provider or production target run was needed for this filesystem snapshot fix.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable to this change.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no authority or cleanup behavior changed; other observer-path errors still propagate.

Author readiness

Human owner: @ducanhnguyen223

  • 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/7287 **Author:** [@ducanhnguyen223](https://github.com/ducanhnguyen223) **Created:** 10/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/fix-7281-observer-scratch` --- ### 📝 Commits (3) - [`8c4b723`](https://github.com/morluto/rea/commit/8c4b723a3c0926344fd47ae37d3dd49cbb305690) fix(process): tolerate missing observer roots - [`e2b665c`](https://github.com/morluto/rea/commit/e2b665c626828917d6f6799c7be23cef32eed14a) test(process): cover observer path resolution errors - [`6ad7550`](https://github.com/morluto/rea/commit/6ad75502860a85733510e4196ae81951d22a72e8) test(process): skip POSIX observer errors on Windows ### 📊 Changes **2 files changed** (+129 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/process/capture/FilesystemCoverage.test.ts` (+117 -0) 📝 `src/process/capture/FilesystemSnapshot.ts` (+12 -1) </details> ### 📄 Description Fixes #7281 ## Summary Treat a disappeared observer scratch path as absent so `capture-process` can still collect the caller-selected filesystem snapshot. ## Problem and expected behavior `snapshotRoots` canonicalizes its internal observer paths before visiting selected roots. If the observer directory is already gone, `realpath()` rejects with `ENOENT` (or `ENOTDIR`) and prevents unrelated selected roots, including an empty selection, from being snapshotted. ## Change and scope Skip only observer paths whose resolution proves absence (`ENOENT` or `ENOTDIR`). Continue to exclude a present observer directory as before, and propagate permission and other unexpected errors. No lifecycle ownership, target authority, CLI/MCP schema, provider, or package behavior is changed. Ordinary filesystem-snapshot bug fix within the existing process-capture scope; no maintainer scope decision is required. ## Contract and boundary impact - Semantic owner and earliest changed stage: `snapshotRoots`, at observer-path canonicalization before selected-root traversal; callers are the existing process-capture admission and final-snapshot paths. - Contribution scope fit and linked maintainer decision: existing filesystem snapshot behavior; no new capability or side effect. - CLI and MCP/tool-catalog contract: no input/output schema changes; an absent internal observer path no longer aborts snapshot collection. - Provider, bridge, target-format, or platform compatibility: not applicable. - Evidence, artifact, provenance, or reconstruction contract: no Evidence schema changes; selected-root facts and existing coverage behavior are retained. - Target selection, authority, upstream behavior, and cleanup details: unchanged; the patch does not select or execute a different target and does not change cleanup ownership. - 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: five snapshot regressions cover an observer nested in a selected root, outside selected roots, and an empty root selection; an observer path beneath a regular file (`ENOTDIR`); and propagation of an unexpected symlink-loop error (`ELOOP`). The `ENOTDIR` and symlink-loop fixtures are POSIX-only; Windows continues to use the existing missing-path (`ENOENT`) regressions. The selected-root cases verify retained paths and file state are unchanged and not truncated. - Base reproduction: before the fix, the three issue cases failed on main (`0d1a454e25db825567782e461da21530bad4b158`) at observer `realpath()` with `ENOENT`. The `ENOTDIR` and `ELOOP` cases additionally guard the intended error classification and propagation boundaries. - CLI/MCP output: no schema or formatted output changes. The existing process-filesystem adapter boundary suite passes through both CLI and MCP. - Remaining proof gaps: the new regression directly exercises `snapshotRoots`; it does not simulate an external actor removing the scratch path during a full live target run. The POSIX-only `ENOTDIR` and symlink-loop fixtures were not run on Windows; no Windows run was performed in this environment. Cleanup ownership behavior is unchanged. Applicable boundary coverage: snapshot absence and retained selected-root facts, plus the existing CLI/MCP filesystem-coverage adapter suite. No provider or real reverse-engineering target is involved. ## Validation performed - `npm run test:local -- src/process/capture/FilesystemCoverage.test.ts` — 26/26 passed; the three issue regression cases fail on the base revision and pass with this change. - `npm run test:focused -- tests/boundary/process/processFilesystemCoverageAdapters.test.ts` — 18/18 passed across CLI and MCP cases. - `npm run check:fast` — passed. - `npm run format:check` — passed. - `git diff --check` — passed. Checks used the repository-pinned Node.js 24.22.1 runtime. No live provider or production target run was needed for this filesystem snapshot fix. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable to this change. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no authority or cleanup behavior changed; other observer-path errors still propagate. ## Author readiness Human owner: @ducanhnguyen223 - [ ] 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. --- <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#7808
No description provided.