fix: stamp store_meta generation on every publish, not never - #2
Open
pranitpanda-affirm wants to merge 1 commit into
Open
Conversation
cbm_pipeline_publish_staged read the project row (for coverage metadata) but never wrote it: the byte-level writer hand-builds the projects table row directly, bypassing cbm_store_upsert_project, the only place that creates store_meta (db_uid/mutation_gen). Every project indexed through the normal index_repository flow was therefore permanently stuck on "legacy" generation, and trace_path refuses to ever mint a pagination cursor under "legacy" -- callers enumeration silently truncated with no way to page past it, on every project, forever, regardless of how many times it was reindexed. Call cbm_store_upsert_project on every full and incremental publish (re-reading the project row afterward so coverage metadata reflects the freshly stamped generation), so store_meta gets created on first publish and mutation_gen advances on every subsequent one, correctly invalidating cursors minted against a prior generation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
pranitpanda-affirm
marked this pull request as ready for review
August 26, 2026 22:39
DanielDeng2024
approved these changes
Aug 26, 2026
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.
What does this PR do?
trace_path's pagination cursor logic refuses to ever mint a cursor once a project's store generation reads"legacy"— and every project indexed through the normalindex_repositoryflow was stuck there permanently, silently capping caller-enumeration results with no way to page past them.Root cause:
cbm_pipeline_publish_stagedonly ever read the project row (for coverage metadata) but never wrote it. The byte-level writer (sqlite_writer.c) hand-builds theprojectstable row directly on every publish, bypassingcbm_store_upsert_project— the only function that createsstore_meta(db_uid/mutation_gen).Fix: call
cbm_store_upsert_projecton every full and incremental publish, re-reading the project row afterward so coverage metadata reflects the freshly-stamped generation.store_metanow gets created on a project's first publish, andmutation_genadvances on every subsequent one — correctly invalidating cursors minted against a prior generation.Caveat: this only takes effect going forward. A project whose files haven't changed since its last index hits the
incremental.noopfast path (pipeline_incremental.c) and skips publish entirely by design — it can't retroactively escape"legacy"without either a real content change or a forced full rebuild (delete + reindex).Testing
New
pipeline_publish_escapes_legacy_generationtest intests/test_pipeline.c: verifies a fresh index escapes"legacy", and a second real publish (after an actual file edit, to avoid the no-op fast path) advances the generation further.Also verified directly against the installed production binary and live daemon (not just the test build): indexed a throwaway repo fresh —
store_metaappeared immediately withmutation_gen=1; made a real edit and reindexed —mutation_genadvanced to 2 andindexed_atrefreshed.Checklist
git commit -s) — not yet done, flagging for follow-upmake -f Makefile.cbm test) — relevant suites (pipeline,store_*,mcp,graph_buffer) are clean; the full run has ~327 pre-existing failures in tree-sitter grammar/extraction probes, unrelated to this change and present onmainbefore itmake -f Makefile.cbm lint-ci) — not run locally (cppcheck/clang-formatunavailable in this environment); deferring to CI