mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
* fix(proxy): make /team/member_delete's four cleanups atomic The team roster update, the user.teams update, the team membership delete, and the team-scoped verification token delete ran as four sequential writes with no transaction around them, so a failure between any two left the removal half applied. Thread a single prisma transaction through all four writes, following the same tx.<table> pattern /team/member_add and /team/member_update already use, so either all four land or none do. * fix(team): serialize member_add, member_delete, and delete under the team's advisory lock /team/member_add validated a team exists and then wrote the user's teams array and a membership row without holding anything across that gap, so a /team/delete could commit its reference sweeps in between and leave a member pointing at a team id that no longer exists. The write path already re-read members_with_roles under a row lock before this change, but SELECT ... FOR UPDATE can deadlock with the access-group endpoints, which lock an access group and then a team. member_add now takes pg_advisory_xact_lock(hashtext(team_id)) before re-reading the team and only writes if it is still there, so a delete that already committed is visible before any write happens. delete_team takes the same lock around its own row delete and reference sweep, so the two requests can never interleave: whichever acquires the lock first runs to completion before the other's read can proceed. Dropping the row lock from member_add's read also dropped the incidental protection it gave against a concurrent member_delete, which still wrote from the snapshot it validated against, unlocked, and could silently overwrite whatever member_add had just committed. member_delete now takes the same advisory lock and re-reads the roster under it before computing its own write, so it can never resurrect a member by overwriting from stale data. Resolves LIT-5544 * fix(team): run member writes on the advisory lock's transaction Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(team): keep member writes on the lock holder's connection after merge Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(team): keep the transactional member create an upsert on user_id The transaction path was creating the email-identified user row outright, where the regular client path upserts on user_id. Share one upsert helper between both member paths so the create stays idempotent on the lock holder's connection. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(team): read member_delete's user and key rows on the lock-holding transaction Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| example_config_yaml | ||
| test_configs | ||
| test_model_response_typing | ||
| azure_fine_tune.jsonl | ||
| batch_job_results_furniture.jsonl | ||
| conftest.py | ||
| data_map.txt | ||
| eagle.wav | ||
| gettysburg.wav | ||
| large_text.py | ||
| messages_with_counts.py | ||
| model_cost.json | ||
| openai_batch_completions.jsonl | ||
| openai_batch_completions_router.jsonl | ||
| speech_vertex.mp3 | ||
| test_aproxy_startup.py | ||
| test_audit_logs_proxy.py | ||
| test_auth_checks.py | ||
| test_banned_keyword_list.py | ||
| test_blog_posts_endpoint.py | ||
| test_check_batch_cost.py | ||
| test_check_responses_cost.py | ||
| test_custom_callback_input.py | ||
| test_custom_logger_s3_gcs.py | ||
| test_custom_tokenizer_bug.py | ||
| test_db_schema_changes.py | ||
| test_default_end_user_budget_simple.py | ||
| test_deployed_proxy_keygen.py | ||
| test_deprecated_key_grace_period.py | ||
| test_e2e_pod_lock_manager.py | ||
| test_gemini_agents_endpoints.py | ||
| test_get_favicon.py | ||
| test_get_image.py | ||
| test_google_endpoint_routing.py | ||
| test_google_gemini_proxy_request.py | ||
| test_jwt.py | ||
| test_jwt_key_mapping.py | ||
| test_key_generate_dynamodb.py | ||
| test_key_generate_prisma.py | ||
| test_models_fallback_endpoint.py | ||
| test_multipart_bypass_repro.py | ||
| test_prisma_client_backoff_retry.py | ||
| test_prompt_test_endpoint.py | ||
| test_proxy_config_unit_test.py | ||
| test_proxy_custom_auth.py | ||
| test_proxy_custom_logger.py | ||
| test_proxy_encrypt_decrypt.py | ||
| test_proxy_exception_mapping.py | ||
| test_proxy_gunicorn.py | ||
| test_proxy_pass_user_config.py | ||
| test_proxy_reject_logging.py | ||
| test_proxy_routes.py | ||
| test_proxy_server.py | ||
| test_proxy_server_keys.py | ||
| test_proxy_server_spend.py | ||
| test_proxy_setting_guardrails.py | ||
| test_proxy_token_counter.py | ||
| test_proxy_utils.py | ||
| test_realtime_cache.py | ||
| test_reducto_ocr_route.py | ||
| test_request_size_limit_middleware.py | ||
| test_response_polling_handler.py | ||
| test_response_polling_pre_call_checks.py | ||
| test_search_api_logging.py | ||
| test_server_root_path.py | ||
| test_skills_db.py | ||
| test_ui_path_detection.py | ||
| test_unit_test_max_model_budget_limiter.py | ||
| test_unit_test_proxy_hooks.py | ||
| test_update_daily_tag_spend.py | ||
| test_update_spend.py | ||
| test_user_api_key_auth.py | ||
| test_zero_cost_model_budget_bypass.py | ||
| vertex_key.json | ||