Found during dogfooding v3.9.4
Severity: High
Command: codegraph build
Top-level include and exclude keys in .codegraphrc.json are declared in DEFAULTS (src/infrastructure/config.ts:17-18) but never read anywhere in the codebase. Users who configure them get no warning, no error, and no effect.
Reproduction
mkdir cfg-test && cd cfg-test
cat > a.js <<'EOF'
export function foo() { return bar(); }
export function bar() { return 1; }
EOF
cat > test.test.js <<'EOF'
import { foo } from './a.js';
export function testFoo() { return foo(); }
EOF
# No config: 2 files, 3 functions
npx codegraph build .
# Native build orchestrator completed: 5 nodes, 6 edges, 2 files
# With exclude config: should drop test.test.js, should be 1 file
cat > .codegraphrc.json <<'EOF'
{
"exclude": ["**/*.test.js"]
}
EOF
rm -rf .codegraph && npx codegraph build .
# Native build orchestrator completed: 5 nodes, 6 edges, 2 files <-- identical
Result with and without exclude is bit-for-bit identical. The config key is accepted and preserved (loadConfig returns it), but no code path consumes it.
Expected behavior
Either:
- Honor the
include / exclude glob patterns when collecting files (the obvious behavior), or
- If intentionally unsupported, reject the key during config validation with a clear error.
Actual behavior
Silent no-op.
Root cause
src/domain/graph/builder/helpers.ts:collectFiles() only reads config.ignoreDirs (line 90):
const extraIgnore = config.ignoreDirs ? new Set(config.ignoreDirs) : null;
Grepping the entire src/ for config.include, config.exclude, .include, or .exclude patterns returns zero references to these config keys other than their default declarations at src/infrastructure/config.ts:17-18. Neither collectFiles nor any upstream filter uses them.
Suggested fix
Add include and exclude glob matching to collectFiles — e.g., after the extension check, if config.include is non-empty require a match, and if config.exclude is non-empty reject a match. Use a simple glob library or minimatch-equivalent.
Related
ignoreDirs (directory-level) works correctly. The gap is specifically file-level glob filtering.
Found during dogfooding v3.9.4
Severity: High
Command:
codegraph buildTop-level
includeandexcludekeys in.codegraphrc.jsonare declared inDEFAULTS(src/infrastructure/config.ts:17-18) but never read anywhere in the codebase. Users who configure them get no warning, no error, and no effect.Reproduction
Result with and without
excludeis bit-for-bit identical. The config key is accepted and preserved (loadConfigreturns it), but no code path consumes it.Expected behavior
Either:
include/excludeglob patterns when collecting files (the obvious behavior), orActual behavior
Silent no-op.
Root cause
src/domain/graph/builder/helpers.ts:collectFiles()only readsconfig.ignoreDirs(line 90):Grepping the entire
src/forconfig.include,config.exclude,.include, or.excludepatterns returns zero references to these config keys other than their default declarations atsrc/infrastructure/config.ts:17-18. Neither collectFiles nor any upstream filter uses them.Suggested fix
Add
includeandexcludeglob matching tocollectFiles— e.g., after the extension check, ifconfig.includeis non-empty require a match, and ifconfig.excludeis non-empty reject a match. Use a simple glob library orminimatch-equivalent.Related
ignoreDirs(directory-level) works correctly. The gap is specifically file-level glob filtering.