fix(rovodev): guard non-string prompt names when merging prompts.yml - #4145
Open
jawwad-ali wants to merge 1 commit into
Open
fix(rovodev): guard non-string prompt names when merging prompts.yml#4145jawwad-ali wants to merge 1 commit into
prompts.yml#4145jawwad-ali wants to merge 1 commit into
Conversation
`_read_prompts_yml` documents that it "Returns an empty list if the file is
missing, malformed, or contains no valid prompt entries", but it only
filters at the entry level (`isinstance(item, dict)`) — it never validates
the entry's `name`.
`_merge_prompt_entries` then does `name = entry.get("name", "")` followed by
`if name in generated_by_name:`, a dict membership test. A hand-edited
`.rovodev/prompts.yml` whose entry has a YAML sequence or mapping `name`
therefore raises an unhandled TypeError out of setup():
name=list -> TypeError: unhashable type: 'list'
name=mapping -> TypeError: unhashable type: 'dict'
name=int -> OK
name=null -> OK
Only the unhashable shapes crash. Every `specify init` /
`integration install` / `integration upgrade` for rovodev on that project
then aborts with a raw traceback, and the user's prompts.yml is never
rewritten.
A non-string name can never match a generated entry, so treat it like any
other unmatched entry and preserve it verbatim.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Problem
RovodevIntegration._read_prompts_ymldocuments its contract:But it filters only at the entry level (
isinstance(item, dict)) — it never validates the entry'sname._merge_prompt_entriesthen does:.rovodev/prompts.ymlis user-editable, so a YAML sequence or mappingnamereaches that unhashable-key lookup.Reproduction on current
main(bf88c9f)Only the unhashable shapes crash — the classic gap this repo's shape-guard vein targets.
The failure escapes
setup()as a raw traceback, so everyspecify init,integration installandintegration upgradefor rovodev on that project aborts, and the user'sprompts.ymlis never rewritten.Fix
A non-string name can never match a generated entry, so treat it like any other unmatched entry and preserve it verbatim:
Verified all shapes now succeed with the user's entry intact:
No breaking change. A string
nametakes the identical replace-in-place path (the matching case still collapses to 10 entries rather than 11). The only inputs whose behaviour changes are ones that previously crashed.Verification
tests/integrations: no new failures vs a clean-mainbaseline captured onbf88c9f9(18 pre-existing, Windows symlink-privilege).uvx ruff@0.15.0 check src tests→ cleanWritten with assistance from Claude Code. Bug found, reproduced, and verified by me on current
main.