fix(arcade-mcp-server): drop old key on prompt rename in update_prompt#875
Open
pmdroid wants to merge 1 commit into
Open
Conversation
PromptManager.update_prompt verified a prompt existed under the input name, then upserted under prompt.name. On a rename (prompt.name != name) the old entry was never removed, leaving a stale orphaned prompt in the registry. Mirror ResourceManager.update_resource: remove by the old key first (which also serves as the existence check), then upsert the new one. Adds regression tests for the rename and not-found cases.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
jottakka
approved these changes
Jun 26, 2026
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.
What
PromptManager.update_promptverified that a prompt existed under the inputname, then upserted the new handler underprompt.name. Whenprompt.namediffers fromname— a rename — the entry under the oldnamewas never removed, so the registry kept a stale, orphaned prompt.ResourceManager.update_resourcealready does this correctly.This change mirrors
update_resource: it removes by the oldnamefirst (which also serves as the existence check, raisingNotFoundErrorwhen the prompt is missing), then upserts byprompt.name.Why
Found while reviewing the in-progress TypeScript port, where the same bug had been faithfully reproduced. The TS side has been fixed in parallel; this PR fixes the Python original so the two stay aligned.
Tests
Added two regression tests in
libs/tests/arcade_mcp_server/test_prompt.py:test_update_prompt_rename_does_not_orphan_old_entrytest_update_prompt_missing_raises_not_founduv run pytest libs/tests/arcade_mcp_server/test_prompt.py— 16 passed.ruff check/ruff format --checkclean.Closes PLT-2067.
🐕 Written by Kyoto, an AI agent, on Pascal's behalf —
Note
Low Risk
Small, localized registry fix with tests; no auth, data, or API surface changes beyond correct prompt rename behavior.
Overview
Fixes a registry bug where renaming a prompt via
update_promptleft the old name registered alongside the new one.PromptManager.update_promptnow removes the entry under the originalnamebefore upserting underprompt.name, matching howResourceManager.update_resourcehandles URI changes. Missing prompts still raiseNotFoundErrorvia the remove step.Adds regression tests for rename (single listing, old name not found) and update of a non-existent prompt.
Reviewed by Cursor Bugbot for commit 7ebdcda. Bugbot is set up for automated code reviews on this repo. Configure here.