Skip to content

Bump GRAPH_VERSION so the tree-sitter fix reaches existing caches - #50

Merged
nedonatelli merged 1 commit into
mainfrom
fix/graph-version-treesitter
Aug 4, 2026
Merged

Bump GRAPH_VERSION so the tree-sitter fix reaches existing caches#50
nedonatelli merged 1 commit into
mainfrom
fix/graph-version-treesitter

Conversation

@nedonatelli

Copy link
Copy Markdown
Owner

Defect in #48, found while verifying #48.

What happened

#48 made tree-sitter load in a packaged install. I did not bump
GRAPH_VERSION, so nothing re-parsed and the fix was invisible to anyone
with an existing graph — including the install used to verify it.

Reconciliation skips a file whose content hash is unchanged:

if (restored && this.graph.getFileHash(relativePath) === hash) return;

and restore() accepts any cache whose version matches. Swapping the extractor
changes no file's content, so an upgraded install restores its regex-built graph
at v5, matches every hash, re-parses nothing, and keeps serving symbols from the
parser that was just replaced.

Measured, after installing the fixed build and reloading

The method kind is the unambiguous tell — the regex analyzer emits none at all:

kind tree-sitter regex live cache
method 1487 0 absent
function 2275 4468 4432
class 201 214 214
enum 9 19 19
interface 611 639 639

Everything matched regex. Meanwhile createTreeSitterAnalyzer pointed at the
installed extension's grammars loads fine — 28 extensions, and it correctly
emits m:method. So the module, the grammars and the loader were all working;
the graph simply was never rebuilt.

Why this is the same lesson twice

v4 bumped for variable symbols and v5 for generators, both with the reasoning
written into the comment: the affected files do not change, reconciliation is by
content hash, so without a bump the cache serves stale extraction forever.

Replacing the entire extractor is a strictly larger invalidation than either,
and it is the one I missed.

For anyone testing locally

Deleting .sidecar/cache/symbol-graph.json and reloading achieves the same
thing without this change — but that is not available to users upgrading, which
is what the version field is for.

npm run check: 8622 passed, 2 skipped.

🤖 Generated with Claude Code

…g caches

#48 made tree-sitter load in a packaged install. It did not bump GRAPH_VERSION,
so nothing re-parsed and the fix was invisible to anyone with an existing graph
— including the install used to verify it.

Reconciliation skips a file when its content hash is unchanged:

    if (restored && this.graph.getFileHash(relativePath) === hash) return;

and `restore()` accepts any cache whose version matches. Swapping the extractor
changes no file's content, so an upgraded install restored its regex-built
graph at v5, matched every hash, re-parsed nothing, and kept serving symbols
produced by the parser that was just replaced.

Measured after installing the fixed build and reloading — the live cache was
still regex-shaped, and the `method` kind is the unambiguous tell:

    kind         tree-sitter   regex   live cache
    method              1487       0      absent
    function            2275    4468        4432
    class                201     214         214
    enum                   9      19          19

This is the same reasoning the v4 and v5 bumps were written for, applied to a
change that swaps the entire extractor rather than one mapping — a larger
invalidation than either, and the one I failed to make.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

✅ All checks passed

Check Status
Type check ✅ success
Lint ✅ success
Tests ✅ success

Posted by SideCarAI-Bot

@nedonatelli
nedonatelli merged commit ba144d5 into main Aug 4, 2026
3 checks passed
@nedonatelli
nedonatelli deleted the fix/graph-version-treesitter branch September 1, 2026 15:10
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