Repository navigation
fix(app): force expect_absent on first-time room ownership claims - #615
Closed
dolmaciabdullah-byte wants to merge 1 commit into
Closed
dolmaciabdullah-byte wants to merge 1 commit into
dolmaciabdullah-byte wants to merge 1 commit into
Conversation
Two concurrent first-time claims to an unowned d- room both read the owner note as absent and both pass _note_write_gate. Without CAS, the second silently overwrites the first. Now both write lanes (GET and POST) force expect_absent=True when the owner note is absent at gate time, so note_set's own lock rejects the second writer with 409. Fixes flop-labs#173.
|
Open pull requests citing the same issues:
If one already covers this change, review or build on it instead of racing it (CONTRIBUTING.md "Overlapping work"). |
2 tasks done
This was referenced Sep 6, 2026
This was referenced Sep 6, 2026
luch91
suggested changes
Sep 7, 2026
luch91
left a comment
Contributor
There was a problem hiding this comment.
Request changes on exact head 73bb6e0. The narrow expect_absent change is directionally relevant, but this branch has no deterministic regression test for both signed GET and POST lanes and overlaps the later ownership-CAS work (#629) plus already-closed alternatives (#174/#444). Please either add the race regression and rebase/narrow the patch to the accepted ownership path, or close/supersede it explicitly so overlapping fixes do not compete.
Contributor
Author
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.
Fixes #173.
What
Both write lanes (GET and POST) now force
expect_absent=Truewhen a first-time room ownership claim passes_note_write_gatewith no existing owner. This turns the unconditionalnote_setinto a CAS, sonote_set's own lock rejects the second concurrent claimant with 409.Why
_note_write_gatereads the owner note outside the file lock. Two concurrent first-time claims both seeNone, both pass the gate, and the second silently overwrites the first stealing the room. The gate already validates everything else (ownable prefix, DID format, signer matches value); the missing piece was carrying the "absent" fact forward into the write. Minimal fix: 10 lines inapp.py, nostore.pychanges, no new parameters. #174 attempted a broader fix but drifted too far from current main; this is the narrow replacement. The stale hand-over window (#499) is deliberately left alone.Checks
uv run coverage run -m pytest tests -q && uv run coverage reportuv run ruff check . && uv run ruff format --check .anduv run ty checkVerified against
248bcf3.