When search_graph is called on a fresh server with project set to a list_projects slug, resolve_store opened the correct DB but left session_project empty. The first response then injected an empty _context even though results came from the indexed project.
Sync session metadata from the opened project DB only when the session is unset, reuse the existing parent-project DB routing for dependency projects, and share the absolute root-path guard with watcher registration.
Tests: failed-first search_graph_slug_project_sets_session_context, CBM_ONLY_SUITE=tool_consolidation, CBM_ONLY_SUITE=mcp, scripts/check-source-safety.sh, scripts/test-source-safety.sh, git diff --check, make -j8 -f Makefile.cbm cbm.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Compute each edge's LinkRank value once and reuse it for both the persisted linkrank row and node_degree.linkrank_in accumulation.
This keeps ranking linear in edges but removes the duplicate edge scan and duplicate formula evaluation in the post-PageRank phase. The node_degree path still works independently if the linkrank insert statement cannot be prepared.
Add a regression test that compares node_degree.linkrank_in with the sum of incoming persisted LinkRank rows.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pagerank ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Wire the rank_scope config value into cbm_pagerank_compute_with_config so config-backed PageRank and LinkRank can select full, project, or dependency scope.
Keep the default as full to preserve existing project-plus-dependency behavior, and clear the full project/dependency rank prefix before writing any narrower scope because the rank tables do not persist scope.
Update the config registry wording and add a regression test for full-to-project stale-row cleanup, invalid-scope fallback, and config temp-dir cleanup.
Validation: git diff --check; bash scripts/check-source-safety.sh; CBM_ONLY_SUITE=pagerank ./build/c/test-runner; CBM_ONLY_SUITE=cli ./build/c/test-runner; make -j8 -f Makefile.cbm build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Keep the shared LSP override index semantically aligned with the linear resolver. C++ textual callees using :: or -> now match dotted LSP QNs, and allowed original-text reason joins cover function-pointer and implicit-call strategies without falling off the indexed fast path.
Use the project cbm_strdup compatibility wrapper for indexed keys and retain the existing incomplete-index fallback to the linear helper when key allocation or formatting fails.
Add focused parallel-suite tests for C++ segment matching, reason-gated joins, indexed/linear parity, and overlong-key fallback.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=parallel ./build/c/test-runner; CBM_ONLY_SUITE=c_lsp ./build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Port the upstream Python/Kotlin builtin target fixes and the Windows ARM64 stdlib include onto the fork branch. Python call extraction now keeps keyword-filtered builtins only when the generated stdlib data provides real LSP target nodes, so LSP-resolved builtin calls can form CALLS edges. Kotlin now injects kotlin.Any plus toString/equals/hashCode target definitions before graph minting so lsp_kt_any edges point at real nodes. compat.h includes stdlib.h directly for getenv/_putenv_s declarations on stricter Windows toolchains.
Focused validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=extraction ./build/c/test-runner; CBM_ONLY_SUITE=kotlin_lsp ./build/c/test-runner; CBM_ONLY_SUITE=grammar_labels ./build/c/test-runner; CBM_ONLY_SUITE=platform ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Port the upstream deny-wins-by-value behavior for infra URL route extraction so upstream/config/healthcheck URLs cannot be re-minted by duplicate string refs with less specific key paths.
Preserve the fork's manifest skip and existing route-literal filtering, use the existing hash table and logging paths, and add an integrated pipeline canary that keeps a positive push_endpoint route while rejecting registry and healthcheck URLs.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (284 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Use the existing exact-delta planner and store delete publisher for the narrow safe case of one deleted file, no changed files, and FAST-or-lighter indexing. Rejected delete shapes continue to fall back before graph mutation or full publish.
Add a focused pipeline regression that deletes an isolated file, proves a completed positive generation was published, and compares the result against a fresh FAST rebuild.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (283 passed); CBM_ONLY_SUITE=incremental ./build/c/test-runner (160 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Replace all-caps INSTEAD OF language in MCP tool descriptions with precise preference wording. This keeps the guidance actionable without overstating behavior or changing any tool names, schemas, or dispatch paths.
Extend the tool-consolidation regression to check both streamlined and classic tool lists for this wording.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Clarify that graph-backed default tools can trigger first-use auto-indexing, while search_code searches source for an already indexed/current project. Align MCP schemas, installed CLI guidance, and SessionStart reminders with the actual handler paths.
Add a tool-consolidation regression so future schema/help text does not claim all default tools auto-index.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a shared git snapshot provider for HEAD, dirty worktree hash, and tracked file count. The provider uses the existing portable command fallback, streams status output with O(1) buffer memory, keeps clean trees unambiguous, and supports non-git fallback without changing incremental defaults.
Migrate watcher polling to the provider with flags so baseline still avoids dirty-status work, normal polls check HEAD plus dirty state, and post-index refresh updates HEAD, dirty hash, and file count together.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=watcher ./build/c/test-runner. Pipeline suite also passed after adding git_snapshot to the shared test runner link before the final dirty-hash clean-state tweak.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Centralize git command formatting, path validation, null-device selection, first-line capture, and command-size checks for git context and watcher code.
This keeps the current command fallback behavior, makes Windows shell metacharacter handling consistent, replaces a touched watcher strdup path with cbm_strdup, and prepares the next git snapshot/pre-discovery acceleration slice without adding a new default route.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=watcher ./build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Remove git_context.c's private strdup helper and replace literal command/output buffer sizes with CBM-prefixed constants backed by the repository size constants.
This is a prerequisite cleanup for a future shared git snapshot boundary; it does not change command syntax, dependencies, pipeline routing, stdout/stderr behavior, or default incremental behavior.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (282 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Centralize pipeline DB path formatting through a bounded CBM_PATH_MAX helper reused by incremental routing and full-dump persistence. The full dump path now fails before mkdir or SQLite dump when the DB path or parent directory cannot be represented, rather than truncating into a different destination.
Use cbm_strdup and the existing cbm_mkdir_p portability wrapper, preserve normalized forward-slash cache paths, and mirror the CLI parent-dir backslash handling for explicit Windows-style DB paths.
Add a focused pipeline regression that builds an overlong explicit DB path and verifies the truncated prefix file is not created.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (282 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Centralize watcher git command formatting so every cbm_popen path validates the root path and checks snprintf truncation before executing.
Reject watch roots that cannot fit the core git commands instead of accepting a path that would later be truncated. Keep POSIX submodule dirty hashing best-effort, so optional submodule probing does not block the portable parent-repo watcher path.
Add a focused watcher regression for an overlong but shell-safe path and validate with source-safety, a forced test-runner rebuild, and CBM_ONLY_SUITE=watcher.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Hash-confirm same-size mtime drift against current file_state metadata before marking a file changed. When a touch-only drift is verified, refresh file_hash metadata on the no-op path so later runs return to metadata-only classification.
Keep missing legacy file_state rows on the existing compatibility path for metadata-equal files, but fail closed for mtime drift without current content metadata. Add a regression covering generation stability and refreshed mtime storage.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner; CBM_ONLY_SUITE=incremental ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
query_graph warned on stale route-derived data only when the Cypher text named Route or route edge types. Broad queries can still return Route rows without spelling those terms, so they could expose stale route-derived graph data without a warning.
Scan the already-materialized Cypher result for returned .label columns containing Route and reuse the existing structured warning path. This does not add stdout/stderr output or change query execution.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=mcp ./build/c/test-runner (129 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
SvelteKit filesystem routes are derived from a concrete File node, but the route pass inserted those Route nodes without file_path ownership. That kept them outside exact file-delta cleanup and owner metadata even though decorator and gRPC route nodes are file-owned.
Pass the source File node path through the existing route upsert helper and add an infrascan canary that proves the generated Route keeps the source file path and HANDLES edge.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=infrascan ./build/c/test-runner (8 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Maintain contentless nodes_fts entries inside file-delta publish/delete transactions so BM25 search sees exact-delta node replacements without waiting for a full FTS rebuild.
The delete path uses SQLite FTS5's contentless delete command before removing old nodes, skips absent FTS tables for no-FTS builds, and only deletes rowids already present in nodes_fts to preserve legacy/test stores.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Return a structured search_graph warning when callers read route-derived graph data through label=Route or route-derived relationship filters and the routes derived view is stale.
This reuses the existing route-derived query vocabulary and adds a focused MCP canary for the direct Route-label search path.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Use the store module's heap_strdup helper instead of raw strdup when materializing vector search results. Only publish a result row after all copied strings succeed, and return CBM_STORE_ERR with cleanup on allocation failure instead of exposing a partially initialized row.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_search ./build/c/test-runner (69 passed); CBM_ONLY_SUITE=mcp ./build/c/test-runner (126 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Raise the live FAST exact-delta changed-file cap to two after the batch publish path gained same-generation node-before-edge ordering. Convert the former two-file fallback fixture into a production-route exact parity test, and add a three-file fixture that proves larger batches still fall back before publish and match a fresh FAST rebuild.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (277 passed); CBM_ONLY_SUITE=incremental ./build/c/test-runner (160 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Make batch file-delta publish order-independent for same-generation deltas by splitting the existing single-file publish body into reusable delete, node, edge, and metadata phases. Batch publish now deletes old rows for every file, inserts all new nodes, then inserts edges and metadata, so forward references to nodes from later deltas resolve inside the same transaction.\n\nAdd a two-file FAST exact-delta regression that publishes main.go before helper.go and compares the resulting database with a fresh FAST rebuild. The test helper now runs the postpasses needed for canonical node-property parity.\n\nValidation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (276 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Multi-file exact upsert was parity-unsafe: a two-file Go batch could miss a cross-file package-name USAGE edge compared with a fresh FAST rebuild. Limit live exact upsert to one changed file through a named constant and let larger batches fall through to the existing containment path before publish.
Keep the single-file exact path aligned with the full sequential pass order by carrying a per-file result cache and running lsp_cross before calls/usages only when that cache exists. Add parity coverage for the single-file exact path and for multi-file fallback to a fresh FAST rebuild.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (274 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Wire a conservative exact-upsert route for opt-in incremental FAST/DEP runs after classification and before the existing full graph load/redump path. The route reuses the existing scratch seed, extraction, descriptor metadata, batch planner, generation reservation, stamp, and publish APIs, and it falls back before publish for deletes, global-derived modes, oversized frontiers, planner rejection, or scratch/pass failures.
Add focused pipeline coverage for a safe isolated-file exact upsert with a positive generation and for FULL mode remaining on the containment path. Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (273 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Seed Project, Branch, and Folder nodes into exact-delta scratch graphs so changed-file structure can regenerate the same containment endpoints that full indexing created. This avoids false fallback for ordinary Branch-to-File and Folder-to-File structure without publishing any production route by itself.
Add a focused pipeline regression for Branch-to-File containment: changed file nodes stay excluded from scratch, structure roots are available, descriptor generation emits the exact CONTAINS_FILE tuple, and planner accepts it as an exact candidate.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (271 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add an internal helper that stamps a reserved positive generation onto an exact file-delta descriptor after preflight planning and before publish. The helper preserves the store API const contract by copying any attached file-state into descriptor-owned storage before handing it to publish.
Add focused pipeline tests for invalid zero generation, metadata stamping, and the plan-reserve-stamp-apply route so the live exact-delta path can keep provisional generation 0 during planning without publishing generationless deltas.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (270 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Keep plan-only exact-delta candidates usable with provisional generation zero, but make apply_file_delta_batch fail closed with missing_generation before calling the store publish path.
Add a focused regression for generation-zero apply attempts while preserving the existing publish_error coverage for positive but unreserved generations.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Route both delete-file-delta public APIs through one internal transaction helper so rollback, stale-derived-view marking, and optional generation completion cannot drift.
Keep the existing caller-visible validation behavior: cbm_store_delete_file_delta_complete still requires a positive reserved generation, while cbm_store_delete_file_delta keeps its existing argument contract.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add edge owner paths to inbound-edge metadata so the file-delta planner can distinguish source-node ownership from edge cleanup ownership.
Add cbm_store_delete_file_delta_complete(), reusing the existing delete body while completing the reserved generation in the same SQLite transaction.
Allow only single-file exact delete candidates with a positive generation, existing ownership, inbound-edge safety, and complete affected frontier. apply_file_delta_batch now fails closed with frontier_requires_batch when affected paths are not all included in the supplied batch.
Rename and new-folder exact routing remain fallback/design tasks; production live exact routing remains unwired/default-off.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner; CBM_ONLY_SUITE=incremental ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Emit regenerated CONTAINS_FILE edges from the file-delta descriptor when the edge targets the changed File node. This keeps the rule graph-semantic and language-independent while leaving new folder creation fallback-only through normal endpoint resolution.
Update the structural exact-delta fixture to model edge ownership, prove descriptor/planner acceptance, publish the delta, and verify duplicate structural edges are not left behind.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add an internal store query that returns exact inbound edge tuples and owner paths for file-delta preflight.
Use it in the exact-delta planner so unowned structural CONTAINS_FILE edges are accepted only when the candidate regenerates the same source, target, and type tuple. Existing realistic full-pipeline structure still falls back when the descriptor omits that edge; live exact-delta routing remains unwired.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Make owner rebuild treat a rel_path as file-owned only when a File node exists for that path. Full-pipeline Folder nodes can carry directory paths in file_path, and those paths must not become exact-delta node or edge owners.
Expand the owner rebuild regression to cover Function, File, and Folder nodes, including a Folder -> File structural edge. Validated with diff check, source-safety, test-runner rebuild, store_nodes, pipeline, and incremental suites.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Replace raw strdup calls in the incremental inbound-edge snapshot with cbm_strdup so the touched path follows the repository portability wrapper convention. Add a source-safety diff guard and self-test that reject newly introduced raw strdup calls in production code without failing historical existing uses.
Validation: git diff --check; make -j8 -f Makefile.cbm build/c/test-runner; make -f Makefile.cbm lint-source-safety; CBM_ONLY_SUITE=pipeline ./build/c/test-runner; CBM_ONLY_SUITE=incremental ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Normal full indexing persisted file_state for future incremental runs but did not populate node_owners or edge_owners, so the exact-delta planner always failed its existing-ownership precondition on real stores. Add a set-based SQLite rebuild helper and call it only when incremental_reindex is enabled, preserving default full-index overhead.
Add store and pipeline regressions covering graph-derived owner rows and the enabled full-index path. Validation: git diff --check; scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner; CBM_ONLY_SUITE=incremental ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add an explicit-fingerprint variant of the file-delta metadata helper so future exact-delta publishes can persist the same effective mode/threshold fingerprint used by full and containment incremental paths. Keep the existing helper as a compatibility wrapper around the static default fingerprint.
Add a focused regression that formats an effective fingerprint through the shared formatter and verifies it is attached to file_state metadata.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner; CBM_ONLY_SUITE=incremental ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Include effective index mode and pipeline thresholds in the file_state pass fingerprint used by full and containment incremental indexing. Metadata-equal files now remain unchanged only when content hash and effective pass/config fingerprint both match, so mode or threshold changes fail closed instead of returning a stale no-op.
The fingerprint encodes threshold doubles by raw bits rather than locale-sensitive decimal formatting. Missing file_state rows remain legacy-compatible. No live exact-delta route or incremental default behavior is enabled by this change.
Validated with: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner; CBM_ONLY_SUITE=incremental ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Append response-level warnings for stale semantic and architecture-derived data without writing to stdout or stderr. Reuse one warning helper so multiple warnings share the same JSON array, and suppress PageRank-backed key_functions when PageRank is explicitly stale.
Replace the vector search prepare-time stderr diagnostic with the store error buffer pattern. Validated with: make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=mcp ./build/c/test-runner; bash scripts/check-source-safety.sh; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Mark project-wide graph-derived views stale inside the same store transaction as exact file-delta publish/delete operations. Keep nodes_fts as the per-file derived view slot while PageRank, LinkRank, node_degree, semantic_edges, routes, and architecture are invalidated together after canonical graph changes.
Add focused store coverage for single publish, batch-complete publish, multifile publish, and delete stale marking. Validated with: make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner; CBM_ONLY_SUITE=store_search ./build/c/test-runner; CBM_ONLY_SUITE=mcp ./build/c/test-runner; bash scripts/check-source-safety.sh; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add derived-view freshness flags to store search and traversal results, and use the existing derived_view_state store APIs to suppress explicitly stale PageRank, LinkRank, and node-degree acceleration. Missing freshness rows remain legacy-compatible so old DBs keep their existing rank output.
Mark PageRank, LinkRank, and node-degree views complete after successful rank-table writes using the named unknown-generation constant when no index generation is available. MCP search_graph and trace_path now return structured warnings when stale derived rankings are ignored, without writing protocol-breaking stdout/stderr.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_search ./build/c/test-runner; CBM_ONLY_SUITE=pagerank ./build/c/test-runner; CBM_ONLY_SUITE=mcp ./build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a reusable cbm_derived_view_state_t reader and free helper for the derived_view_state ledger. This gives search, traversal, MCP, and future exact-delta routing one store-level read path instead of duplicating SQL.
Extend the store freshness regression to verify stale state reads, complete-state replacement reads, and missing-state behavior after an invalid status write is rejected.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner (76 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add named derived-view constants plus reusable store APIs for setting one derived-view state and marking multiple views stale in one transaction. This supports the exact-delta freshness plan without enabling live exact-delta routing or changing query semantics.
Update tests to cover stale batch marking, complete-state replacement, invalid status rejection, and zero-view no-op behavior. Replace the unsupported PageRank planner test literal with the shared derived-view constant.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -B -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner (76 passed); CBM_ONLY_SUITE=pipeline ./build/c/test-runner (256 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Use compatible file_state content hashes to verify files whose legacy mtime+size metadata is unchanged, so same-size rewrites with preserved timestamps are detected instead of treated as no-ops.
Keep old databases compatible: when no file_state row exists, the classifier retains the existing file_hashes metadata path. Store/query or hash failures fail closed by classifying the file as changed.
This does not enable incremental indexing by default and it does not claim a performance win. Metadata-different files still use the fast stat path; metadata-equal files with file_state now pay a content-hash confirmation cost until later ctime/git/status candidate narrowing is designed and measured.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (255 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Persist compatible file_state rows from full indexes and non-noop containment incremental publishes using the shared content-hash helper. Keep no-op incremental runs on the existing fast path and use generation 0 as named compatibility metadata until exact-delta generations are active.
Also make full-path file_hash persistence fail closed on delete/upsert/commit errors before file_state is written, matching the incremental metadata policy more closely.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (253 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Expose the existing exact-delta XXH3 file hash helper through the internal pipeline API and have file-delta metadata use the shared helper. This prepares changed-file discovery work without changing incremental routing or default indexing behavior.
Add a focused pipeline regression proving direct helper output matches file_state.content_hash exactly, so future classifier work cannot drift into a second hash format.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a transactional store primitive for deleting all canonical graph and freshness metadata owned by one file. The helper removes owned nodes and edges, owner rows, symbol exports, import refs, file hashes, and file state, then optionally marks a derived view stale for the delete generation.
This is store-layer groundwork only: pipeline delete and rename routing still fail closed until changed-file discovery and affected-frontier coverage are complete.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Replace the plain cbm_init() static guard with a C11 atomic one-shot state machine so parallel extraction callers wait for allocator/library initialization instead of racing the guard.
Make the macOS mach timebase cache use the same release/acquire publication pattern while leaving the Linux, BSD, and Windows timing paths unchanged.
Add a parallel cbm_init() idempotence regression registered first in the parallel suite.
Validation: make -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=parallel ./build/c/test-runner; CBM_ONLY_SUITE=platform ./build/c/test-runner; bash scripts/check-source-safety.sh; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>