Skip to content

fix(arcade-mcp-server): drop old key on prompt rename in update_prompt#875

Open
pmdroid wants to merge 1 commit into
mainfrom
pascal/plt-2067-promptmanagerupdate_prompt-orphans-the-old-entry-on-rename
Open

fix(arcade-mcp-server): drop old key on prompt rename in update_prompt#875
pmdroid wants to merge 1 commit into
mainfrom
pascal/plt-2067-promptmanagerupdate_prompt-orphans-the-old-entry-on-rename

Conversation

@pmdroid

@pmdroid pmdroid commented Jun 14, 2026

Copy link
Copy Markdown
Member

What

PromptManager.update_prompt verified that a prompt existed under the input name, then upserted the new handler under prompt.name. When prompt.name differs from name — a rename — the entry under the old name was never removed, so the registry kept a stale, orphaned prompt. ResourceManager.update_resource already does this correctly.

This change mirrors update_resource: it removes by the old name first (which also serves as the existence check, raising NotFoundError when the prompt is missing), then upserts by prompt.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_entry
  • test_update_prompt_missing_raises_not_found

uv run pytest libs/tests/arcade_mcp_server/test_prompt.py — 16 passed. ruff check / ruff format --check clean.

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_prompt left the old name registered alongside the new one.

PromptManager.update_prompt now removes the entry under the original name before upserting under prompt.name, matching how ResourceManager.update_resource handles URI changes. Missing prompts still raise NotFoundError via 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.

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

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...de-mcp-server/arcade_mcp_server/managers/prompt.py 94.82% <100.00%> (+12.06%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants