feat(graph): surface unindexed source files instead of leaving them silent - #175
abhinav-phi wants to merge 7 commits into
Conversation
…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.
2e66869 to
7b1ed1f
Compare
|
Rebase note: this branch now sits on current CI: the first run on the rebased head failed only in All green — ready for review. |
|
Thanks @abhinav-phi, right shape for #163: reporting rather than new extractors, bounded, and wrapped so it can never fail the command carrying it. The rebase note is accurate. I merged current Both of #163's repros are fixed for Must fix1. The histogram re-walks the whole repository on every callIt globs It walks everything, finds nothing, discards the result, and emits exactly what it emitted before. The repos paying most are the ones the feature does nothing for. A second problem rides along: 399 of 600, and which 399 depends on glob order. The fix I'd like is to compute it once during the build and have the read paths reuse it — and I want to be honest that it isn't a small change. 2.
|
Unknown cached coverage no longer degrades the scope status by itself: status continues to describe the returned evidence (including honest text-only fallbacks for supported files), while the existing warnings array still carries the explicit unknown-coverage message whenever the coverage metadata exists but its cached observation is unavailable, stale, or capped. Positively observed unsupported coverage keeps degrading scope status as before. HealthRecord and protocol v3 goldens remain unchanged.
|
Implemented the build-time cache in a6ae73d/a4c2fff using existing project_metadata. Reads reuse it with bounded directory-stamp validation, without a coverage re-walk. The 30k-file regression counts all 600 Go candidates; stale, malformed, or over-budget observations do not supply exact totals. Build/refresh/rebuild output, doctor guidance, extension filtering, and the miss truncated flag are updated. The changelog conflict is resolved with the upstream entries retained. Scope now warns and degrades for observed unsupported coverage. An invalidated cache produces an explicit unknown-coverage warning while preserving the status semantics of returned evidence. HealthRecord, protocol v3, and goldens are unchanged pending your approval of any additive health field. The optional target-specific unsupported-file message is not included. Final-head CI is green: https://github.com/mex-memory/mex/actions/runs/35164795895 . @theyashasvipandey could you review the cache/freshness approach and confirm whether you still want the additive HealthRecord field? |
|
hi the coverage cache is implemented in a4c2fff coverage is computed once at graph build time and stored in the existing metadata reads reuse the stored count with bounded directory stamps and never rewalk the repository a 30k file tree now counts all 600 go candidates exactly stale malformed or over budget observations never report an exact total graph scope warns and degrades on observed unsupported coverage and shows an unknown coverage warning when the cache is stale the changelog conflict is resolved with all upstream entries kept the health record and protocol goldens stay untouched pending your call on additive fields all ci checks are green could you review the cache approach and let me know if you still want the additive health field |
Resolves #163.
Problem
EXTENSION_MAPcovers 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:0 nodeswith exit code 0, andmex doctorshows four green ticks;indexedFiles: 1with no warning, and an agent asking about a symbol that exists gets the sameTARGET_NOT_FOUNDa typo gets.Approach
Count the complement at the one seam every consumer already shares.
corpus-policy.tsgainsunindexedExtensionHistogram: a walk with the same glob options and the same ignore list as source discovery (so a repository's owngraph.ignoreshapes the answer), keeping only files whose extension is recognized source but no extractor claims it.The recognized set is checked through
isSupportedSourceFileagainst 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
truncatedflag, a capped histogram, and a walk that can never fail the command it decorates.What changes
mex graph: printsNot indexed: N source file(s) have extensions no extractor handles: .go (2), ...after the build summary;--jsongainsunindexedSources(total,byExtension,truncated), absent when the histogram finds nothing, so existing consumers are unchanged.mex graph query/mex impact:TARGET_NOT_FOUNDrecords 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: aCoverageline plus a next-steps hint when recognized source files are unindexable.Verification
coverage-histogram.test.ts(recognition, noise exclusion,graph.ignorehandling, truncation, entry cap).cli-agent.test.ts: two new tests —TARGET_NOT_FOUNDstays bare on a fully covered repository, and names unindexed sources on a mixed TS/Svelte/Go repo.filesIndexed: 1+unindexedSources: {total: 2, byExtension: {".go": 1, ".svelte": 1}}on both the build output and theTARGET_NOT_FOUNDrecord; a clean repo's output is byte-identical to before.npm run typecheck,npm run buildpass locally; targeted suites green. (The pre-existing Windows-local failures in symlink/SHM tests reproduce identically on cleanmainand are unrelated.)No identity, reconciliation, schema, or drift-semantics changes are included.