[FIX] Keep the Prompt Studio back-reference in tool registry listing; drop dead adapter-choices route#2204
Conversation
… drop dead adapter-choices route
1. `tool` listing dropped the link back to the Prompt Studio project
After `export-tool` there was no way to correlate a registry entry with the
project that produced it. `fetch_json_for_registry` projected only four keys -
`name`, `description`, `icon`, `function_name` - where `function_name` is the
`prompt_registry_id`, a fresh UUID, not the Prompt Studio `tool_id`. Callers
were left matching on `name`, which is ambiguous whenever two projects share
one.
The data was already there and simply discarded: `PromptStudioRegistry` has a
`custom_tool` OneToOneField pointing straight back at the project, and the
serializer is `fields = "__all__"`, so it is already present in the serialized
data. The listing now carries it.
The frontend shows the cost of the omission today:
tool.function_name === toolDetails.tool_id || tool.name === toolDetails.tool_name
The first clause can never match (a registry UUID is compared against a Prompt
Studio tool_id), so correlation silently falls through to the ambiguous name
comparison. With `custom_tool` exposed, callers can correlate exactly.
`custom_tool` is `null=True`, so legacy rows report `None` rather than failing.
Additive only - no existing key changes.
2. `prompt-studio/adapter-choices/` routed to a method that does not exist
The URL mapped `get` to `get_adapter_choices`, which is not defined on
`PromptStudioCoreView` or anywhere else in the backend. The route resolved, the
handler was missing, and every request returned 500 `server_error`.
Removed the route and its `as_view` registration so the path 404s honestly
instead of 500ing. Verified there are no other references: the only two in the
repo were the route registration and the URL entry, and no frontend code calls
it. `adapter list --adapter-type LLM` already covers this server-side.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
Summary by CodeRabbit
WalkthroughThe changes remove the Prompt Studio adapter-choices endpoint and add a ChangesRegistry custom-tool metadata
Adapter-choices route removal
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
| Filename | Overview |
|---|---|
| backend/prompt_studio/prompt_studio_core_v2/urls.py | Removes an unreferenced route bound to a nonexistent view action, replacing an unconditional server error with an honest 404. |
| backend/prompt_studio/prompt_studio_registry_v2/constants.py | Adds the custom_tool key used to expose the source Prompt Studio project identifier. |
| backend/prompt_studio/prompt_studio_registry_v2/prompt_studio_registry_helper.py | Additively includes the serialized source-project back-reference in each flattened Prompt Studio registry entry. |
Reviews (1): Last reviewed commit: "[FIX] Keep the Prompt Studio back-refere..." | Re-trigger Greptile
Unstract test resultsPer-group results
Critical paths
|



What
Two small, self-contained backend bugs found during a full
unstractCLI run. Anchored at24d08728.1.
toollisting drops the back-reference to the Prompt Studio projectAfter
export-toolthere is no way to correlate a registry entry with the project that produced it.fetch_json_for_registryprojects only four keys —name,description,icon,function_name— wherefunction_nameis theprompt_registry_id, a fresh UUID, not the Prompt Studiotool_id. Callers are forced to match onname, which is ambiguous whenever two projects share one.The data is already there and simply discarded.
PromptStudioRegistryhas acustom_toolOneToOneFieldpointing straight back at the project, andPromptStudioRegistrySerializerisfields = "__all__"— socustom_toolis already inpi_serializer.data. The projection just never copied it across.This is not hypothetical — the frontend already pays for it. In
CreateApiDeploymentFromPromptStudio.jsx:The first clause can never be true (a registry UUID compared against a Prompt Studio
tool_id), so correlation silently falls through to the ambiguous name comparison — with an export-and-retry path behind it when that fails. Exposingcustom_toollets callers correlate exactly.custom_toolisnull=True, so legacy rows reportNonerather than failing. Additive only — no existing key changes, so nothing currently consuming this listing breaks.2.
prompt-studio/adapter-choices/routes to a method that does not existReturns
500 server_erroron every call.get_adapter_choicesis not defined — not onPromptStudioCoreView, not anywhere in the backend. The route resolves, the handler is missing, every request 500s.Fix: remove it, so the path 404s honestly instead of 500ing. I checked before choosing removal over implementation — the only two references in the entire repo were the
as_viewregistration and the URL entry itself, and no frontend code calls it.adapter list --adapter-type LLMalready filters server-side and is the working equivalent.Verification
grepforadapter_choices/adapter-choicesacrossbackend/andfrontend/srcreturns nothing after the change.urls.pyparses cleanly.ruffandruff-formatpass at the version pinned in.pre-commit-config.yaml(v0.3.4).Note on tests: the Django-backed suites in these apps currently error with
AppRegistryNotReadyin a plain checkout, and theprompt_studio_core_v2tests skip withouttest.env. A test written in that style would silently skip and read as coverage that isn't there. Happy to add one if there's a documented way to run those suites in CI.Impact
tool registry listcan offer realtool_idfiltering, and the frontend's dead first clause can be replaced with a correct comparison in a follow-up.🤖 Generated with Claude Code