Context
Discovered during Titan audit (phase: gauntlet, date: 2026-07-02).
Description
codegraph exports does not credit instanceof ClassName checks (or other bare-reference, no-call-site usages) as consumers, distinct root cause from #1724 (import-type not credited). CodegraphError (src/shared/errors.ts:15) shows consumerCount:0 via codegraph exports src/shared/errors.ts --json despite two real production (non-test) usages: src/cli.ts:5,29 (import { CodegraphError } + if (err instanceof CodegraphError)) and src/mcp/server.ts:17,190,192 (import { CodegraphError, ConfigError } + two instanceof CodegraphError checks).
By contrast, subclasses of CodegraphError that are consumed via new SubClass(...) constructor calls (e.g. ConfigError, consumerCount:23) ARE correctly credited. So the exports consumer-counter appears to only recognize call-expression sites (new X()), not instanceof/bare-reference usages — meaning any base/parent class whose primary cross-file use is instanceof narrowing will falsely present as a dead/unused export.
Additional Context
Repro:
codegraph exports src/shared/errors.ts -T --json
grep -n 'instanceof CodegraphError' src/cli.ts src/mcp/server.ts
Source
- Titan phase: gauntlet
- Severity: bug
- Category: codegraph
Context
Discovered during Titan audit (phase: gauntlet, date: 2026-07-02).
Description
codegraph exportsdoes not creditinstanceof ClassNamechecks (or other bare-reference, no-call-site usages) as consumers, distinct root cause from #1724 (import-type not credited).CodegraphError(src/shared/errors.ts:15) showsconsumerCount:0viacodegraph exports src/shared/errors.ts --jsondespite two real production (non-test) usages:src/cli.ts:5,29(import { CodegraphError }+if (err instanceof CodegraphError)) andsrc/mcp/server.ts:17,190,192(import { CodegraphError, ConfigError }+ twoinstanceof CodegraphErrorchecks).By contrast, subclasses of
CodegraphErrorthat are consumed vianew SubClass(...)constructor calls (e.g.ConfigError,consumerCount:23) ARE correctly credited. So the exports consumer-counter appears to only recognize call-expression sites (new X()), notinstanceof/bare-reference usages — meaning any base/parent class whose primary cross-file use isinstanceofnarrowing will falsely present as a dead/unused export.Additional Context
Repro:
Source