Skip to content

fix(graph): do not print uninspected status as measured zeros - #213

Closed
dyk1454683243-sudo wants to merge 2 commits into
mex-memory:mainfrom
dyk1454683243-sudo:cursor/fix-graph-status-not-inspected-312a
Closed

dyk1454683243-sudo wants to merge 2 commits into
mex-memory:mainfrom
dyk1454683243-sudo:cursor/fix-graph-status-not-inspected-312a

Conversation

@dyk1454683243-sudo

@dyk1454683243-sudo dyk1454683243-sudo commented Sep 19, 2026 •

Copy link
Copy Markdown

What

When immutable graph inspection is skipped (a stranded graph.db-wal is the filed case), mex graph status no longer prints placeholder zeros that look like real measurements.

GraphStatus now carries an additive inspected flag. Early-return paths that skip opening or reading the store set inspected: false. printStatus then labels parse health, last successful index, and sources as not inspected instead of 0 ok / never / 0 changed. --json keeps the existing zero parseHealth and changes objects; consumers distinguish “not inspected” from an empty graph with the new flag.

Why

Fixes #204

A healthy store with a non-empty WAL sidecar was reading as Parse health: 0 ok and Last successful index: never even though the database was unchanged. Those zeros are placeholders from emptyParseHealth(), not measurements.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Docs
  • CI/Tooling

How to test

  1. npx vitest run src/graph/__tests__/cli-graph.test.ts src/graph/__tests__/status.test.ts
  2. Confirm sidecar-active status has inspected === false and human output does not claim 0 ok.
  3. Confirm a healthy inspected graph still prints real parse-health counts and inspected === true.
  4. npm run typecheck
  5. npm test

Checklist

  • Focused graph tests pass (npx vitest run src/graph/__tests__/cli-graph.test.ts src/graph/__tests__/status.test.ts — 58 passed, 1 skipped)
  • Typecheck passes (npm run typecheck)
  • Tests pass (npm test) — 4168 passed, 4 skipped; 7 failures were timeouts / setup-signing flakes unrelated to this status-reporting change and reproduced or vanished on isolated reruns
  • No breaking changes (or documented below)
  • Tested locally with a real project

parseHealth and changes stay required non-null objects. inspected is optional and defaults to true on fully inspected paths, so existing consumers remain valid.

Code-graph changes

  • This PR targets main
  • A linked issue agrees on the bounded extractor/resolver scope
  • The change follows the frozen LanguageExtractor or FrameworkResolver interface
  • A focused fixture and assertions for the expected node/edge shape are included
  • Any new grammar WASM, extension mapping, extractor, or resolver is registered
  • No graph identity, reconciliation, schema, or drift-semantics changes are included, or a core / discuss-first issue is linked above

This is a status-reporting fix only. It does not change indexing, publication, or #205 orphan-candidate work.

cursoragent and others added 2 commits September 19, 2026 15:10
When immutable inspection is skipped (sidecar/WAL, containment, or
schema/invariant failures), GraphStatus now carries inspected: false.
printStatus labels parse health, last index, and sources as not
inspected so a stranded graph.db-wal no longer reads as an empty graph.

Fixes mex-memory#204

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
Add a fixture-only graph.db-wal case so sidecar-active status asserts
inspected: false and human formatters do not print 0 ok, without
depending on a full index build.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>

@theDakshJaitly theDakshJaitly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the stranded-WAL case, but the GRAPH_SNAPSHOT_CONTENT_MISMATCH early return still reports unmeasured fields as facts. It has read parse-health counts, but has not compared sources and does not populate the index timestamps. The new default therefore labels its placeholder changes and timestamps as inspected: true.

Please handle this partial-inspection return too: mark the unavailable fields as not inspected, using the existing flag conservatively or an equivalent explicit distinction. Add a regression that builds a graph, changes its recorded snapshot digest, modifies a source file, and verifies both text and JSON output.

Validation on 254127f: 200 existing focused tests passed across graph status, CLI, graph integration/freshness/degradation, Hub services/contracts, and reporter/TUI. Workspace typecheck and git diff --check passed. Additional controls confirm fresh/missing-index behavior and stranded-WAL text/JSON output, including unchanged database/WAL bytes. The snapshot-mismatch regression fails as described in the inline comment. Full repository, packaging, and performance suites were not rerun.

Comment thread src/graph/status.ts
parseHealth: input.parseHealth,
changes: input.changes,
diagnostics: input.diagnostics,
inspected: input.inspected ?? true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Do not mark the snapshot-mismatch placeholders as inspected

The GRAPH_SNAPSHOT_CONTENT_MISMATCH return above still calls graphStatus(...) without overriding this default. Although it has measured parseHealth, it supplies changesWithoutIndex(...) (all-zero placeholders) and omits index timestamps, so inspected: true is incorrect for the aggregate result.

Reproduced on this head:

  1. Build a graph for one TypeScript file and retain the successful-index timestamp.
  2. Change the snapshot's sourceCorpusDigest to "0".repeat(64) while preserving the rest of the snapshot.
  3. Modify the live source file.
  4. Run runGraphStatus in text and JSON modes.

Text still prints Last successful index: never and Sources: 0 changed (0 added, 0 modified, 0 deleted). JSON contains inspected: true, lastSuccessfulIndexAt: null, and changes.total: 0, despite the known prior index and source edit. The existing corruption diagnostic is correct, but the timestamp and source comparison were not measured.

Please mark this return uninspected (or distinguish the unavailable fields explicitly) and add the corresponding regression test. This is a missed case in the reporting fix, not a request to relax the corruption check.

@theDakshJaitly

Copy link
Copy Markdown
Collaborator

Closing as superseded by #215, which has now merged. Both PRs address #204 by distinguishing uninspected graph-status placeholders from measured values. The merged implementation also covers the snapshot-content-mismatch case raised in review and the unavailable-status fallback, with regression coverage and passing CI. Thanks for contributing this fix.

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 status prints uninspected fields as measured zeros — a stranded graph.db-wal reads as an empty graph

3 participants