Repository navigation
fix: make legacy invite transitions atomic and race-safe - #764
Merged
TThanos3000 merged 1 commit intoSep 29, 2026
Merged
Conversation
This was referenced Sep 29, 2026
TThanos3000
marked this pull request as ready for review
September 29, 2026 17:23
19 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что изменено
Accept Invite теперь атомарно создаёт Collaborator и завершает Invite. Create/edit/accept/decline/revoke используют общий service и lock protocol; stale PATCH не возвращает обработанное приглашение в pending. Partial unique constraint защищает pending (project,user), проигранный INSERT получает controlled 409.
Зачем
PR B hardening legacy-команд. Спецификация, AC B1–B9 и read-only data preflight:
docs/invite-integrity-api.md.Реализация
c44bcf089c41c6e8c657a70390e98c46bc2510e7(PR A).3a513846c81dd36e5f3393957ec3450c9fcfb2f7.projects/team_service.py;invites/models.py,serializers.py,views.py; migration0003_legacy_pending_invite_constraint; teststest_invite_api.py,test_invite_integrity.py,test_pending_invite_migration.py;docs/invite-integrity-api.md.API
Успешные ответы прежние: create 201, accept/decline 200, edit 200, revoke pending 204. State conflicts теперь
{code, detail}с 409:duplicate_pending_invite,invite_already_processed,not_program_member,already_project_member,already_project_leader,invalid_team_member. Permission — 403. Concurrent revoke-first/accept-second может дать 404: Invite удалён, Collaborator не создан. Malformed input остаётся 400.UI
Не менялся; Angular mapping — отдельный PR D. React untouched.
Permissions
Сохранены legacy роли: управляет лидер, принимает/отклоняет получатель; внутри service проверяются повторно после lock.
Проверки
makemigrations --check --dry-run, Black / Flake8invitesи service,git diff --check.Acceptance criteria
Не проверено
Production DB не читалась для поиска конфликтов; live mutations не выполнялись. Browser не применим. Merge/deploy не выполнялись.
Риски / migration
Одна минимальная migration: partial unique
uniq_legacy_pending_inviteс predicateis_accepted IS NULL. Если существующие данные содержат дубли, migration останавливается без изменения данных; нужны отдельное решение владельца и cleanup перед повторным запуском. PROD migration graph/predicate с is_revoked отличаются: будущий production port требует адаптации, не прямого копирования. Program context и freeze пока относятся к PR C.Этот Draft PR по согласованию временно направлен в ветку PR A для отдельного reviewable diff. После merge A его base нужно сменить на dev. До этого самостоятельно не мержить.