CodeWiki icon indicating copy to clipboard operation
CodeWiki copied to clipboard

save_module_tree silently orphans components with no matching IDs

Open LiberiFatali opened this issue 3 months ago • 0 comments

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_order yields 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:

  1. Validate each component_id against the analysis component index.
  2. Report unmatched/missing IDs in the response (count + list), e.g., {"status": "saved", "module_count": N, "unmatched_ids": [...]}.
  3. 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.

LiberiFatali avatar Aug 05 '26 10:08 LiberiFatali