[PR #2849] [CLOSED] fix(test): reject excluded symlink aliases in exact selections #5438

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2849
Author: @ShuaixinHuang
Created: 10/13/2026
Status: ❌ Closed

Base: main ← Head: codex/fix-exact-test-selection


📝 Commits (10+)

  • 5d1cec8 fix(test): honor exact development test selections
  • 907b410 fix(test): preserve Windows file identity and project coverage
  • b8207e3 fix(test): clean up exact test runs on signals
  • f479f85 fix(test): reject symlinked path ancestors
  • 749cbac Merge branch 'main' into codex/fix-exact-test-selection
  • a0febaa Merge branch 'main' into codex/fix-exact-test-selection
  • 577815d fix(test-runner): honor filesystem identity for exact selection
  • 860970b chore(main): merge pinned CI checkpoint 2895a18
  • cee1540 fix(ci): match selected tests by filesystem identity
  • 39a5322 fix(test): reject excluded symlink aliases in exact selections

📊 Changes

2 files changed (+106 additions, -6 deletions)

View changed files

📝 scripts/run-exact-tests.mjs (+6 -6)
📝 tests/boundary/cli/developmentTests.test.ts (+100 -0)

📄 Description

Summary

Reject an excluded selected file or directory symlink instead of running its discovered target and reporting success. Main now contains the original exact-file runner; this PR's remaining contribution is the symlink correction and its public-command regressions.

Problem and structural fix

When discovery includes only src/domain/value.test.ts, selecting src/contracts/value.test.ts through a junction from contracts to domain used to run the included target. Inode and realpath equality follow links, while the path-component guard checked only case differences. Differently named link components therefore escaped the guard.

Check every differently spelled component with lstat, reject a link on either side, and reject unequal component counts. Identically shared link components remain permitted. Rename the helper to reflect its broader ownership rule. Existing exact matches, filesystem spelling support, configured project coverage and signal cleanup remain in place.

Addresses the same root cause in Greptile's review and Codex's review. No related cleanup remains for this component guard.

Scope and compatibility

Routine developer-test correctness fix within contribution scope; no new provider or target authority. No analysis CLI/MCP contracts, dependencies, package metadata or Evidence changes. Effects remain test-file reads and execution of the requested existing test workflow.

Synced upstream b3c5672ce67564e9b7c7baa6ce21f1674e27b287 and resolved the runner/test merge conflicts by retaining upstream project ownership and fixture changes. Relative to that main revision, the contribution changes two files.

Executed regression evidence

On PR baseline cee1540, the two directory-alias regressions failed because both local and focused commands resolved successfully and ran an unselected target. With the fix they reject the excluded path, leave no test-execution marker, and still execute the explicitly selected included path.

Added coverage for an excluded file symlink and a positive shared-directory-link selection. Final fixtures use canonical src/domain and src/contracts project paths so the new upstream project admission rule does not short-circuit the intended selection test.

Validation

Native Windows x64, pinned Node 24.18.0 and npm 11.16.0; updated locked dependencies installed in an isolated worktree with npm ci --ignore-scripts.

  • npm run test:focused -- tests/boundary/cli/developmentTests.test.ts: 16 passed, 1 skipped. The file-symlink case probes actual creation permission and skips only Windows EPERM/EACCES; this host lacks the required privilege. Both directory-junction rejection cases and the shared-junction positive case executed and passed.
  • npm run check: all six tasks and architecture guards passed. Existing lint warnings remain; zero errors. Module boundaries cover 1,858 files; architecture guards cover 1,384 files.
  • node scripts/verify-test-discovery.mjs: all 1,242 files discovered exactly once.
  • git diff --check: passed.

Windows test fixtures required execution outside the sandbox because sandboxed junction creation is denied. No Linux/macOS execution, real-provider verification or full test-suite pass is claimed. The POSIX file-symlink regression is authored but was not executed on this Windows host. Current-head GitHub Actions results must be checked separately; local validation does not establish remote CI success.


🔄 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/2849 **Author:** [@ShuaixinHuang](https://github.com/ShuaixinHuang) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/fix-exact-test-selection` --- ### 📝 Commits (10+) - [`5d1cec8`](https://github.com/morluto/rea/commit/5d1cec83ed48d442ab3f53e99e23bb78e0916b06) fix(test): honor exact development test selections - [`907b410`](https://github.com/morluto/rea/commit/907b4100f7d933a261adc7e7403600028f01e888) fix(test): preserve Windows file identity and project coverage - [`b8207e3`](https://github.com/morluto/rea/commit/b8207e33c35ec1e52aa0fd91ffd459f59f876934) fix(test): clean up exact test runs on signals - [`f479f85`](https://github.com/morluto/rea/commit/f479f851bf4dd647477cc72391312c7c30008e87) fix(test): reject symlinked path ancestors - [`749cbac`](https://github.com/morluto/rea/commit/749cbacfb953463b918e41260e9f8a313511d17f) Merge branch 'main' into codex/fix-exact-test-selection - [`a0febaa`](https://github.com/morluto/rea/commit/a0febaab2cd9583cbb0715c9dc64c48bad752897) Merge branch 'main' into codex/fix-exact-test-selection - [`577815d`](https://github.com/morluto/rea/commit/577815d96c68c3c46b6b5e5834a9fba948be4ac1) fix(test-runner): honor filesystem identity for exact selection - [`860970b`](https://github.com/morluto/rea/commit/860970b556820e917e970cfc3a3e74e089f80b69) chore(main): merge pinned CI checkpoint 2895a18 - [`cee1540`](https://github.com/morluto/rea/commit/cee1540bb6d7108f3b85510050d21d1f89a8f479) fix(ci): match selected tests by filesystem identity - [`39a5322`](https://github.com/morluto/rea/commit/39a53225f029ad3c5b7671f6174508dcdfbfdd4c) fix(test): reject excluded symlink aliases in exact selections ### 📊 Changes **2 files changed** (+106 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `scripts/run-exact-tests.mjs` (+6 -6) 📝 `tests/boundary/cli/developmentTests.test.ts` (+100 -0) </details> ### 📄 Description ## Summary Reject an excluded selected file or directory symlink instead of running its discovered target and reporting success. Main now contains the original exact-file runner; this PR's remaining contribution is the symlink correction and its public-command regressions. ## Problem and structural fix When discovery includes only `src/domain/value.test.ts`, selecting `src/contracts/value.test.ts` through a junction from `contracts` to `domain` used to run the included target. Inode and `realpath` equality follow links, while the path-component guard checked only case differences. Differently named link components therefore escaped the guard. Check every differently spelled component with `lstat`, reject a link on either side, and reject unequal component counts. Identically shared link components remain permitted. Rename the helper to reflect its broader ownership rule. Existing exact matches, filesystem spelling support, configured project coverage and signal cleanup remain in place. Addresses the same root cause in [Greptile's review](https://github.com/morluto/rea/pull/2849#discussion_r4263049137) and [Codex's review](https://github.com/morluto/rea/pull/2849#discussion_r4263057754). No related cleanup remains for this component guard. ## Scope and compatibility Routine developer-test correctness fix within contribution scope; no new provider or target authority. No analysis CLI/MCP contracts, dependencies, package metadata or Evidence changes. Effects remain test-file reads and execution of the requested existing test workflow. Synced upstream `b3c5672ce67564e9b7c7baa6ce21f1674e27b287` and resolved the runner/test merge conflicts by retaining upstream project ownership and fixture changes. Relative to that main revision, the contribution changes two files. ## Executed regression evidence On PR baseline `cee1540`, the two directory-alias regressions failed because both local and focused commands resolved successfully and ran an unselected target. With the fix they reject the excluded path, leave no test-execution marker, and still execute the explicitly selected included path. Added coverage for an excluded file symlink and a positive shared-directory-link selection. Final fixtures use canonical `src/domain` and `src/contracts` project paths so the new upstream project admission rule does not short-circuit the intended selection test. ## Validation Native Windows x64, pinned Node 24.18.0 and npm 11.16.0; updated locked dependencies installed in an isolated worktree with `npm ci --ignore-scripts`. - `npm run test:focused -- tests/boundary/cli/developmentTests.test.ts`: **16 passed, 1 skipped**. The file-symlink case probes actual creation permission and skips only Windows `EPERM`/`EACCES`; this host lacks the required privilege. Both directory-junction rejection cases and the shared-junction positive case executed and passed. - `npm run check`: **all six tasks and architecture guards passed**. Existing lint warnings remain; zero errors. Module boundaries cover 1,858 files; architecture guards cover 1,384 files. - `node scripts/verify-test-discovery.mjs`: **all 1,242 files discovered exactly once**. - `git diff --check`: passed. Windows test fixtures required execution outside the sandbox because sandboxed junction creation is denied. No Linux/macOS execution, real-provider verification or full test-suite pass is claimed. The POSIX file-symlink regression is authored but was not executed on this Windows host. Current-head GitHub Actions results must be checked separately; local validation does not establish remote CI success. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:06:38 +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#5438
No description provided.