Fix explicit --type rejected when absent from describeTypes.json - #37
Open
elhoim wants to merge 1 commit into
Open
Fix explicit --type rejected when absent from describeTypes.json#37elhoim wants to merge 1 commit into
elhoim wants to merge 1 commit into
Conversation
candidate_types was filtered against valid_types (describeTypes.json) even when the user passed an explicit --type. guess_attribute_types already filters its guesses against valid_types internally, so this second filter only ever had an effect on explicit types - rejecting any module-declared input type that GitHub's describeTypes.json does not list. Skip the valid_types-only filter for explicit --type and instead accept the type if it is in valid_types OR in supported_input_types (the set of input types declared by installed expansion modules), so a module-supported type is no longer rejected while still catching genuine typos.
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.
Finding 12 (Medium) —
bin/cli.py:924Problem
candidate_types is filtered against valid_types even for an explicit --type. guess_attribute_types already filters internally at :241, so this line only ever rejects explicit types - a module-declared type absent from GitHub's describeTypes.json is unusable.
Fix
Finding 12 (explicit-type-rejected, medium): at bin/cli.py:924,
candidate_typeswas filtered againstvalid_types(loaded from GitHub's describeTypes.json) unconditionally.guess_attribute_typesalready applies this same filter internally for guessed types, so the second filter only ever affected explicit--typevalues — any module-declared input type absent from describeTypes.json (e.g. because describeTypes.json is stale, offline, or the module adds a custom type) was silently rejected even though the installed module explicitly supports it. Fix: whenargs.attr_typeis set, accept the type if it is invalid_typesOR insupported_input_types(the set of input types declared by installed expansion modules' mispattributes.input), instead of requiring membership invalid_typesalone. Guessed types (the non-explicit path) are unaffected and still filtered againstvalid_typesonly, matching guess_attribute_types' existing internal behavior.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
https://claude.ai/code/session_01DYX4TKA5inzByJ4qGWKjqh