Skip to content

feat(graph): surface unindexed source files instead of leaving them silent - #175

Open
abhinav-phi wants to merge 3 commits into
mex-memory:mainfrom
abhinav-phi:feat/graph-coverage-signal
Open

feat(graph): surface unindexed source files instead of leaving them silent#175
abhinav-phi wants to merge 3 commits into
mex-memory:mainfrom
abhinav-phi:feat/graph-coverage-signal

Conversation

@abhinav-phi

Copy link
Copy Markdown
Contributor

Resolves #163.

Problem

EXTENSION_MAP covers ten extensions, and every discovery path is built from it, so a file with any other extension is invisible everywhere. The failure mode is silence:

  • a repo with no supported files builds a graph of 0 nodes with exit code 0, and mex doctor shows four green ticks;
  • a mixed repo (any Svelte, Vue or Astro frontend) indexes one of three source files, reports indexedFiles: 1 with no warning, and an agent asking about a symbol that exists gets the same TARGET_NOT_FOUND a typo gets.

Approach

Count the complement at the one seam every consumer already shares. corpus-policy.ts gains unindexedExtensionHistogram: a walk with the same glob options and the same ignore list as source discovery (so a repository's own graph.ignore shapes the answer), keeping only files whose extension is recognized source but no extractor claims it.

The recognized set is checked through isSupportedSourceFile against the live extension map, so an extension stops being reported the moment an extractor lands for it — the list cannot go stale.

Reporting is bounded and best-effort by contract: a file-scan cap with an explicit truncated flag, a capped histogram, and a walk that can never fail the command it decorates.

What changes

  • mex graph: prints Not indexed: N source file(s) have extensions no extractor handles: .go (2), ... after the build summary; --json gains unindexedSources (total, byExtension, truncated), absent when the histogram finds nothing, so existing consumers are unchanged.
  • mex graph query / mex impact: TARGET_NOT_FOUND records gain coverage context (filesIndexed, unindexedSources) — but only when it changes the record's meaning (nothing indexed, or unindexed source files exist). Ordinary misses in a healthy repository keep their exact prior shape.
  • mex doctor: a Coverage line plus a next-steps hint when recognized source files are unindexable.

Verification

  • New focused tests: coverage-histogram.test.ts (recognition, noise exclusion, graph.ignore handling, truncation, entry cap).
  • cli-agent.test.ts: two new tests — TARGET_NOT_FOUND stays bare on a fully covered repository, and names unindexed sources on a mixed TS/Svelte/Go repo.
  • Local smoke test reproducing the issue's Repro B: mixed TS/Svelte/Go repo now reports filesIndexed: 1 + unindexedSources: {total: 2, byExtension: {".go": 1, ".svelte": 1}} on both the build output and the TARGET_NOT_FOUND record; a clean repo's output is byte-identical to before.
  • npm run typecheck, npm run build pass locally; targeted suites green. (The pre-existing Windows-local failures in symlink/SHM tests reproduce identically on clean main and are unrelated.)

No identity, reconciliation, schema, or drift-semantics changes are included.

…ilent

The supported-source glob covers exactly the extensions extractors
understand, so a .go or .svelte file is invisible to every discovery
path: `mex graph` reports a complete-looking build, `mex doctor` stays
green, and an agent asking about a symbol that exists gets the same
TARGET_NOT_FOUND a typo gets.

Count the complement at the one seam every consumer shares. The corpus
policy now walks its own ignore list and reports recognized source
extensions no extractor claims — self-removing as extractors land,
because candidates are checked against the live extension map.

- `mex graph` prints the histogram after the build summary and emits
  `unindexedSources` behind --json
- `mex graph query` / `mex impact` TARGET_NOT_FOUND records gain
  coverage context (filesIndexed, unindexedSources) only when it changes
  the record's meaning, so healthy repositories keep their exact shape
- `mex doctor` shows a Coverage line and next-steps hint

Reporting is best-effort by contract: bounded by a file-scan cap with an
explicit truncated flag, and never fails the command that carries it.

Resolves mex-memory#163
An empty store legitimately adds filesIndexed: 0 to a TARGET_NOT_FOUND
record, so the synthetic /repo fixture becomes a real empty temp root —
the histogram walk needs a readable cwd, and a fake path made the
golden's outcome depend on the host filesystem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

graph: files in unsupported languages are silently absent — no warning at build, no signal at query

1 participant