fix(cross-repo): fail explicitly when zero target projects resolve (#1133) - #2318
Merged
Merged
Conversation
…1133) A cross-repo-intelligence run whose targets resolved to nothing but the source project -- a self-only target list, or ["*"] in a store that holds only the source -- returned status "success" with projects_scanned:0. That output is indistinguishable from "these services share no routes", which is exactly the silent-zero result #1133 reports. Worse, the run had already passed the pre-write validation and went on to delete the source's existing CROSS_* edges, with no target to rebuild them from. Root cause: cbm_cross_repo_match_cancellable validated that every resolved target exists but never checked that at least one resolved target differs from the source; the self entry was only skipped later, inside the match loop, after delete_cross_edges had run. Count the non-self targets during validation and fail before any write when there are none, with a new result flag (no_targets) so the MCP/CLI frontend reports a specific error ("resolved zero target projects ... existing cross-repo edges were left unchanged") and exits non-zero. The other halves of #1133 are already resolved on main: the --target-projects '["*"]' flag form has parsed as a JSON array since 1a34255 (guarded here by an index_repository-specific CLI test), and cross-repo mode has run in-process ahead of the index supervisor since 0e00ef5, so a cross-repo request can no longer surface the contained worker-crash envelope with a 0-byte log (worker-log survival: 87717b0). Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The no_targets early return added a second raw free(project) next to the existing result.failed one, growing src/mcp/mcp.c past its memory-core ratchet (784 -> 785). Fold both into one branch that picks the message; no_targets still takes precedence and both texts are unchanged. 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.
A cross-repo-intelligence run whose targets resolved to nothing but the
source project -- a self-only target list, or [""] in a store that holds
only the source -- returned status "success" with projects_scanned:0.
That output is indistinguishable from "these services share no routes",
which is exactly the silent-zero result #1133 reports. Worse, the run had
already passed the pre-write validation and went on to delete the source's
existing CROSS_ edges, with no target to rebuild them from.
Root cause: cbm_cross_repo_match_cancellable validated that every resolved
target exists but never checked that at least one resolved target differs
from the source; the self entry was only skipped later, inside the match
loop, after delete_cross_edges had run.
Count the non-self targets during validation and fail before any write
when there are none, with a new result flag (no_targets) so the MCP/CLI
frontend reports a specific error ("resolved zero target projects ...
existing cross-repo edges were left unchanged") and exits non-zero.
The other halves of #1133 are already resolved on main: the
--target-projects '["*"]' flag form has parsed as a JSON array since
1a34255 (guarded here by an index_repository-specific CLI test), and
cross-repo mode has run in-process ahead of the index supervisor since
0e00ef5, so a cross-repo request can no longer surface the contained
worker-crash envelope with a 0-byte log (worker-log survival: 87717b0).
Fixes #1133