fix: clear error when the code map cannot be read - #327
Closed
vibgrate-team wants to merge 2 commits into
Closed
vibgrate-team wants to merge 2 commits into
vibgrate-team wants to merge 2 commits into
Conversation
Commands that read graph.json treated a truncated file, invalid JSON, or an unsupported schema as a missing map, or printed a parser error that quoted the file. They now exit 1, name which failure it is, and say to rebuild with `vg build`. A missing map is still reported as missing. vg-graph/1.0 and vg-graph/1.1 still load. Fixes #274 Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: vibgrate-team <vibgrate-team@users.noreply.github.com>
GraphSource.get now refuses a map with no schema. The freshness tests only need a readable file so the probe can run. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: vibgrate-team <vibgrate-team@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Commands that load the code map (
vg show,vg impact,vg ask, and the other readers ofgraph.json) used to fail opaquely when the file was truncated, not valid JSON, or written with a schema this version cannot read. A bad file was reported as a missing map, or the process printed a parser error that quoted the file.Those commands now stop with exit code
1. The message names the failure — truncated, not valid JSON, or a schema this version cannot read — and says to rebuild withvg build. It does not include the file contents.A map that is simply absent is still reported as missing (exit
3,no map found). Maps this version already reads (vg-graph/1.0andvg-graph/1.1) still load.Related issues
Fixes #274
Checklist
pnpm testpassespnpm lintis cleanpnpm typecheckis cleangraph.json/ report output (content-hashed IDs, stable sorts; no time, randomness, or filesystem-order dependence)git commit -s, DCO)Notes for reviewers
The check lives in the shared loader, so every command that reads the map gets the same error. A binary snapshot is still a cache: a corrupt snapshot falls back to
graph.json, and a snapshot whose schema this version cannot read fails the same way the JSON would.