Skip to content

feat(status): separate files seen from files parsed - #1658

Open
ferrine wants to merge 1 commit into
colbymchenry:mainfrom
ferrine:feat/status-parsed-vs-seen
Open

feat(status): separate files seen from files parsed#1658
ferrine wants to merge 1 commit into
colbymchenry:mainfrom
ferrine:feat/status-parsed-vs-seen

Conversation

@ferrine

@ferrine ferrine commented Aug 31, 2026

Copy link
Copy Markdown

Branch: ferrine:feat/status-parsed-vs-seenmain
Size: 7 files, +232/−5 · Tests: __tests__/status-parsed-vs-seen.test.ts (6 new)

Why

codegraph status counts files by extension, so a language whose parser is
missing or failing reports its full file count and looks completely healthy.
Indexing succeeds, the language is listed, symbol lookups still run — and
nothing from those files is in the graph.

This is the silent-zero failure mode: "no symbols" and "nothing to extract" are
indistinguishable from the outside, so a broken grammar can sit unnoticed
indefinitely. It is also invisible to any smoke test that only checks that
indexing exited 0.

What changed

  • status reports, per language, how many files actually produced symbols
    alongside how many were seen.
  • When a grammar-backed language yields no symbols at all, status says so in
    plain terms rather than leaving the reader to compare two numbers.
  • New --strict flag exits non-zero in that case, so packaging and CI can gate
    on it.
  • The same seen-versus-parsed breakdown is included in what connected agents
    receive.

Restricted to grammar-backed languages, so config formats that legitimately
parse to nothing (yaml, properties) do not warn.

Notes for review

Purely additive: existing output gains a column, the new exit behaviour is
behind an opt-in flag.

`Files by Language` is a GROUP BY over the `files` table, whose
`language` column comes from the file extension. It therefore counts a
file the parser never understood exactly like one it parsed perfectly,
which makes a broken language remarkably cheap to ship: remove a
grammar and `init` still exits 0, `status` still lists the language with
its full file count, and a symbol lookup still "runs" (its not-found
message even contains the symbol name, so grepping for that passes too).
Every obvious check stays green while the language contributes nothing.

Add `parsedFilesByLanguage` — files with at least one node that is not
their own `file` node, which every indexed file gets regardless — and
surface it:

- `status` prints the parsed count beside the file count whenever they
  differ, and names any language that parsed nothing at all;
- `--strict` exits non-zero on that condition, for packaging and CI. It
  is opt-in: failing by default would break existing callers;
- the MCP status tool reports the same split, so a connected agent is
  not told a language is available when none of it was extracted.

The zero-parsed check is restricted to grammar-backed languages via the
new `hasGrammar`. Config formats (yaml, twig, xml) are tracked at file
level deliberately and must never raise it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Bsi9EH64kMisnik4E1gf7
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.

1 participant