[PR #4733] [MERGED] test(paths): pin Windows separator normalization before native admission #6379

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4733
Author: @Iyanuoluwa007
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @morluto

Base: main ← Head: fix/windows-separator-regression


📝 Commits (1)

  • 75fd63d test(paths): pin Windows separator normalization before native admission

📊 Changes

2 files changed (+42 additions, -0 deletions)

View changed files

📝 tests/boundary/filesystem/callerPath.test.ts (+11 -0)
➕ tests/boundary/filesystem/windowsTargetSeparators.test.ts (+31 -0)

📄 Description

Summary

Fixes #4707. Adds regression coverage for Windows caller paths written with forward slashes or repeated separators. In rea-agents@6.5.0 those spellings reached Windows native snapshot admission verbatim and failed with Ambiguous Windows path component is unsupported (Win32 50). Current main already normalizes them; these tests keep it that way.

Problem and expected behavior

In 6.5.0, parseBinaryTarget used an absolute input unchanged (isAbsolute(input) ? input : resolve(cwd, input)), and on Windows that string became sourcePath, which GhidraProviderClient hands to native admission. The native walker (native/windows/src/filesystem.cc localPath) rejects empty components, so a path with repeated separators (the report's C://Users//... diagnostic) failed before analysis even though rea doctor was healthy.

On main, parseBinaryTarget resolves every caller path through absoluteCallerPath, which uses win32.resolve on Windows (fc791bb60, #4067). That collapses /, // and \ spellings into one drive path, so this is already fixed for the next release. Nothing pinned the behavior for absolute Windows paths: the existing Windows callerPath test covers relative .. resolution only.

Change and scope

Tests only:

  • tests/boundary/filesystem/callerPath.test.ts: absoluteCallerPath returns C:\Users\u\h.exe for the single-backslash, forward-slash, doubled-backslash and doubled-slash spellings (platform-injected, so it runs on every host).
  • tests/boundary/filesystem/windowsTargetSeparators.test.ts (Windows only): parseBinaryTarget on a real PE fixture returns the same canonical sourcePath for all four spellings of its path.

Not included: the issue's secondary request to stop recommending rea doctor for ERR_REA_WINDOWS_NATIVE admission failures. That touches remediation wording shared across providers and seemed better as its own change.

Contract and boundary impact

  • Semantic owner and earliest changed stage: none changed; tests pin caller-path normalization in absoluteCallerPath / parseBinaryTarget.

  • Contribution scope fit and linked maintainer decision: not applicable (tests only).

  • CLI and MCP/tool-catalog contract: none.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

Evidence and regression coverage

  • Executed on Windows 11 x64 (Node 24): calling parseBinaryTarget directly on a copy of hostname.exe returned the identical sourcePath (C:\Users\...\h1.exe) for the single-backslash, forward-slash, doubled-backslash and doubled-slash inputs.

  • With the 6.5.0 rule temporarily restored in BinaryTargetResolver.ts (absolute input used verbatim), the new Windows test fails: Expected: "C:\Users\...\image.exe", Received: "C:/Users/.../image.exe". With main's code it passes.

  • Remaining proof gaps: no Ghidra run. This host has no Ghidra or JDK, and this checkout lacks the packaged Windows native addon, so I did not run the reporter's rea analyze end to end or call the native walker. The link from a clean sourcePath to successful admission rests on the reporter's matrix (forward-slash paths succeed) and on reading localPath. UNC and \?\ inputs were not tested.

  • 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/filesystem/windowsTargetSeparators.test.ts tests/boundary/filesystem/callerPath.test.ts: the new tests pass. makes a relative POSIX cwd absolute before appending the path fails on this Windows host with and without this change (it expects a POSIX process.cwd()).
  • The same Windows test with the 6.5.0 resolver rule restored: fails as shown above.
  • npm run verify:test-discovery: all 1499 test files discovered exactly once.
  • npm run check:fast (typecheck, lint, also run by the pre-push hook): passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Windows 11 x64 filesystem only; no Ghidra.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: tests read a temporary fixture only.

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/4733 **Author:** [@Iyanuoluwa007](https://github.com/Iyanuoluwa007) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/windows-separator-regression` --- ### 📝 Commits (1) - [`75fd63d`](https://github.com/morluto/rea/commit/75fd63d0e4c94cb1466fd8b18435ac8f48f89454) test(paths): pin Windows separator normalization before native admission ### 📊 Changes **2 files changed** (+42 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/boundary/filesystem/callerPath.test.ts` (+11 -0) ➕ `tests/boundary/filesystem/windowsTargetSeparators.test.ts` (+31 -0) </details> ### 📄 Description ## Summary Fixes #4707. Adds regression coverage for Windows caller paths written with forward slashes or repeated separators. In `rea-agents@6.5.0` those spellings reached Windows native snapshot admission verbatim and failed with `Ambiguous Windows path component is unsupported` (Win32 50). Current main already normalizes them; these tests keep it that way. ## Problem and expected behavior In 6.5.0, `parseBinaryTarget` used an absolute input unchanged (`isAbsolute(input) ? input : resolve(cwd, input)`), and on Windows that string became `sourcePath`, which `GhidraProviderClient` hands to native admission. The native walker (`native/windows/src/filesystem.cc` `localPath`) rejects empty components, so a path with repeated separators (the report's `C://Users//...` diagnostic) failed before analysis even though `rea doctor` was healthy. On main, `parseBinaryTarget` resolves every caller path through `absoluteCallerPath`, which uses `win32.resolve` on Windows (fc791bb60, #4067). That collapses `/`, `//` and `\` spellings into one drive path, so this is already fixed for the next release. Nothing pinned the behavior for absolute Windows paths: the existing Windows `callerPath` test covers relative `..` resolution only. ## Change and scope Tests only: - `tests/boundary/filesystem/callerPath.test.ts`: `absoluteCallerPath` returns `C:\Users\u\h.exe` for the single-backslash, forward-slash, doubled-backslash and doubled-slash spellings (platform-injected, so it runs on every host). - `tests/boundary/filesystem/windowsTargetSeparators.test.ts` (Windows only): `parseBinaryTarget` on a real PE fixture returns the same canonical `sourcePath` for all four spellings of its path. Not included: the issue's secondary request to stop recommending `rea doctor` for `ERR_REA_WINDOWS_NATIVE` admission failures. That touches remediation wording shared across providers and seemed better as its own change. ## Contract and boundary impact - Semantic owner and earliest changed stage: none changed; tests pin caller-path normalization in `absoluteCallerPath` / `parseBinaryTarget`. - Contribution scope fit and linked maintainer decision: not applicable (tests only). - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. - [x] Read existing files or captured data. ## Evidence and regression coverage - Executed on Windows 11 x64 (Node 24): calling `parseBinaryTarget` directly on a copy of `hostname.exe` returned the identical `sourcePath` (`C:\Users\...\h1.exe`) for the single-backslash, forward-slash, doubled-backslash and doubled-slash inputs. - With the 6.5.0 rule temporarily restored in `BinaryTargetResolver.ts` (absolute input used verbatim), the new Windows test fails: `Expected: "C:\Users\...\image.exe"`, `Received: "C:/Users/.../image.exe"`. With main's code it passes. - Remaining proof gaps: no Ghidra run. This host has no Ghidra or JDK, and this checkout lacks the packaged Windows native addon, so I did not run the reporter's `rea analyze` end to end or call the native walker. The link from a clean `sourcePath` to successful admission rests on the reporter's matrix (forward-slash paths succeed) and on reading `localPath`. UNC and `\?\` inputs were not tested. - [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 - `npx vitest run tests/boundary/filesystem/windowsTargetSeparators.test.ts tests/boundary/filesystem/callerPath.test.ts`: the new tests pass. `makes a relative POSIX cwd absolute before appending the path` fails on this Windows host with and without this change (it expects a POSIX `process.cwd()`). - The same Windows test with the 6.5.0 resolver rule restored: fails as shown above. - `npm run verify:test-discovery`: all 1499 test files discovered exactly once. - `npm run check:fast` (typecheck, lint, also run by the pre-push hook): passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: Windows 11 x64 filesystem only; no Ghidra. - Package or release metadata impact: none. - Security, privacy, process, or containment review: tests read a temporary fixture only. ## Author readiness Human owner: <!-- @GitHub-handle --> - [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-10-31 01:14:01 +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#6379
No description provided.