Skip to content

fix(mcp): ignore ::missed shadow rows when resolving a db's project name#1046

Open
metehanulusoy wants to merge 1 commit into
DeusData:mainfrom
metehanulusoy:fix/missed-shadow-project-listing
Open

fix(mcp): ignore ::missed shadow rows when resolving a db's project name#1046
metehanulusoy wants to merge 1 commit into
DeusData:mainfrom
metehanulusoy:fix/missed-shadow-project-listing

Conversation

@metehanulusoy

Copy link
Copy Markdown

Fixes #1044

Problem

Any project whose db carries a <name>::missed shadow row — created by the miss-graph pass for projects with at least one parse/index failure, i.e. most real-world repos — vanished from list_projects and 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_entry and resolve_store_fallback_scan derive the db's internal name via db_internal_project_name, which required the per-db projects table to hold exactly one row (n == 1). The miss-graph pass adds a second row (<name>::missed, needed for the FK on nodes.project), so n == 2 and the whole db was skipped as "ghost / unreadable". The comment in store.c still 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_name now 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_issue1044 in tests/test_mcp.c, modeled on the #704 reproduce-first fixture (isolated CBM_CACHE_DIR, db built via issue704_make_db, shadow row added exactly the way the miss-graph pass does):

  • A: list_projects still advertises the primary project while the shadow row exists — RED before this fix (verified: 150 passed, 1 failed on unpatched code), GREEN after (151 passed);
  • B: the shadow name is never advertised;
  • C: search_graph on the project still resolves and returns its node.

scripts/test.sh (ASan+UBSan) passes locally on macOS arm64. clang-format --dry-run reports zero warnings on the changed hunks (the 3 pre-existing warnings at tests/test_mcp.c:967-968 are untouched, unrelated lines); cppcheck clean. clang-tidy was not available locally — relying on CI for that layer.

🤖 Generated with Claude Code

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>
@tmonestudio

Copy link
Copy Markdown

Independent large-cache validation confirms this root cause: 500 valid project databases were present, 334 carried a derived ::missed row, and the unpatched listing returned exactly 166 projects. Filtering the shadow restored all 500 primary projects without changing the databases. An equivalent local fix passed the MCP suite (145 passed, 6 platform-specific skips). Thanks for the focused fix..

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.

Projects with a ::missed shadow row vanish from list_projects and the graph UI

2 participants