Fix source lookup tests with symlinked temporary directories

This commit is contained in:
2026-10-27 18:42:19 +00:00
parent 5d5d51ab11
commit 68400ffdfb
2 changed files with 13 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
# Implementation Remediation Review Findings # Implementation Remediation Review Findings
Current follow-up: the public API cleanup review has one open finding (9). Current follow-up: the public API cleanup finding (9) is complete.
The earlier interface-remediation review and completed findings 1–8 below are The earlier interface-remediation review and completed findings 1–8 below are
retained as historical evidence. The current review's scope and validation are retained as historical evidence. The current review's scope and validation are
recorded with finding 9. recorded with finding 9.
@@ -445,9 +445,16 @@ performance threshold or new public dependency restriction is warranted.
## 9. Source Lookup Test Compares Canonical Paths With Symlinked Fixture Paths ## 9. Source Lookup Test Compares Canonical Paths With Symlinked Fixture Paths
Priority: P2. Status: open. This is a test portability defect, not a production Priority: P2. Status: complete. This is a test portability defect, not a production
source-lookup defect. source-lookup defect.
Completion: `TestResultSourceLookup` canonicalizes its fixture directory with
`filepath.EvalSymlinks` before creating files, preserving all source-attribution,
redaction, and detachment assertions. The focused test failed with a symlinked
temporary root before the fix. Both source-lookup tests now pass with `TMPDIR`
pointing to either the real directory or its symlink. The everyday
`./scripts/check.sh` also passed. Production code and behavior are unchanged.
Reviewed revision: `69bd9ead53b0bd1d4b325de2f357b566291a4803`. Reviewed revision: `69bd9ead53b0bd1d4b325de2f357b566291a4803`.
Comparison baseline: `556b10b2cd32cbe3240ced79f72bfcc2fe1ebc35`. Comparison baseline: `556b10b2cd32cbe3240ced79f72bfcc2fe1ebc35`.
Scope: the completed [API cleanup plan](implementation.md) and Scope: the completed [API cleanup plan](implementation.md) and

View File

@@ -12,7 +12,10 @@ import (
) )
func TestResultSourceLookup(t *testing.T) { func TestResultSourceLookup(t *testing.T) {
directory := t.TempDir() directory, err := filepath.EvalSymlinks(t.TempDir())
if err != nil {
t.Fatal(err)
}
mainPath := writeSourceLookupFile(t, directory, "main.yml", `version: MAIN-SOURCE-CANARY mainPath := writeSourceLookupFile(t, directory, "main.yml", `version: MAIN-SOURCE-CANARY
configkit: configkit:
imports: imports: