-
Notifications
You must be signed in to change notification settings - Fork 227
Validate component IDs in save_module_tree to catch orphaned components #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
anhnh2002
merged 2 commits into
FSoft-AI4Code:main
from
LiberiFatali:fix/save_module_tree-orphan-silently
Aug 6, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
known_ids = set(session.components.keys())is the full component index, but clustering by design operates on a subset and intentionally excludes components. The cluster prompt (prompt_template.py:132-137) explicitly says "It's normal that some components are not essential to the repository" and "DO NOT include components that are not essential." The original pipeline also clusters onlyleaf_nodes(format_potential_core_components(leaf_nodes, ...)incluster_modules.py).So on any real repo, every non-leaf and every deliberately-excluded component lands in
leftover_component_ids, and the "will receive no documentation" warning fires on every normal save. Since this response is consumed by an LLM agent, a persistent warning is likely to push agents to cram all components into modules just to silence it — degrading clustering quality, the opposite of this PR's intent.Suggestion:
unmatched_idscheck against the full index as-is — that's the real bug-catcher and is correct.set(session.leaf_nodes)(the actual clustering candidate set) instead, and present it as informational (e.g. anotefield) rather than folding it intowarning.Note the tests don't catch this because
_make_sessionsetsleaf_nodesidentical tocomponents— worth adding a case wherecomponents ⊃ leaf_nodesonce the baseline is fixed.