1. Fix race condition in update_version_status promote-to-production:
- Wrap demote (update_many) + promote (update) in a Prisma transaction
- Prevents concurrent promote calls from leaving two versions as production
2. Fix stale _policies_by_id cache in delete methods:
- delete_policy_from_db: remove entry from _policies_by_id when deleting
a draft/published version
- delete_all_versions: scan and remove all _policies_by_id entries
matching the deleted policy_name
3. Fix docstring for update_version_status:
- Remove documented-but-unimplemented 'production -> published' transition
- Clarify which transitions are valid vs invalid
4. Add tests for new behavior:
- test_published_to_production_removes_from_policies_by_id
- test_delete_draft_removes_from_policies_by_id_cache
- test_delete_all_versions_cleans_policies_by_id_cache
- Update existing promote-to-production tests to mock transaction
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
1. Fix stale _policies_by_id cache after status transitions:
- Add _update_policies_by_id_cache() helper method
- Update cache when draft->published transition occurs
- Remove entry from cache when promoting to production (resolved by name)
2. Fix race condition in create_new_version:
- Wrap find_first + update_many + create in a Prisma transaction
- Prevents concurrent version number collisions and orphaned is_latest state
3. Validate version_status query parameter in list_policies:
- Use Literal['draft', 'published', 'production'] type
- Returns 422 for invalid values instead of silently returning empty results
4. Add Literal validation to PolicyVersionStatusUpdateRequest:
- Change version_status field from str to Literal['published', 'production']
- Validates at request parsing level rather than at runtime
5. Fix duplicate auth dependency in endpoints:
- Remove decorator-level dependencies=[Depends(user_api_key_auth)] when
the function parameter already uses Depends(user_api_key_auth)
- Prevents auth check from running twice per request
6. Update tests to mock Prisma transaction context manager
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
* Replace Zapier webhook with Google Form for survey submission
* Add back error logging for survey submission debugging
---------
Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
* fix: feat: add litellm_system_prompt support
* feat: support new 'litellm_agent' model provider
* feat: ui/ - new agent builder ui
* fix(anthropic/chat/transformation.py): normalize max_tokens if decimal
* feat(agentbuilderview.tsx): run compliance datasets against litellm agent
* feat: new response rejection detector
* fix: multiple fixes
* feat: add mcp tools support to agent builder
create an agent with access to llm's + mcp servers
* fix: feat: add litellm_system_prompt support
* feat: support new 'litellm_agent' model provider
* feat: ui/ - new agent builder ui
* fix(anthropic/chat/transformation.py): normalize max_tokens if decimal
* feat(agentbuilderview.tsx): run compliance datasets against litellm agent
Replace Click CliRunner with standalone_mode=False to avoid
"I/O operation on closed file" errors caused by Click's stream
isolation in CI environments.