Bug
codelens affected returns affected_count: 0 and puts the workspace path in unresolved[] when run against a TypeScript project. The command is essentially a no-op for TS.
Reproduction
# After running scan on a TS workspace:
codelens affected /path/to/ts-workspace "auth/google-auth-cache.ts"
Actual output:
{
"s": "ok",
"changed_files": ["auth/google-auth-cache.ts"],
"unresolved": ["/path/to/ts-workspace"],
"d": 5,
"st": {
"changed_count": 1,
"unresolved_count": 1,
"affected_count": 0,
"affected_test_count": 0,
"affected_source_count": 0,
"visited_total": 1
}
}
Expected: list of files that import (directly or transitively) from auth/google-auth-cache.ts.
Root Cause Hypothesis
The affected command likely does a BFS/DFS traversal on the graph edges, but the edge lookup for TS files is not finding the correct node IDs. Possible causes:
- Path normalization mismatch: the input
"auth/google-auth-cache.ts" does not match the node ID format stored after scan (which may use backslashes on Windows, e.g. auth\google-auth-cache.ts, or includes a full prefix)
- The reverse-dependency index (edges pointing to the changed file) is not being built correctly for
js_backend file type (TypeScript is classified as js_backend in scan output)
- Node lookup in
commands/affected.py returns empty set, so BFS never starts
Investigation Entry Point
-
After scan, query the SQLite graph directly:
codelens query-graph /path/to/workspace "MATCH (n) WHERE n.id CONTAINS 'google-auth-cache' RETURN n.id LIMIT 5"
This will reveal the actual node ID format stored for TS files.
-
Compare that format against what affected passes as the starting node key.
-
Fix the path normalization in commands/affected.py so the input filename resolves correctly against the stored node IDs.
Definition of Done
codelens affected <workspace> "auth/google-auth-cache.ts" returns the correct list of transitively affected files
- Works on both Unix (
/) and Windows (\) path separators
unresolved[] is empty when the input file exists in the scan graph
- Test: add a test in
tests/ that scans a small TS fixture, then asserts affected for a known file returns its known dependents
Labels
type: bug-fix exec: sequential
Bug
codelens affectedreturnsaffected_count: 0and puts the workspace path inunresolved[]when run against a TypeScript project. The command is essentially a no-op for TS.Reproduction
Actual output:
{ "s": "ok", "changed_files": ["auth/google-auth-cache.ts"], "unresolved": ["/path/to/ts-workspace"], "d": 5, "st": { "changed_count": 1, "unresolved_count": 1, "affected_count": 0, "affected_test_count": 0, "affected_source_count": 0, "visited_total": 1 } }Expected: list of files that import (directly or transitively) from
auth/google-auth-cache.ts.Root Cause Hypothesis
The
affectedcommand likely does a BFS/DFS traversal on the graph edges, but the edge lookup for TS files is not finding the correct node IDs. Possible causes:"auth/google-auth-cache.ts"does not match the node ID format stored after scan (which may use backslashes on Windows, e.g.auth\google-auth-cache.ts, or includes a full prefix)js_backendfile type (TypeScript is classified asjs_backendin scan output)commands/affected.pyreturns empty set, so BFS never startsInvestigation Entry Point
After
scan, query the SQLite graph directly:codelens query-graph /path/to/workspace "MATCH (n) WHERE n.id CONTAINS 'google-auth-cache' RETURN n.id LIMIT 5"This will reveal the actual node ID format stored for TS files.
Compare that format against what
affectedpasses as the starting node key.Fix the path normalization in
commands/affected.pyso the input filename resolves correctly against the stored node IDs.Definition of Done
codelens affected <workspace> "auth/google-auth-cache.ts"returns the correct list of transitively affected files/) and Windows (\) path separatorsunresolved[]is empty when the input file exists in the scan graphtests/that scans a small TS fixture, then assertsaffectedfor a known file returns its known dependentsLabels
type: bug-fixexec: sequential