fix(cross-repo): a pre-#768 store no longer aborts ["*"] or wipes edges (#2133) - #2343
Merged
Merged
Conversation
…es (#2133) cross-repo-intelligence with target_projects ["*"] failed with "cross-repo source or target project is missing, invalid, or not indexed" while naming the same live targets worked. Root cause: the wildcard enumerator and the pre-write validation both used cr_project_exists(), which only does a read-only open plus the exact-project check. A store indexed before the #768 edges.local_name_gen column passes that (it still serves queries, so list_projects shows it), but the matcher's read-write open (store init_schema) refuses it until a reindex. One such legacy store anywhere in the cache therefore made every ["*"] run fail, and it failed only after delete_cross_edges() had already removed the source's previous CROSS_* generation, so a failed run was also destructive. Fix: the #768 probe moves into cbm_store_edges_schema_current() (init_schema now calls it too, one definition), and cr_project_exists() additionally requires it. The wildcard skips a legacy store (logged as cross_repo.project_unusable with the project name); naming one still fails, but during validation, before any write. The probe is read-only, so the legacy store is left untouched for its reindex. Refs #2133 Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This was referenced Sep 25, 2026
DeusData
added a commit
that referenced
this pull request
Sep 30, 2026
Two follow-ups to the #2133 wildcard fix, both about what cross-repo intelligence tells the caller. 1. "Never run" vs "ran, no links". An empty CROSS_* set used to mean either one, and no output surface could tell them apart. Every run now records a marker in the SOURCE store's store_meta (key cross_repo_last_run:<project>, same per-project key pattern as coverage_shadow_fp:<project>) once the previous CROSS_* generation has been cleaned: last_run_at, outcome (complete|cancelled|failed), targets, projects_scanned, total_cross_edges, skipped_projects. index_status and the UI layout (next to linked_projects) now carry a `cross_repo` object: {"status":"never_run"} or {"status":"ran", ...}. The marker lives beside the edges it describes, so a reindex that rebuilds the store drops both together. No new database files and no new freshness key. New store API cbm_store_meta_get/put. put seeds a missing store_meta through the generation path, because creating the table without db_uid/mutation_gen would make cbm_store_generation() report malformed metadata. 2. ["*"] skips a pre-#768 store (since #2343) but only logged it. The result now names each one, and the MCP response lists them: skipped_projects: [{name, reason:"pre_768_schema", hint:"reindex this project"}] (only emitted when non-empty). The cross_repo.project_unusable log line is unchanged. cr_project_exists() is split into cr_project_state() (usable / missing / legacy) so that the enumerator can tell a legacy store apart from a foreign .db file. New allocations go through mem_core. Refs #2133 Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.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.
cross-repo-intelligence with target_projects ["*"] failed with "cross-repo
source or target project is missing, invalid, or not indexed" while naming
the same live targets worked.
Root cause: the wildcard enumerator and the pre-write validation both used
cr_project_exists(), which only does a read-only open plus the exact-project
check. A store indexed before the #768 edges.local_name_gen column passes
that (it still serves queries, so list_projects shows it), but the matcher's
read-write open (store init_schema) refuses it until a reindex. One such
legacy store anywhere in the cache therefore made every [""] run fail, and
it failed only after delete_cross_edges() had already removed the source's
previous CROSS_ generation, so a failed run was also destructive.
Fix: the #768 probe moves into cbm_store_edges_schema_current() (init_schema
now calls it too, one definition), and cr_project_exists() additionally
requires it. The wildcard skips a legacy store (logged as
cross_repo.project_unusable with the project name); naming one still fails,
but during validation, before any write. The probe is read-only, so the
legacy store is left untouched for its reindex.
Refs #2133
Touches
src/pipeline/pass_cross_repo.c(onlycr_project_exists) alongside #2318 and #2319, in different hunks. Open design points (a "not run yet" signal forlinked_projects; listing skipped legacy stores in the["*"]response) are left for the maintainer.