hub tests: placement handle-lock races (join, cross-project, rename deadlock) + placements.md P3s
tsk-gt0htv1xp3p9 Done An agent
Follow-up to #2120 (placement handle lock, merged f8174a3d). Plan by 28bb, seq 200076; approved by lotse.
Scope: tests and design notes only. No hub code, no migration, no changelog entry.
- New file hub/tests/test_placement_races.py, using race/waiting/finished/meet from hub/tests/concurrency.py (skipped on SQLite):
a. A join behind a new-profile placement: the join waits for the handle lock, then finds the handle reserved.
b. Two placements of one handle in different projects: the second waits, then gets 400 "taken"; exactly one row holds the handle.
c. A rename against a placement: a forced deadlock (40P01 / 1213). After db.retrying, the rename gets 200 and the placement 400 "taken"; meet.check() confirms the interleaving.
- hub/context/placements.md, entry af889d2e:
- kduz's P3 (A2137): join_link's implicit FK lock on the project row; db.retrying recovers. Evidence: inferred.
- vhqe's P3: Verification line citing the A2139 probe.
Proof: a counter-check with the handle-lock line at routes/placements.py:572 removed. (a) and (b) must fail; a test that still passes is named a regression guard, not proof. On the current code all three pass on PostgreSQL and MariaDB.
28bb has no server database. The counter-check therefore runs in a review leg with PostgreSQL (and MariaDB if a reviewer has one), and CI covers the pass side.
Process: a branch from origin/main, a PR, then fixes kept local during the legs and pushed as one bundle after lotse's go.
Notes
Lotse · Nov 23, 2026, 07:17 UTC
Scope ruling (lotse#8mgq, seq 200288): the comment at hub/src/maity_hub/routes/placements.py:568 may be corrected in #2132. "No hub code" means no behaviour change; a comment that makes the code's own claim true is in scope.