Repository navigation
fix(host): end a deleted Bot's room seats with the deletion (#2607) - #2608
Conversation
deleteBot only filtered the legacy room.members array. The room's participant entry stayed current, so currentParticipants still answered the Bot and the next membership write rebuilt room.members from it, saved, and the deleted id came back after a reload. Close the seat with leftSeq/leftAt and derive members through syncMembers, the same rule a leave uses. Rooms without a participants array keep the shipped filter. Adds core/test/delete-bot-seat.test.js, red without this change.
|
Verdict: PASS at 61ee3c7 Ran at this tip: Red first, checked at this tip. I exported the two source files as blobs at The one neighbour failure is Scope. Review points.
CI at this tip: Not run: smoke test, root |
Written-by: Dev
Deleting a Bot now ends its seat in every group chat in the same save: the id no longer answers in
participantsOf(), in a shared room's roster, or inroom.members, and the next membership write cannot write it back.Fixes #2607
Owner: Dev
Reviewer: Reviewer
Cause.
roster.deleteBotfiltered the room's legacymembersarray only. The room'sparticipantsentry stayed current, socurrentParticipantsstill answered the Bot andsyncMembers— called by the next add/remove/participants write — rebuiltmembersfrom it; the following save wrote the deleted id back, and it survived a reload.Change. The deletion closes the Bot's local seat with
leftSeq/leftAtand derivesmembersthroughsyncMembers(room-membership.js, now exported and shared), the same rule a leave uses. A room without aparticipantsarray keeps the shippedmembersfilter.removeRoomParticipantis not reused, so a deletion never refuses on the two-Bot floor; remote seats andapplyRosterare untouched.Files.
core/src/host/roster.js,core/src/host/room-membership.js,core/test/delete-bot-seat.test.js,docs/subsystems/core-host.md(core-host ownscore/src/host/),changelog.d/2607.fixed.md, and the regeneratedpatches/ds-bot/.Risk (T2/T3). This is the membership path of every group. The test covers a Bot deleted while it is the room's only admin and a room left with 0 Bots: the next membership write does not throw.
Ran at 61ee3c7.
cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/delete-bot-seat.test.js— red onb75b07d(2/2 fail), green here (2/2 pass); with the two source files reverted it goes red again.cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test --test-concurrency=8 "test/*.test.js"— 3017/3020 pass. The 3 failures reproduce on the pristineb75b07dsources here: twocheck-arch-docscases (this sandbox checkout has noorigin/main) and theusage-fieldssqlite fixture (no host usage database).cd core && npm run lint— 0 errors, 85 pre-existing warnings;arch-docs: OK (8 changed file(s)).node scripts/ds-bot-patches.mjs check— ok;canonical— ok.npm run verify(plugin suites), CIpackagejob.Checkpoint
{ "pr": 2608, "claim": "Dev", "issue": 2607, "summary": "deleteBot filtered only the legacy room.members array and left the room participant entry current, so participantsOf() kept answering the Bot and the next membership write rebuilt room.members and saved the deleted id. The deletion now closes the seat with leftSeq/leftAt and derives members through syncMembers, the same rule a leave uses; rooms without participants keep the shipped filter. It does not reuse removeRoomParticipant, so a deletion never refuses on the two-Bot floor. A new test covers the seat, the next write, save+reload and the only-admin / zero-Bot cases.", "files": ["core/src/host/roster.js", "core/src/host/room-membership.js", "core/test/delete-bot-seat.test.js", "docs/subsystems/core-host.md", "changelog.d/2607.fixed.md", "patches/ds-bot/0002-flybot-api-host.patch"], "checks": { "ran": "cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/delete-bot-seat.test.js && npm run lint", "result": "green", "at": "61ee3c7b7c641b13d9d3cb7fef0ec7344e443ee2" }, "next": "none — ready for review" }