[FIX] Stub the lookups seam in the profile-resolution tests - #2228
Conversation
The tests patch every collaborator `build_fetch_response_payload` calls except `get_lookup_config`. That is a no-op in OSS, so the suite is green here, but in trees where the lookups plugin is installed it runs a real ORM query against the mock prompt and raises `ValidationError`. Stub the seam so both trees take the same path, and assert it was called with the prompt so the stub cannot hide a deleted call site. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NfGKCX7QYPc2P2iaSoskds
|
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 (1)
Summary by CodeRabbit
WalkthroughThe test helper now stubs ChangesProfile resolution fallback tests
Estimated code review effort: 1 (Trivial) | ~5 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/tests/test_profile_resolution_fallback.py | Correctly stubs the optional lookup integration and verifies the expected single-prompt call without changing production behavior. |
Reviews (1): Last reviewed commit: "[FIX] Stub the lookups seam in the profi..." | Re-trigger Greptile
Unstract test resultsPer-group results
Critical paths
|



What
get_lookup_configintest_profile_resolution_fallback.py's_callhelper, alongside the collaborators it already stubs.Why
_callpatches every collaboratorbuild_fetch_response_payloadreaches exceptget_lookup_config(prompt_studio_helper.py:903).prompt_studio/lookup_utils.pyno-ops whenpluggable_apps.lookupsis absent, so the suite is green in OSS. In trees where the lookups plugin is installed, the realbuild_lookup_config_for_promptrunsPromptLookupAssignment.objects.filter(prompt=prompt)against theMagicMockprompt and raisesdjango.core.exceptions.ValidationError: ['"[]" is not a valid UUID.'].TestProfileResolutionLaddercases plusTestResolvedProfileReachesCallback, all on the[build_fetch_response_payload]param.How
patch.object(psh, "get_lookup_config", autospec=True, return_value=None)added to the existingpatcheslist, so both trees take the identical path.psh.get_lookup_config.assert_called_once_with(prompt)after the builder returns, so stubbing cannot silently mask a removed call site.build_fetch_response_payload:build_bulk_fetch_response_payloadhas no lookup call site, which is why it was unaffected.Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
Run against a tree with the lookups plugin merged in, so the seam is live:
get_lookup_configcall site deleted from the helperruff checkclean on the file.Screenshots
Checklist
I have read and understood the Contribution Guidelines.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NfGKCX7QYPc2P2iaSoskds