Summary
`codegraph exports ` treats a single named re-export (`export { X } from 'Y'`) as if the file transitively re-exports every export of `Y`, populating `reexportedSymbols` with unrelated symbols that were never re-exported.
Repro
`src/features/graph-enrichment.ts` contains exactly one re-export statement:
```ts
export { loadPlotConfig } from '../presentation/viewer.js';
```
It also directly imports (not re-exports) `DEFAULT_CONFIG`/`PlotConfig` from the same file for internal use.
Running:
```
codegraph exports src/features/graph-enrichment.ts -T --json
```
returns `reexportedSymbols` containing 8 entries: `PlotConfig`, `loadPlotConfig`, `escapeHtml`, `buildLayoutOptions`, `ViewerNode`, `ViewerEdge`, `ViewerData`, `renderPlotHTML` — all attributed to `originFile: src/presentation/viewer.ts`.
Only `loadPlotConfig` is actually re-exported by `graph-enrichment.ts`. The other 7 (`escapeHtml`, `buildLayoutOptions`, `ViewerNode`, `ViewerEdge`, `ViewerData`, `renderPlotHTML`) aren't even imported by the file at all — they're just other unrelated exports that happen to live in `viewer.ts`. `PlotConfig` is imported (as a type) but not re-exported.
Oddly, `DEFAULT_CONFIG` — which is directly imported into `graph-enrichment.ts` — is not in the list, nor are `COMMUNITY_COLORS`/`DEFAULT_NODE_COLORS`/`DEFAULT_ROLE_COLORS` (imported from `presentation/colors.js`). So the behavior isn't "list all imported symbols from re-export-adjacent files" either — it looks like it's dumping most/all of the target file's own exports once any re-export edge to that file exists, rather than tracing which specific symbol the `export { X } from 'Y'` statement names.
Impact
- Low severity for gating purposes — `totalExported`/`results` (the actual own-exports list) is correct; this only pollutes the informational `reexportedSymbols`/`totalReexportedUnused` fields.
- Misleading for anyone using `codegraph exports` to audit what a file actually re-exports (e.g. Titan Gate's Step 5d barrel-file re-export-chain check), since it overstates the re-export surface.
Where found
Found incidentally while running Titan Gate Step 5a (`codegraph exports`) during the Phase 9 layering-fix commit (moving `generatePlotHTML` from `src/features/graph-enrichment.ts` to `src/presentation/plot.ts`). Not related to that change — reproduces on the pre-existing `export { loadPlotConfig } from '../presentation/viewer.js'` line, untouched by this commit.
Summary
`codegraph exports ` treats a single named re-export (`export { X } from 'Y'`) as if the file transitively re-exports every export of `Y`, populating `reexportedSymbols` with unrelated symbols that were never re-exported.
Repro
`src/features/graph-enrichment.ts` contains exactly one re-export statement:
```ts
export { loadPlotConfig } from '../presentation/viewer.js';
```
It also directly imports (not re-exports) `DEFAULT_CONFIG`/`PlotConfig` from the same file for internal use.
Running:
```
codegraph exports src/features/graph-enrichment.ts -T --json
```
returns `reexportedSymbols` containing 8 entries: `PlotConfig`, `loadPlotConfig`, `escapeHtml`, `buildLayoutOptions`, `ViewerNode`, `ViewerEdge`, `ViewerData`, `renderPlotHTML` — all attributed to `originFile: src/presentation/viewer.ts`.
Only `loadPlotConfig` is actually re-exported by `graph-enrichment.ts`. The other 7 (`escapeHtml`, `buildLayoutOptions`, `ViewerNode`, `ViewerEdge`, `ViewerData`, `renderPlotHTML`) aren't even imported by the file at all — they're just other unrelated exports that happen to live in `viewer.ts`. `PlotConfig` is imported (as a type) but not re-exported.
Oddly, `DEFAULT_CONFIG` — which is directly imported into `graph-enrichment.ts` — is not in the list, nor are `COMMUNITY_COLORS`/`DEFAULT_NODE_COLORS`/`DEFAULT_ROLE_COLORS` (imported from `presentation/colors.js`). So the behavior isn't "list all imported symbols from re-export-adjacent files" either — it looks like it's dumping most/all of the target file's own exports once any re-export edge to that file exists, rather than tracing which specific symbol the `export { X } from 'Y'` statement names.
Impact
Where found
Found incidentally while running Titan Gate Step 5a (`codegraph exports`) during the Phase 9 layering-fix commit (moving `generatePlotHTML` from `src/features/graph-enrichment.ts` to `src/presentation/plot.ts`). Not related to that change — reproduces on the pre-existing `export { loadPlotConfig } from '../presentation/viewer.js'` line, untouched by this commit.