[PR #7003] [MERGED] fix(process): preserve caller-selected working directory in scenario validation errors #7564

Closed
opened 2026-11-03 13:38:44 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7003
Author: @Humaam-04-06
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @morluto

Base: main ← Head: fix/windows-scenario-path-preservation


📝 Commits (2)

  • 342e292 fix(process): preserve caller-selected working directory in scenario validation errors
  • 6bf4674 test(process): cover caller-selected working-directory alias preservation

📊 Changes

2 files changed (+43 additions, -12 deletions)

View changed files

📝 src/process/capture/ProcessScenarioRuntimeValidation.test.ts (+41 -10)
📝 src/process/capture/ProcessScenarioRuntimeValidation.ts (+2 -2)

📄 Description

Summary

Fixes working directory error reporting in resolveProcessScenarioRuntimePaths to preserve caller-selected coordinates on Windows, and adds a platform guard to unprivileged symlink verification in process scenario tests.

Problem and expected behavior

  1. When working_directory validation fails (stat failure or not a directory), resolveProcessScenarioRuntimePaths interpolated workingDirectory (the normalized realpath) rather than selectedWorkingDirectory (the caller's resolved input). On Windows environments where temporary paths use 8.3 short names (e.g. SYSTEM~1 vs system angel), this caused validation errors to mismatch caller coordinates and broke unit test assertions.
  2. In ProcessScenarioRuntimeValidation.test.ts, the test "preserves the caller-selected executable symlink for process invocation" called await symlink(process.execPath, alias) without checking for platform privilege support, failing with EPERM on Windows without Developer Mode.

Expected behavior:
Validation errors preserve the caller's input coordinate (selectedWorkingDirectory), matching REA's coordinate provenance invariant. Symlink tests in ProcessScenarioRuntimeValidation.test.ts align with the repository's standard it.skipIf(process.platform === "win32") convention.

Change and scope

  • Updated src/process/capture/ProcessScenarioRuntimeValidation.ts lines 41 and 49 to format error messages with selectedWorkingDirectory.
  • Wrapped "preserves the caller-selected executable symlink for process invocation" in ProcessScenarioRuntimeValidation.test.ts with it.skipIf(process.platform === "win32").

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/process/capture/ProcessScenarioRuntimeValidation.ts input validation.
  • Contribution scope fit and linked maintainer decision: Standard bug fix and platform test alignment; no new authority or provider integration (not applicable).
  • CLI and MCP/tool-catalog contract: Unchanged.
  • Provider, bridge, target-format, or platform compatibility: Restores clean Windows test pass for process capture validation.
  • Evidence, artifact, provenance, or reconstruction contract: Preserves caller-selected path coordinates in error details.
  • Target selection, authority, upstream behavior, and cleanup details: Not applicable.
  • Generated metadata impact: None.

Expected effects:

  • Read existing files or captured data.

Evidence and regression coverage

  • Tests added or updated: src/process/capture/ProcessScenarioRuntimeValidation.test.ts
  • Base reproduction or other evidence:
    AssertionError: expected { code: 'invalid_request', details: { issues: [{ message: 'working directory is not a directory: ...\\SYSTEM~1\\...' }] } }
    to match object { code: 'invalid_request', details: { issues: [{ message: 'working directory is not a directory: ...\\system angel\\...' }] } }
    
  • Remaining proof gaps: None for touched paths.

Validation performed

  • npx vitest run src/process/capture/ProcessScenarioRuntimeValidation.test.ts — 3 passed, 6 skipped (clean pass).
  • npm run check:fast — turbo typecheck + oxlint passed across 1987 files with 0 errors.

Compatibility, safety, and release

  • Breaking changes or migration steps: None.
  • Real Hopper/Ghidra, browser, or OS coverage: Validated on Windows 11 (x64).
  • Package or release metadata impact: None.
  • Security, privacy, process, or containment review: Path interpolation only affects formatted error strings; underlying execution still uses resolved workingDirectory.

Author readiness

Human owner: @Humaam-04-06

  • 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.

🔄 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/7003 **Author:** [@Humaam-04-06](https://github.com/Humaam-04-06) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/windows-scenario-path-preservation` --- ### 📝 Commits (2) - [`342e292`](https://github.com/morluto/rea/commit/342e2929ed2948da7d6b0e705cd34871cae9b1b8) fix(process): preserve caller-selected working directory in scenario validation errors - [`6bf4674`](https://github.com/morluto/rea/commit/6bf467429d3c5ae4c3a88bd24251fcdf7660f125) test(process): cover caller-selected working-directory alias preservation ### 📊 Changes **2 files changed** (+43 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/process/capture/ProcessScenarioRuntimeValidation.test.ts` (+41 -10) 📝 `src/process/capture/ProcessScenarioRuntimeValidation.ts` (+2 -2) </details> ### 📄 Description ## Summary Fixes working directory error reporting in `resolveProcessScenarioRuntimePaths` to preserve caller-selected coordinates on Windows, and adds a platform guard to unprivileged symlink verification in process scenario tests. ## Problem and expected behavior 1. When `working_directory` validation fails (stat failure or not a directory), `resolveProcessScenarioRuntimePaths` interpolated `workingDirectory` (the normalized `realpath`) rather than `selectedWorkingDirectory` (the caller's resolved input). On Windows environments where temporary paths use 8.3 short names (e.g. `SYSTEM~1` vs `system angel`), this caused validation errors to mismatch caller coordinates and broke unit test assertions. 2. In `ProcessScenarioRuntimeValidation.test.ts`, the test `"preserves the caller-selected executable symlink for process invocation"` called `await symlink(process.execPath, alias)` without checking for platform privilege support, failing with `EPERM` on Windows without Developer Mode. Expected behavior: Validation errors preserve the caller's input coordinate (`selectedWorkingDirectory`), matching REA's coordinate provenance invariant. Symlink tests in `ProcessScenarioRuntimeValidation.test.ts` align with the repository's standard `it.skipIf(process.platform === "win32")` convention. ## Change and scope - Updated `src/process/capture/ProcessScenarioRuntimeValidation.ts` lines 41 and 49 to format error messages with `selectedWorkingDirectory`. - Wrapped `"preserves the caller-selected executable symlink for process invocation"` in `ProcessScenarioRuntimeValidation.test.ts` with `it.skipIf(process.platform === "win32")`. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/process/capture/ProcessScenarioRuntimeValidation.ts` input validation. - Contribution scope fit and linked maintainer decision: Standard bug fix and platform test alignment; no new authority or provider integration (not applicable). - CLI and MCP/tool-catalog contract: Unchanged. - Provider, bridge, target-format, or platform compatibility: Restores clean Windows test pass for process capture validation. - Evidence, artifact, provenance, or reconstruction contract: Preserves caller-selected path coordinates in error details. - Target selection, authority, upstream behavior, and cleanup details: Not applicable. - Generated metadata impact: None. Expected effects: - [x] Read existing files or captured data. ## Evidence and regression coverage - Tests added or updated: `src/process/capture/ProcessScenarioRuntimeValidation.test.ts` - Base reproduction or other evidence: ```text AssertionError: expected { code: 'invalid_request', details: { issues: [{ message: 'working directory is not a directory: ...\\SYSTEM~1\\...' }] } } to match object { code: 'invalid_request', details: { issues: [{ message: 'working directory is not a directory: ...\\system angel\\...' }] } } ``` - Remaining proof gaps: None for touched paths. ## Validation performed - `npx vitest run src/process/capture/ProcessScenarioRuntimeValidation.test.ts` — 3 passed, 6 skipped (clean pass). - `npm run check:fast` — turbo typecheck + oxlint passed across 1987 files with 0 errors. ## Compatibility, safety, and release - Breaking changes or migration steps: None. - Real Hopper/Ghidra, browser, or OS coverage: Validated on Windows 11 (x64). - Package or release metadata impact: None. - Security, privacy, process, or containment review: Path interpolation only affects formatted error strings; underlying execution still uses resolved `workingDirectory`. ## Author readiness Human owner: @Humaam-04-06 - [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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 13:38:44 +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#7564
No description provided.