Skip to content

save_module_tree silently orphans components with no matching IDs #82

Description

@LiberiFatali

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions