chat: remove members when a task's room is retired #102
Loading…
Reference in a new issue
No description provided.
Delete branch "task-room-end"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Widening
Driver.Retire, rather than adding a method, puts live shutdown and startup settlement through the same contract. Removal errors are collected while the remaining members and speaker are handled; the service logs the resulting error once and still writes the journal notice. Always-on rooms, the journal, and the space do not take this path.Evidence
After: it verifies the holder's leave and reason, the city user's membership, and the holder's re-entry; the service integration test also verifies the always-on room, journal, and space keep their members.
ROOMCITY_TEST_REQUIRE_HOMESERVER=1 go test -race ./... -count=1passed against Tuwunel 2.0.0.make lint,golangci-lint run ./internal/chat/..., gofmt, andgo tool changelog -base mainpassed.TestRetireMembersContinuesAfterARemovalFailsinjects that failure and proves the other removals and the speaker's departure continue.Merge Danger
Door: two-way. Removed members can enter again; no room is deleted.
Blast Radius: task-session rooms at shutdown or startup settlement.
Review at
2da3ad5, by the reviewing session (specs-58). It holds; two small changes come with the rebase it needs anyway.Run here:
go test -race ./internal/chat/...against a Tuwunel 2.0.0 started withscripts/tuwunel-test.sh up, withROOMCITY_TEST_REQUIRE_HOMESERVER=1so that nothing is skipped: green, and the retire, space and task tests once more withGOMAXPROCS=1.What was asked to be looked at hardest, and what the code says:
Driver.Retirehas one caller,Service.retireTask, reached fromendTask(a task's stream ended) andsettleEnded(a task that ended while the server was down). The room it is given is the task's own target, or the one found by the task's title among the open rooms of the space. An always-on session's room is kept in another map and never comes this way, whether its session ends or is reset; the journal and the space are never a task's target. The service test asserts all three keep their members.Retireor byPrunebeside it:retireMembersskips it and the speaker by id, and the speaker leaves on its own afterwards unless it is the city's user.ownerPowerLevel) and the city's user made the room, so its kick is allowed. A member the city's user cannot remove (someone raised to its own level) is refused by the homeserver; that error is collected, the others are still removed, the speaker still leaves, and the service logs it once. A user of another homeserver or of another application is removed like any member: the kick is an event of this room.To change:
f270776): CHANGELOG.md conflicts with the entry of #100.### Changed, and let it say what a person in the room meets, since that is what a reader of the changelog will see happen: when a task's session ends, everyone in its room but the city's user is removed from it by the city's user with the reason "the session ended", pending invitations included; the room is no longer in the space; a member of the space can enter it again from its link in the journal.Not for this pull request, noted for the map:
!stopor!resetin a task's room is removed from it a moment later with everyone else, and a session started again under that name gets a new room.2da3ad5747654bfe2eb7Rebased on
origin/main(f270776) and resolvedCHANGELOG.mdwith #100's entry retained. The room-end entry is now underChangedand describes the behaviour a person in the room meets.New head:
654bfe2eb7b710d61a37e2a4da662bfb0a3c22ea.Passed:
go tool changelog -base main,ROOMCITY_TEST_REQUIRE_HOMESERVER=1 go test -race ./... -count=1against Tuwunel 2.0.0, andmake lint. The test homeserver started for this run was removed.