fix(graph): do not print uninspected status as measured zeros - #213
dyk1454683243-sudo wants to merge 2 commits into
Conversation
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
left a comment
There was a problem hiding this comment.
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.
| parseHealth: input.parseHealth, | ||
| changes: input.changes, | ||
| diagnostics: input.diagnostics, | ||
| inspected: input.inspected ?? true, |
There was a problem hiding this comment.
[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:
- Build a graph for one TypeScript file and retain the successful-index timestamp.
- Change the snapshot's
sourceCorpusDigestto"0".repeat(64)while preserving the rest of the snapshot. - Modify the live source file.
- Run
runGraphStatusin 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.
|
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. |
What
When immutable graph inspection is skipped (a stranded
graph.db-walis the filed case),mex graph statusno longer prints placeholder zeros that look like real measurements.GraphStatusnow carries an additiveinspectedflag. Early-return paths that skip opening or reading the store setinspected: false.printStatusthen labels parse health, last successful index, and sources as not inspected instead of0 ok/never/0 changed.--jsonkeeps the existing zeroparseHealthandchangesobjects; 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 okandLast successful index: nevereven though the database was unchanged. Those zeros are placeholders fromemptyParseHealth(), not measurements.Type of change
How to test
npx vitest run src/graph/__tests__/cli-graph.test.ts src/graph/__tests__/status.test.tsinspected === falseand human output does not claim0 ok.inspected === true.npm run typechecknpm testChecklist
npx vitest run src/graph/__tests__/cli-graph.test.ts src/graph/__tests__/status.test.ts— 58 passed, 1 skipped)npm run typecheck)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 rerunsparseHealthandchangesstay required non-null objects.inspectedis optional and defaults to true on fully inspected paths, so existing consumers remain valid.Code-graph changes
mainLanguageExtractororFrameworkResolverinterfacecore / discuss-firstissue is linked aboveThis is a status-reporting fix only. It does not change indexing, publication, or #205 orphan-candidate work.