Skip to content

fix(cross-repo): a pre-#768 store no longer aborts ["*"] or wipes edges (#2133) - #2343

Merged
DeusData merged 1 commit into
mainfrom
fix/issue-2133
Sep 30, 2026
Merged

DeusData merged 1 commit into
mainfrom
fix/issue-2133

Conversation

@DeusData

Copy link
Copy Markdown
Owner

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 (only cr_project_exists) alongside #2318 and #2319, in different hunks. Open design points (a "not run yet" signal for linked_projects; listing skipped legacy stores in the ["*"] response) are left for the maintainer.

…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>
@DeusData
DeusData merged commit 6746f43 into main Sep 30, 2026
41 checks passed
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>
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