Add an overlay-first pure-upsert route for overlay_publish=small_deltas so bounded changed-file overlays can publish before recursive exact inbound-frontier expansion falls through to containment.
The route reuses existing scratch seed, extract/resolve, postpass, delta metadata, preserved-inbound, and overlay publish helpers. It is gated to pure upserts in FAST-or-higher modes within the existing exact changed/affected path caps, and falls through to the existing exact/containment paths on failure.
Avoid a duplicate failed overlay generation when overlay-first reaches the publish step and fails; exact upsert skips the second overlay publish attempt and continues to canonical exact fallback.
Add a wide-inbound pipeline canary proving a changed Leaf with four unchanged callers now publishes incremental_overlay before frontier_too_large and active overlay BFS still sees CallerA -> Leaf.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=pipeline build/c/test-runner (321 passed); CBM_ONLY_SUITE=mcp build/c/test-runner (166 passed); scripts/check-source-safety.sh on touched files; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Carry inbound edge properties through cbm_store_list_file_delta_inbound_edges so active overlay rows do not lose relationship metadata.
Promote the recomputed-edge skip policy into a shared pipeline predicate with edge-type constants, and reuse it from incremental replay.
Add cbm_pipeline_file_delta_add_preserved_inbound_edges for overlay-producer support: upsert deltas preserve only non-recomputed one-hop inbound edges whose target QN still exists in the new delta, with duplicate suppression.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=store_nodes build/c/test-runner (105 passed); CBM_ONLY_SUITE=pipeline build/c/test-runner (320 passed); CBM_ONLY_SUITE=mcp build/c/test-runner (166 passed); scripts/check-source-safety.sh on touched files; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Reuse the existing sequential EnvVar/CONFIGURES materialization helper from the parallel full-index registry phase so full rebuilds remain a valid oracle for incremental slices.
Add a sequential-vs-parallel pipeline canary for C getenv access that verifies the CONFIGURES edge and canonical graph equality. This fixes the route_handler self-dogfood mismatch where incremental containment had EnvVar data that parallel full rebuild omitted.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=pipeline build/c/test-runner; bash scripts/check-source-safety.sh src/pipeline/pass_definitions.c src/pipeline/pass_parallel.c src/pipeline/pipeline_internal.h tests/test_pipeline.c; git diff --check; make -f Makefile.cbm -j8 cbm; route_handler self-dogfood rerun passed.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Create ancestor folder nodes before child folder edges in the full structure pass so first-seen nested directories produce deterministic CONTAINS_FOLDER edges.
Add the matching CBM_PIPELINE_EDGE_CONTAINS_FOLDER constant and reuse it in the exact-delta structural context path. Strengthen the pipeline structure canary to require pkg -> pkg/util containment and keep cleanup ahead of final assertions.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=pipeline build/c/test-runner; bash scripts/check-source-safety.sh src/pipeline/pipeline.c src/pipeline/pipeline_delta.c src/pipeline/pipeline_internal.h tests/test_pipeline.c; git diff --check; make -f Makefile.cbm -j8 cbm; refreshed bounded P.A.N8.7 overlay CLI matrix passed 5/5.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add opt-in overlay_compaction_policy=after_publish with a bounded overlay_compaction_max_generations setting. index_repository now starts a one-shot compaction worker only after a successful incremental_overlay publish and reports the trigger status in the response.\n\nValidation:\n- make -f Makefile.cbm -j8 build/c/test-runner\n- CBM_ONLY_SUITE=mcp build/c/test-runner\n- CBM_ONLY_SUITE=pipeline build/c/test-runner\n- make -f Makefile.cbm -j8 cbm\n- git diff --check\n- bash scripts/check-source-safety.sh src/mcp/mcp.c src/cli/cli.c src/pipeline/pipeline.h tests/test_mcp.c tests/test_pipeline.c
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a one-shot MCP server overlay compaction worker that opens its own project store handle, reuses the bounded store drain helper, and is joined explicitly or during server teardown. The worker is not exposed as an MCP tool, does not poll or sleep, and does not change default behavior.
Reject duplicate starts until the previous worker is joined, validate project names before spawning, use the existing project DB path helper, and open databases with the no-create query path to avoid ghost cache files.
Cover the lifecycle with an isolated-cache MCP canary that compacts one overlay, rejects a duplicate start, joins cleanly, then drains the remaining overlay. Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=mcp build/c/test-runner (161 passed); git diff --check; scripts/check-source-safety.sh src/mcp/mcp.c src/mcp/mcp.h tests/test_mcp.c; make -f Makefile.cbm -j8 cbm.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a bounded store helper that repeatedly reuses compact_next for ready overlay generations. A named CBM_STORE_COMPACT_ALL_GENERATIONS constant documents the drain-all mode, while positive limits cap the number of generations compacted by one API call.
Cover no-ready drain behavior and a two-overlay canary that proves a one-generation limit leaves later ready overlays visible for a subsequent drain. This prepares the future background worker to reuse one store path instead of duplicating compaction loops.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=store_nodes build/c/test-runner (105 passed); git diff --check; scripts/check-source-safety.sh src/store/store.c src/store/store.h tests/test_store_nodes.c; make -f Makefile.cbm -j8 cbm.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a reusable store primitive that claims the oldest ready overlay generation, reserves a canonical index generation, and reuses the existing overlay compaction path. On reservation or compaction failure, the helper releases the compaction claim and marks the reserved generation failed when applicable.
Keep the behavior inert unless explicitly called by future compaction workers. Cover the no-ready CBM_STORE_NOT_FOUND contract and route an existing tombstone compaction canary through the new helper.
Validation: CBM_ONLY_SUITE=store_nodes build/c/test-runner (104 passed); git diff --check; scripts/check-source-safety.sh src/store/store.c src/store/store.h tests/test_store_nodes.c; make -f Makefile.cbm -j8 cbm.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Replace status-based overlay compaction claims with an explicit overlay_compaction_claims lease table. Claiming now inserts a lease for the oldest unclaimed overlay_ready generation instead of changing the generation status to compacting, so active overlay read paths keep seeing the fresh overlay while a future background compactor owns it.
Recovery now releases abandoned lease rows after process restart or confirmed worker shutdown. The tests cover double-claim prevention, recovery/reclaim, failed-generation preservation, active read visibility while claimed, and FK cleanup of the claim when compaction deletes the overlay generation.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=store_nodes build/c/test-runner; git diff --check; bash scripts/check-source-safety.sh src/store/store.c src/store/store.h tests/test_store_nodes.c; make -f Makefile.cbm -j8 cbm.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a default-inert recovery primitive for overlay generations left in compacting after process restart or confirmed worker shutdown. The API requeues compacting generations to overlay_ready in one existing BEGIN IMMEDIATE transaction and returns the number recovered, with no timeout heuristic or live-worker assumption.
Cover the recovery path in store_nodes by claiming a ready generation, recovering it, proving failed generations are untouched, and proving the recovered generation can be claimed again. The header documents that callers must not run recovery while a compactor is active.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=store_nodes build/c/test-runner; git diff --check; bash scripts/check-source-safety.sh src/store/store.c src/store/store.h tests/test_store_nodes.c; make -f Makefile.cbm -j8 cbm.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add cbm_store_claim_ready_overlay_generation() as the narrow store lifecycle primitive for a future background compactor. The claim runs in the existing BEGIN IMMEDIATE transaction path, selects the oldest ready overlay generation, and moves it from overlay_ready to compacting with a guarded status update so two callers cannot claim the same generation.
Cover oldest-ready ordering, non-ready filtering, invalid output handling, and claim-plus-compact composition in store_nodes. This keeps the change default-inert: no background thread, no default-on policy, and no shared store-handle concurrency are introduced.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=store_nodes build/c/test-runner; git diff --check; bash scripts/check-source-safety.sh src/store/store.c src/store/store.h tests/test_store_nodes.c; make -f Makefile.cbm -j8 cbm.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Persist full overlay file delta metadata so ready overlay generations can be promoted into canonical rows without re-running extraction. Store file hashes, file state, imports, exports, and derived-view metadata alongside overlay nodes, edges, and tombstones.
Add cbm_store_compact_overlay_generation() as a manual, default-inert store API. It loads persisted overlay deltas, reuses the canonical delete/publish bodies inside one transaction, marks derived graph views stale, finishes the reserved canonical generation, clears dirty file rows, and removes promoted overlay rows.
Cover both upsert and delete-only compaction paths in store_nodes. Validated with ASan/UBSan test-runner build, store_nodes, pipeline, production cbm build, git diff --check, and focused stdout/string-safety scans. Logs are under /private/tmp/cbm-pan85-overlay-compaction-*20260704T.log.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Record changed git paths in the dirty-file ledger before invoking the watcher index callback so freshness surfaces remain truthful if reindexing is slow or fails.
Reuse the existing git snapshot command plumbing, store project lookup, and project field free helper. Skip ledger writes for watched projects that have not been indexed yet so pre-index watcher tests and users do not get noisy warnings.
Add canaries for failing index callbacks and rename status parsing, including both current and previous paths from git porcelain -z output.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=watcher build/c/test-runner; CBM_ONLY_SUITE=pipeline build/c/test-runner; CBM_ONLY_SUITE=store_nodes build/c/test-runner; make -f Makefile.cbm -j8 cbm. Logs under /private/tmp/cbm-pan82-watcher-dirty-admission-*20260704T.log.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Prune older ready overlay rows for the same project/path after a newer overlay generation publishes successfully. The cleanup deletes overlay FTS rows before relational rows and removes only ready generations that become empty, so multi-file generations retain unrelated file rows.
Add store canaries for single-file generation pruning, path-scoped multi-file preservation, and FTS cleanup of stale overlay tokens.
Validation:
- git diff --check: /private/tmp/cbm-pan82-overlay-retention-diff-check2-20260704T.log
- make -f Makefile.cbm -j8 build/c/test-runner: /private/tmp/cbm-pan82-overlay-retention-test-build-20260704T.log
- CBM_ONLY_SUITE=store_nodes build/c/test-runner: /private/tmp/cbm-pan82-overlay-retention-store-nodes-20260704T.log (98 passed)
- CBM_ONLY_SUITE=pipeline build/c/test-runner: /private/tmp/cbm-pan82-overlay-retention-pipeline-20260704T.log (317 passed)
- bash scripts/check-source-safety.sh: /private/tmp/cbm-pan82-overlay-retention-source-safety-20260704T.log
- make -f Makefile.cbm -j8 cbm: /private/tmp/cbm-pan82-overlay-retention-product-build-20260704T.log
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Apply the existing incremental extract fault hook to the sequential path so small exact-delta runs can exercise the same failure boundary as the parallel path.
Add an opt-in overlay publish canary that injects extract failure before overlay generation reservation, verifies canonical rows remain unchanged, no overlay generations are ready or failed, and the dirty file remains pending rather than overlay_ready.
Validation:
- make -f Makefile.cbm -j8 build/c/test-runner: /private/tmp/cbm-pan82-overlay-extract-failure-test-build3-20260704T.log
- CBM_ONLY_SUITE=pipeline build/c/test-runner: /private/tmp/cbm-pan82-overlay-extract-failure-pipeline2-20260704T.log (317 passed)
- bash scripts/check-source-safety.sh: /private/tmp/cbm-pan82-overlay-extract-failure-source-safety-20260704T.log
- git diff --check: /private/tmp/cbm-pan82-overlay-extract-failure-diff-check3-20260704T.log
- make -f Makefile.cbm -j8 cbm: /private/tmp/cbm-pan82-overlay-extract-failure-product-build-20260704T.log
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a CBM_TEST_FAIL_INCREMENTAL_PHASE value for the overlay producer boundary and share the existing phase-failure helper between incremental and delta code. When injected after overlay generation reservation, the producer marks the overlay generation failed and returns an error.
Add a focused pipeline canary proving opt-in overlay publish failure falls back to canonical exact publish: the changed symbol is present canonically, the failed overlay generation is recorded, no ready overlay generation or reserved canonical generation remains, and dirty rows are cleared after canonical repair.
Validation: initial build failed because the helper included the wrong declaration header; corrected to foundation/platform.h. Final gates: make -f Makefile.cbm build/c/test-runner -j8; CBM_ONLY_SUITE=pipeline build/c/test-runner; bash scripts/check-source-safety.sh; git diff --check; make -f Makefile.cbm cbm -j8.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Extend the existing default-off overlay_publish=small_deltas path to the single-file exact delete route. The route now reuses the overlay file-delta batch producer to publish a tombstone before canonical generation reservation, leaving canonical state untouched and dirty_files marked overlay_ready for active read views.
Keep overlay_publish=off behavior unchanged: canonical exact delete still applies and existing full-rebuild parity coverage remains in place. Add a pipeline canary proving the opt-in delete overlay keeps canonical base rows visible, hides the deleted file through the overlay view, avoids reserved canonical generation leaks, and preserves overlay_ready freshness state.
Validation: make -f Makefile.cbm build/c/test-runner -j8; CBM_ONLY_SUITE=pipeline build/c/test-runner; bash scripts/check-source-safety.sh; git diff --check; make -f Makefile.cbm cbm -j8.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a default-off overlay_publish policy for bounded exact-delta incremental runs. When enabled, eligible non-noop exact deltas publish ready overlay rows and dirty freshness without mutating canonical graph rows, while default canonical behavior remains unchanged.
Use the latest complete canonical generation as the overlay base, avoid reserving a canonical generation for successful overlay publishes, and report incremental_overlay in pipeline telemetry and benchmark parsing.
Add focused store and pipeline canaries for latest complete generation lookup, opt-in overlay visibility, canonical invisibility, dirty overlay_ready state, and absence of stray reserved canonical generations.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add an atomic store batch API for foreground overlay file deltas and keep the existing single-file API as a compatibility wrapper. The batch path validates one-project inputs, writes overlay rows and tombstones in one transaction, and marks the generation ready only after every file succeeds.
Add an internal pipeline producer helper that reserves an overlay generation, publishes existing file-delta facts, and marks dirty freshness as overlay_ready. If publish or freshness marking fails, the helper marks the overlay generation failed so active read views do not expose a misleading generation.
Cover the contract with focused store and pipeline canaries. Store coverage verifies multi-file rollback leaves no partial overlay rows. Pipeline coverage uses existing exact-delta extraction metadata to prove overlay-visible, canonical-invisible, dirty-ready behavior. Production incremental wiring, compaction, and default-readiness remain separate follow-up work.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Full canonical replacement deletes the project row and relies on FK cascade to remove overlay generations and rows, but contentless nodes_fts_overlay is not FK-backed. Remove overlay FTS entries while overlay_nodes still exists so full reindex/project delete cannot leave stale overlay tokens behind.
Cross-check: upstream/main has only canonical project replacement and no overlay tables, so this preserves upstream replacement semantics and adds fork-only derived-view cleanup.
Validation: CBM_ONLY_SUITE=store_nodes make -j8 -f Makefile.cbm test passed 95 tests after the pre-fix canary failed; bash scripts/check-source-safety.sh passed; make -j8 -f Makefile.cbm cbm built and signed; git diff --check passed.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Restore the upstream indexed-file scoped search_code fallback for non-git and file_pattern searches while preserving the fork's git_worktree fast path for active untracked edits.
Filter file_pattern against indexed file paths with sqlite3_strglob, write NUL-separated file lists for safer paths with spaces, and force grep -Hn so single-file scoped searches still produce file:line:content output for the existing parser.
Add a regression canary proving file_pattern searches do not scan unindexed generated files when an indexed file set exists.
Validation: CBM_ONLY_SUITE=mcp make -f Makefile.cbm -j8 test; bash scripts/check-source-safety.sh; make -f Makefile.cbm -j8 cbm; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a separate nodes_fts_overlay FTS5 table for ready overlay node rows and maintain it transactionally with overlay file-delta publishes.
The delete path removes contentless FTS rows before overlay_nodes are deleted, and inserts use the assigned overlay_nodes rowid. search_graph query mode now reads changed-file overlay hits from the overlay FTS table while preserving the canonical nodes_fts fast path for visible base rows.
Validation: CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test; CBM_ONLY_SUITE=mcp build/c/test-runner; bash scripts/check-source-safety.sh; make -f Makefile.cbm -j8 cbm; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
When search_graph has ready overlay rows, tokenless BM25 queries now follow the same fallback behavior as the upstream canonical BM25 path instead of returning an overlay read error.
Add an MCP regression that combines query="!!!" with graph filters while an overlay replacement is ready, proving the graph filter path still returns overlay-active rows.
Validation: CBM_ONLY_SUITE=mcp make -f Makefile.cbm -j8 test; bash scripts/check-source-safety.sh; make -f Makefile.cbm -j8 cbm; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Name relationship_patterns explicitly in the mixed architecture freshness warning so callers do not infer edge-derived summaries are active just because node sections used overlay rows.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=mcp ./build/c/test-runner; bash scripts/check-source-safety.sh; make -f Makefile.cbm -j8 cbm; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Fill cbm_schema_info.rel_patterns from canonical, scoped, and active overlay schema reads using existing edge/node joins and active_edges visibility.
This makes the architecture relationship_patterns field real while preserving the mixed freshness policy for edge-derived summaries.
Validation: make -f Makefile.cbm -j8 build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner; CBM_ONLY_SUITE=mcp ./build/c/test-runner; CBM_ONLY_SUITE=store_arch ./build/c/test-runner; bash scripts/check-source-safety.sh; make -f Makefile.cbm -j8 cbm; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Teach codebase://architecture to reuse the existing architecture store dispatcher for the compact node-only sections that already support active overlay rows: languages, entry_points, and routes. Keep total counts, PageRank key_functions, and relationship_patterns canonical or stale-aware, and report that mixed read model explicitly.
Refactor the shared architecture JSON emitters so get_architecture and the resource use one implementation. Use yyjson string copies because resources/read serializes after the builder returns; ASan caught the borrowed-string UAF during the focused MCP canary.
Upstream compatibility: upstream/main has get_architecture but not this fork resource, and the get_architecture output shape is preserved. Validation: CBM_ONLY_SUITE=mcp 158 passed; CBM_ONLY_SUITE=tool_consolidation 99 passed; CBM_ONLY_SUITE=store_arch 59 passed; bash scripts/check-source-safety.sh OK; git diff --check OK; make -j8 -f Makefile.cbm cbm OK.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add an active schema view with property-key discovery over active overlay nodes and edges, while keeping the existing canonical fallback for get_graph_schema when the active read is unavailable.
Keep codebase://schema on the counts-only path and make freshness metadata distinguish counts-only resources from full schema property reads. Tighten property discovery cleanup and malformed JSON handling.
Validation: build/c/test-runner build; CBM_ONLY_SUITE=store_nodes, mcp, store_search, store_arch; scripts/check-source-safety.sh; git diff --check; make -f Makefile.cbm cbm.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add canonical-only freshness metadata to get_graph_schema when dirty or ready overlay rows exist, preserving existing canonical schema and property-key output.
Add an MCP canary that proves ready overlay replacements are disclosed instead of silently omitted.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Make codebase://schema read ready overlay node labels and edge types when an active overlay generation is available, with canonical counts as the fallback path.
Consolidate schema count array collection for canonical, scoped, and overlay schema count reads so memory ownership and SQLite step handling stay consistent.
Add store and MCP canaries for active schema counts, including stale canonical suppression and freshness metadata.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Make codebase://schema disclose canonical-only freshness when ready overlay rows exist, matching the resource behavior added for codebase://architecture. The schema content remains canonical, while freshness metadata reports the ready overlay/tombstone counts and warning text instead of silently omitting overlay-only labels.
Add an MCP resources/read canary that publishes a ready overlay replacement, verifies the canonical Function schema remains visible, verifies the overlay-only Class label is not reported as canonical schema, and checks canonical_only freshness metadata.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add canonical-only overlay freshness metadata to codebase://architecture when ready overlay rows exist. The resource still returns canonical graph summaries, but now reports the same read-model limitation as graph tools instead of silently omitting ready overlay rows.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Reuse the active overlay node view with an optional SQL LIMIT and apply the same bounded seed limit used by canonical unlabeled Cypher scans. This prevents node-only active query_graph MATCH (n) queries from materializing every active node before max_rows is applied.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Restore the Cypher executor safety ceiling to upstream's 100000 rows and expose the MCP query_graph default as query_max_rows. Explicit max_rows arguments remain caller-authoritative; omitted max_rows uses the config default. Add CLI registry and MCP coverage for the new discoverable default.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add MCP coverage proving ready overlay rows are not used for id() or degree-derived Cypher query_graph shapes. These queries stay canonical until active relationship/id semantics are designed and tested. Also fix stale Cypher header wording for LIMIT and row-ceiling semantics.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a reusable active-overlay node scan helper in the store and expose an opt-in Cypher executor that uses it only for node-only query shapes.
query_graph now reports overlay_active_nodes for supported node-only Cypher when ready overlay tombstones exist. Relationship, EXISTS, degree-derived, id(), and CASE edge-dependent queries remain canonical-only with explicit freshness warnings until active relationship views are designed.
Validation: store_nodes 93 passed; cypher 144 passed; mcp 153 passed; make -j8 -f Makefile.cbm cbm; bash scripts/check-source-safety.sh.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Port the current upstream Cypher fixes before adding any active query_graph overlay behavior.
Preserve explicit LIMIT 0 as an empty result for RETURN and WITH clauses by using a distinct no-limit sentinel. Filter relationship expansion against already-bound terminal variables and drive one-hop optional matches from the bound terminal to avoid broad cross joins and wrong c IS NULL results.
Add focused regression coverage for LIMIT 0 and bound-terminal OPTIONAL MATCH. Validation: CBM_ONLY_SUITE=cypher ./build/c/test-runner (144 passed); CBM_ONLY_SUITE=mcp ./build/c/test-runner (152 passed); make -j8 -f Makefile.cbm cbm; bash scripts/check-source-safety.sh.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Extend get_architecture active overlay coverage to File-node summaries by routing languages and file_tree through the same active node view used for entry_points and routes.
Consolidate node-only architecture SQL construction and binding so canonical nodes and active overlay nodes share one path-scope and limit convention.
Add store and MCP canaries for ready overlay tombstones hiding stale File rows from scoped language and file_tree output.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Make get_architecture entry_points read active overlay node rows when ready overlay tombstones exist, while keeping counts and derived architecture summaries explicitly canonical or stale.
Report read_model=mixed_active_nodes_canonical_summaries with active_sections=[entry_points] so callers can distinguish the active entry-point slice from still-canonical summaries.
Validation: CBM_ONLY_SUITE=store_arch make -j8 -f Makefile.cbm test, 58 passed, log /private/tmp/cbm-pan85-arch-entry-overlay-store-arch-20260703T210121-0400.log.
Validation: CBM_ONLY_SUITE=mcp make -j8 -f Makefile.cbm test, 150 passed, log /private/tmp/cbm-pan85-arch-entry-overlay-mcp-20260703T210121-0400.log.
Validation: make -j8 -f Makefile.cbm cbm, log /private/tmp/cbm-pan85-arch-entry-overlay-product-build-20260703T210121-0400.log.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Report read_model=canonical_only for query_graph and get_architecture when dirty or ready overlay state exists but the handler still reads canonical tables.
Include ready-overlay summary counts for canonical-only paths so callers can see that overlay rows exist but are not included by Cypher or architecture summaries yet.
Validation: CBM_ONLY_SUITE=mcp make -j8 -f Makefile.cbm test, 149 passed, log /private/tmp/cbm-pan84-canonical-only-read-model-mcp-20260703T205047-0400.log. Validation: make -j8 -f Makefile.cbm cbm, log /private/tmp/cbm-pan84-canonical-only-read-model-product-build-20260703T205047-0400.log.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Annotate search_code live-source matches with active overlay node rows when a ready file overlay exists, so changed files no longer inherit stale canonical graph metadata.
Preserve live-source grep behavior and canonical fallback, and dedupe no-id overlay nodes by qualified name/file identity instead of collapsing every overlay node with id 0.
Validation: CBM_ONLY_SUITE=mcp make -j8 -f Makefile.cbm test, 148 passed, log /private/tmp/cbm-pan84-search-code-overlay-mcp-20260703T204143-0400.log. Validation: make -j8 -f Makefile.cbm cbm, log /private/tmp/cbm-pan84-search-code-overlay-product-build-20260703T204143-0400.log.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Make search_graph query mode use the active overlay read model when ready overlay file tombstones exist.
The query path now suppresses canonical BM25 hits from tombstoned files, unions changed-file overlay nodes by bounded node-text matching, and reports overlay_active_nodes freshness metadata. The active overlay CTE builder is shared from the store layer so MCP and store reads use the same tombstone/latest-ready semantics.
Add an MCP regression that proves a fresh overlay symbol appears while the obsolete canonical FTS hit from the same file is hidden. Also refresh status warnings that previously said search/trace stayed canonical.
Validation: CBM_ONLY_SUITE=mcp make -f Makefile.cbm test -> 147 passed; CBM_ONLY_SUITE=store_nodes build/c/test-runner -> 93 passed; make -f Makefile.cbm cbm -> rc 0; git diff --check -> clean.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Teach trace_path function_name resolution to use active overlay node rows when overlay deltas are ready. This adds store-level active qn/name lookups, removes the synthetic no-id qn fallback, and keeps fallback search on the same active read model so tombstoned canonical symbols are not resurrected.
Validation: CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test (/private/tmp/cbm-pan83-overlay-trace-name-store-20260703T2050.log, 93 passed); CBM_ONLY_SUITE=mcp build/c/test-runner (/private/tmp/cbm-pan83-overlay-trace-name-mcp-20260703T2054.log, 146 passed); make -f Makefile.cbm -j8 cbm (/private/tmp/cbm-pan83-overlay-trace-name-product-build-20260703T2055.log); bash scripts/check-source-safety.sh (/private/tmp/cbm-pan83-overlay-trace-name-source-safety-20260703T2055.log).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a store-level qualified-name overlay traversal helper over active node and relationship rows, then wire trace_path qualified_name requests to it when overlay rows are ready. The public trace response shape is unchanged; function_name resolution remains canonical until a separate active-name-resolution slice is designed.
Validation: CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test (/private/tmp/cbm-pan83-overlay-trace-store-20260703T2010.log, 93 passed); CBM_ONLY_SUITE=mcp build/c/test-runner (/private/tmp/cbm-pan83-overlay-trace-mcp-rerun-20260703T2024.log, 146 passed); bash scripts/check-source-safety.sh (/private/tmp/cbm-pan83-overlay-trace-source-safety-rerun-20260703T2024.log); make -f Makefile.cbm -j8 cbm (/private/tmp/cbm-pan83-overlay-trace-product-build-rerun-20260703T2025.log).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Teach search_graph include_connected to use overlay active graph rows when overlay deltas are ready. The store now populates existing connected_names results by qualified name from the active graph, and MCP serialization treats those names as authoritative to avoid leaking stale canonical neighbors.
Validation: CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test (/private/tmp/cbm-pan83-overlay-connected-store-20260703T2231.log, 93 passed); CBM_ONLY_SUITE=mcp build/c/test-runner (/private/tmp/cbm-pan83-overlay-connected-mcp-20260703T2236.log, 146 passed); make -f Makefile.cbm -j8 cbm (/private/tmp/cbm-pan83-overlay-connected-product-build-20260703T2237.log); bash scripts/check-source-safety.sh (/private/tmp/cbm-pan83-overlay-connected-source-safety-20260703T2237.log).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Use the active overlay graph read model for search_graph relationship-only requests while keeping connected-neighbor enrichment on canonical ids until that path is separately implemented.
Add active_edges CTE support to cbm_store_search_overlay_view so relationship filters, entry-point filters, and degree filters can use visible canonical edges plus latest ready owned overlay edges keyed by qualified name.
Make search degree-filter wrapping fail explicitly on allocation or SQL truncation instead of silently truncating generated SQL.
Validation: CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test (/private/tmp/cbm-pan83-overlay-relationship-store-20260703T2043.log, 93 passed); CBM_ONLY_SUITE=mcp build/c/test-runner (/private/tmp/cbm-pan83-overlay-relationship-mcp-20260703T2048.log, 146 passed); make -f Makefile.cbm -j8 cbm (/private/tmp/cbm-pan83-overlay-relationship-product-build-20260703T2048.log); bash scripts/check-source-safety.sh (/private/tmp/cbm-pan83-overlay-relationship-source-safety-20260703T2048.log); git diff --check (/private/tmp/cbm-pan83-overlay-relationship-diff-check-20260703T2048.log).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Wire search_graph graph-mode node searches to cbm_store_search_overlay_view() when ready overlay file tombstones exist and the request does not require relationship/connected edge semantics.
Add freshness.read_model=overlay_active_nodes and overlay count metadata when the active node read model is used. Relationship/connected requests stay canonical with an explicit warning until overlay edge reads are implemented.
Validation: CBM_ONLY_SUITE=mcp make -f Makefile.cbm -j8 test -> /private/tmp/cbm-pan83-overlay-mcp-search-mcp-suite-20260703T1928.log (145 passed); CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test -> /private/tmp/cbm-pan83-overlay-mcp-search-store-suite-20260703T1931.log (92 passed); make -f Makefile.cbm -j8 cbm -> /private/tmp/cbm-pan83-overlay-mcp-search-product-build-20260703T1931.log; bash scripts/check-source-safety.sh -> /private/tmp/cbm-pan83-overlay-mcp-search-source-safety-20260703T1931.log; git diff --check clean.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add cbm_store_search_overlay_view() as an opt-in active node read view over canonical nodes minus ready overlay file tombstones plus owned nodes from the latest ready overlay per changed file.
Refactor canonical search to share the SQL execution, allocation, scan, cleanup, and error path with the new overlay search primitive. Default search_graph/search_code/query behavior remains unchanged.
Tests cover canonical fallback with no ready overlay and a full-rebuild oracle comparison where old rows are hidden, stable rows remain visible, latest overlay rows win, non-canonical overlay ids stay zero, and the degree-filter SQL wrapper is exercised.
Validation: CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test -> /private/tmp/cbm-pan83-overlay-search-store-suite-20260703T1910.log (92 passed); CBM_ONLY_SUITE=mcp make -f Makefile.cbm -j8 test -> /private/tmp/cbm-pan83-overlay-search-mcp-suite-20260703T1914.log (144 passed); make -f Makefile.cbm -j8 cbm -> /private/tmp/cbm-pan83-overlay-search-product-build-20260703T1915.log; bash scripts/check-source-safety.sh -> /private/tmp/cbm-pan83-overlay-search-source-safety-20260703T1915.log; git diff --check clean; isolated dogfood index/search artifacts under /private/tmp/cbm-pan83-overlay-search-dogfood-*.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Expose overlay_read_view counts on index_status and codebase://status when ready overlay tombstones exist, while keeping canonical nodes/edges counts unchanged.
Warn that search and trace remain canonical until overlay-aware tools are enabled, so callers do not mistake status visibility for query behavior.
Validation: CBM_ONLY_SUITE=mcp make -f Makefile.cbm -j8 test -> /private/tmp/cbm-pan83-overlay-status-mcp-suite-20260703T1908.log (144 passed); CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test -> /private/tmp/cbm-pan83-overlay-status-store-suite-20260703T1914.log (90 passed); make -f Makefile.cbm -j8 cbm -> /private/tmp/cbm-pan83-overlay-status-product-build-20260703T1914.log; bash scripts/check-source-safety.sh -> /private/tmp/cbm-pan83-overlay-status-source-safety-20260703T1914.log; git diff --check -> /private/tmp/cbm-pan83-overlay-status-diff-check-20260703T1912.log.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add cbm_store_find_nodes_by_file_overlay_view(), a bounded file-scoped helper that returns canonical nodes unless a ready overlay tombstone exists, then returns owned nodes from the latest ready overlay for that file.
Overlay rows are returned with id=CBM_STORE_NO_NODE_ID because overlay row ids are not canonical graph node ids. The helper shares the existing node scan/allocation path and keeps default query behavior unchanged.
Validation: CBM_ONLY_SUITE=store_nodes make -f Makefile.cbm -j8 test (90 passed); CBM_ONLY_SUITE=sqlite_writer make -f Makefile.cbm -j8 test (10 passed); make -f Makefile.cbm -j8 cbm; bash scripts/check-source-safety.sh; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>