CodeWiki
CodeWiki copied to clipboard
save_module_tree silently orphans components with no matching IDs
Labels: bug, mcp
Context
codewiki_save_module_tree takes a JSON module tree where each leaf lists component_ids (form file_path::ComponentName). The IDs are used verbatim.
Observed behavior
- A single typo or drift (e.g., after re-analysis, changes a
file_path::ComponentName) causes the component to no longer match any node index entry, but the call still returns success (module_count: N). - The mismatch is only discoverable indirectly:
codewiki_get_processing_orderyields a list that silently omits the mismatched components, so some components are never documented, and the user isn't told. - Components that match no module are excluded from every module's docs without indication.
Suggested fix On save:
- Validate each component_id against the analysis component index.
- Report unmatched/missing IDs in the response (count + list), e.g.,
{"status": "saved", "module_count": N, "unmatched_ids": [...]}. - Optionally warn if components exist in the index but are not assigned to any module (leftover coverage gap).
Expected behavior
save_module_tree should be able to fail loudly (or at least surface a warning) when the tree references unknown components, so gaps are caught before docs are generated.
Impact of not fixing Silent documentation gaps on large repos; hard to audit coverage after the fact.