[medium] Merge input types for modules sharing the same name - #28
Open
elhoim wants to merge 1 commit into
Open
Conversation
get_module_to_types_map assigned per-module input lists rather than merging them, so when two modules shared a name (including two both falling back to the default '<unknown>' name), the second module's assignment silently overwrote the first's input types. Fix: accumulate each module's input types into a set via setdefault, merging across all modules with the same name, then convert to sorted lists at the end. Cleanup: pycache artifacts from local test run should not be tracked.
elhoim
force-pushed
the
fix/39-duplicate-module-names
branch
from
August 31, 2026 13:53
a31cc35 to
4677738
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BLUF — Modules sharing a name overwrite each other's input types instead of merging them.
get_module_to_types_mapinbin/cli.pyassigns rather than merges its per-name entry, so when two modules share a name — including two modules that both fall back to the placeholder<unknown>because they declare nonamefield — the second one's input types silently overwrite the first one's.setdefaultandupdate, converting to sorted lists only when the final mapping is built.Finding 39 (Low) —
bin/cli.py:123Problem
get_module_to_types_map assigns rather than merges, so two modules sharing a name - including two both defaulting to '' - silently lose the first one's input types.
Fix
get_module_to_types_map in bin/cli.py used a per-module assignment (mapping[name] = sorted(...)) instead of merging, so whenever two modules shared the same name — including two modules both falling back to the default "" label because they lacked a "name" field — the later module's input-type list silently overwrote the earlier one's, losing its input types entirely. The fix changes the accumulator to a dict of sets, using setdefault(name, set()) to get (or create) the module's type set and .update() to merge each module's input types into it, converting every set to a sorted list only at the end when building the returned dict. This preserves the union of input types across all modules sharing a name.
Verification
Reproduced against the unmodified code at
9b8c605, then re-checked after the change.Before
After
python bin/cli.py --helpexits 0 and the module still imports cleanly. Verification was performed offline against the pure functions — no runningmisp-modulesinstance is required.Branched from
9b8c605. This PR addresses only this finding; the other findings from the same review are in separate PRs, so they will need rebasing against each other as they merge.🤖 Generated with Claude Code