Repository navigation
fix(scanner): forward-slash file-graph keys on every OS; .exe test binary on Windows (#214 A-C) - #218
Merged
Merged
Conversation
…inary gets .exe on Windows Group C of #214 was a product bug: on Windows the walker and ast-grep emitted native paths, filepath.Clean/Join/Dir rebuilt probes with "\", and every import written with "/" missed the index, so every file reported no importers. One spelling now, scanner.keyPath (Clean then ToSlash), applied where paths enter (walker FileInfo.Path, ast-grep FileAnalysis.Path), where keys are stored (fileIndex, FileGraph.Imports and Importers, precomputed Cargo and Swift edges) and where probes are looked up (fileIndex.exact, fileIndex.dir, suffixMatches, tryExactMatch, normalizeImport). Resolvers keep using filepath for filesystem access. Group B followed: tests expect "/" and the graph now emits "/", so the Rust fallback and Cargo assertions hold on Windows. The MCP normalizeImporterFile returns the same slash key. Group A: TestMain builds codemap_test_binary.exe on Windows so the 34 end-to-end CLI tests can exec it. Refs #214 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T
JordanCoin
added a commit
that referenced
this pull request
Oct 11, 2026
…bes, cargo edges as slash keys; tests spell keys with slashes (#219) * fix(scanner): workspace roots, gitignore probes and cargo edges use slash keys; tests spell keys with slashes Residue of #214 after #218. Graph keys are forward-slashed on every OS, but the JS and Dart workspace resolvers still derived package roots with filepath.Dir and compared them to keys with the native separator, so on Windows pathContains was false for every member file and workspace imports resolved to nothing. Nested .gitignore matching handed go-gitignore a native relative path, which never matched a slash pattern, so ignored files were scanned and visible ones dropped. The cargo-metadata fallback emitted native edges that no slash key matched. cleanRepoPath, the CUE and Go fallback file keys, nested-repo paths and cargo edges now go through keyPath; pathContains splits on "/". Test side: 123 filepath.Join calls whose arguments were all string literals were graph keys written the long way; they are slash literals now. Fixture creation that joins a temp root is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T * fix(scanner): Rust module paths, Go fallback repos and workspace expectations as slash keys; skip the residue outside the resolvers by name The Rust resolver kept every repo-relative path in native form through filepath.Clean/Join/Dir and compared it to slash graph keys, so on Windows crate-rooted, super:: and literal-path modules resolved to nothing. Repo-relative paths now go through keyPath and path.Join; only calls that touch the disk keep filepath. Same for the Go fallback's nested-repo check. Test side: filepath.FromSlash wrappers on expectations in scanner tests were spelling graph keys in native form; removed. The literal rewrite from the previous commit is reverted outside scanner, where native paths are the right expectation (config path, topology repo path, git exclude path). Twenty-four tests outside the resolvers now skip on Windows with the cause named and "tracked in #214", so the residue is explicit in the informational cell instead of a wall of red. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Groups A, B and C of #214 (88 of the 124 Windows failures). D to G are not touched.
Root cause (B and C, one bug)
On Windows the walker and ast-grep emit native paths,
filepath.Clean/Join/Dirrebuild every probe with\, and imports are written with/. The index key and the probe never agreed, so every file reported no importers on Windows. Group B is the same bug seen from the output side: tests expect/, the graph emitted\.Fix: one spelling for graph keys
scanner.keyPath=filepath.ToSlash(filepath.Clean(p)), applied:walker.goFileInfo.Path,astgrep.goFileAnalysis.PathfileIndex(byExact,byDir,bySuffix),FileGraph.Imports/Importersat the resolver-loop write,applyPrecomputedFileEdges(Cargo fallback), Swift type-reference edgesfileIndex.exact()andfileIndex.dir()replace every directbyExact[...]/byDir[...]read infilegraph.go,rustgraph.go,rustbuildscript.go,jsworkspace.go;suffixMatches,tryExactMatch(also returns the key, not the probe), suffix helpers compare against/normalizeImportemits/for Python dots and Rust::instead offilepath.SeparatornormalizeImporterFilereturns the same slash key (test renamed from...UsesNativeGraphKeysto...UsesSlashGraphKeys)Resolvers keep
filepathfor filesystem access; Windows accepts/in paths.Group A:
TestMainappends.exeon Windows (one line, 34 tests).Verification
go build ./... && go test ./... && gofmt -l .clean (go vet ./scanner/ ./mcp/ .too).GOOS=windows go build ./...ok;GOOS=windows go test -c ./scanner/ -o /dev/null, same for.and./mcp/: ok.TestIndexMatchesNativeProbeAgainstSlashKeys(scanner/filegraph_test.go): slash-form keys,filepath.FromSlashprobes for exact, dir and suffix lookups; passes on both OSes, would have failed on Windows before.TestNormalizeImport/TestDepsNormalizeImportexpectations changed fromfilepath.Join(...)to/literals (identical on Unix).Windows counts
Before (run 38169675758): A 34, B 23, C 31.
After: not measured by CI on this PR.
mainat the time of this PR has the Windows build cell but not the Windows test cell; that arrives with #209. Once #209 merges and this branch picks it up, the informational Windows job will report the remaining list. Expected residue in these groups: tests that build Rust/JS internal maps fromfilepath.Cleanpaths and compare them to each other are unaffected (consistent on both sides); anything that compares those internal native paths against graph keys would still miss and belongs to the D-G follow-up.Not changed:
watch/events.gograph lookups by nativerelPath(group G),cmd/hooks.goimporter lookups byfilepath.Reloutput (group G), the deadnativePathbranch intryDirMatch(harmless now).Refs #214
🤖 Generated with Claude Code
https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T