fix(mcp): ignore ::missed shadow rows when resolving a db's project name#1046
Open
metehanulusoy wants to merge 1 commit into
Open
fix(mcp): ignore ::missed shadow rows when resolving a db's project name#1046metehanulusoy wants to merge 1 commit into
metehanulusoy wants to merge 1 commit into
Conversation
The miss-graph pass inserts a second `projects` row ("<name>::missed")
so its nodes satisfy the FK on nodes.project. Since DeusData#704,
db_internal_project_name required the projects table to hold exactly
one row, so any project with a miss graph vanished from list_projects
and the graph UI, and the fallback-scan resolve path failed — the
index looked empty while fully present.
Filter out internal shadow rows (names containing "::") and require
exactly one primary row instead. Adds a reproduce-first regression
test modeled on the DeusData#704 fixture (red on the old code: 150 passed,
1 failed; green with the fix: 151 passed).
Fixes DeusData#1044
Signed-off-by: metehanulusoy <ulusoy.metehan03@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 task
|
Independent large-cache validation confirms this root cause: 500 valid project databases were present, 334 carried a derived |
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.
Fixes #1044
Problem
Any project whose db carries a
<name>::missedshadow row — created by the miss-graph pass for projects with at least one parse/index failure, i.e. most real-world repos — vanished fromlist_projectsand the graph UI, and the fallback-scan resolve path failed. Directly-addressed tools kept working, which made the failure look like "nothing is indexed" while the index was fully present.Root cause (details in the issue): since #704,
build_project_json_entryandresolve_store_fallback_scanderive the db's internal name viadb_internal_project_name, which required the per-dbprojectstable to hold exactly one row (n == 1). The miss-graph pass adds a second row (<name>::missed, needed for the FK onnodes.project), son == 2and the whole db was skipped as "ghost / unreadable". The comment instore.cstill claims the shadow row is "invisible to list_projects" — that stopped being true when #704 made listing key on this table.Fix
db_internal_project_namenow ignores internal shadow rows (names containing::) and requires exactly one primary row. Shadow rows keep satisfying the FK, never surface in listings, and no longer make the primary project unresolvable.Test
tool_list_projects_ignores_missed_shadow_issue1044intests/test_mcp.c, modeled on the #704 reproduce-first fixture (isolatedCBM_CACHE_DIR, db built viaissue704_make_db, shadow row added exactly the way the miss-graph pass does):list_projectsstill advertises the primary project while the shadow row exists — RED before this fix (verified:150 passed, 1 failedon unpatched code), GREEN after (151 passed);search_graphon the project still resolves and returns its node.scripts/test.sh(ASan+UBSan) passes locally on macOS arm64.clang-format --dry-runreports zero warnings on the changed hunks (the 3 pre-existing warnings attests/test_mcp.c:967-968are untouched, unrelated lines); cppcheck clean. clang-tidy was not available locally — relying on CI for that layer.🤖 Generated with Claude Code