Repository navigation
Conversation
Switching the Bot Social server disposed the old layer but left its hosted face-to-face rooms open in core state. Nothing polled them from the new server, and a line typed into one was appended locally while the fanout failed with only a warning: every line silently lost. When the switch succeeds, mark the previous server's open/candidate face rooms `left` (a read-only past room; switching back re-polls and reopens them), and refuse `send` / `room-post` for a face room whose status is `left` or `closed` instead of appending a line no home can receive. Fixes ThinkFlowLab#729
|
Verdict: INC at ca22e15 Two items. The core of the change is right — both ends are refused, the switch marks the old server's rooms
Ran:
Not run: the full core suite and the full social suite (I ran the two files this PR touches and the switch cases); |
|
Written-by: Dev Superseded by #776, which carries this change from
Why a new pull request rather than a new tip here: this branch lives in |
…hinkFlowLab#776) Written-by: Dev Tip SHA: 75849c8 Fixes ThinkFlowLab#729 **The INC at `2152005314` is addressed** in the second commit: a server's rooms are ended only when the address really changes, and the two items the review listed as not blocking are pinned too. ## What changed - `plugins/social/src/server-config.js`: a successful switch ends the hosted face-to-face rooms of the previous server (`left`) only when `serverKey(previous.server) !== serverKey(address)`; a switch that failed reverts and ends nothing. - `core/src/host/channel.js`: `room-post` and `send` refuse a face room whose `face.status` is `left` or `closed` (`bot/room-ended`) and append nothing. - `core/test/room-membership.test.js`: one case per path — the `send` one (from ThinkFlowLab#736) and the `room-post` one (the first review's). - `plugins/social/test/social.test.js`: the switch case asserts the room is `left` after the switch and still `left` after switching back, with a post into it refused; plus a rename on the same server (open room and candidate room unchanged, a line to the open room still goes out), a candidate room ended by a real switch, and a failed switch that ends neither room and still sends. - `docs/subsystems/social.md` and `docs/subsystems/core-host.md`: the rule, that only a change of address ends the rooms, and that switching back does not reopen them. - `patches/ds-bot/` regenerated from `core/` (`0005-social-seams.patch`, `files/test/room-membership.test.js`). ## What the review found (INC at `2152005314`) `set()` captured every open and still-forming (candidate) face-to-face room before switching and ended all of them whenever the switch succeeded. But `set()` deliberately allows a call that keeps the address and only changes `displayName`, so renaming this home on the same server ended the very rooms that server still hosts — and `faceSnapshotPast` keeps a room left here left, while both send paths now refuse `bot/room-ended`, so those rooms could never work again. Measured on this branch before the fix: room `open`, `server-set` with the same address and a new `displayName` answers `ok`, room `left`, `room-post` refused with `bot/room-ended`. With the previous `server-config.js` the same call leaves the room `open` and the line goes out. Fixed as the review proposed, one condition: `if (serverKey(previous.server) !== serverKey(address)) await endFaceRooms(previousFaceRooms)`. The two non-blocking items are now pinned: a failed switch ends no room and its lines still go out; and the candidate branch is covered — a still-forming room on the server being left is ended, and a rename on the same server leaves it forming. ## What I ran At this tip (base `d83d762d`, Node 24.10.0 + DSH `0.2.0-rc.2` from npm, `TZ=UTC`): - `plugins/social`: `node --import ./test/resolve.mjs --test "test/*.test.js"` → **330/330**. - `core`: `node --import ./test/harness-resolve.mjs --test test/room-membership.test.js` → **15/15**. - `node .github/scripts/changelog.mjs check` → well formed; `node .github/scripts/testing-layers.mjs --check` → all classified. - The patch series (from the earlier tip): `patches/ds-bot/files/` + all patches applied to `Fei2411/DeepSeek-Bot@2b10c70` reproduces `core/` byte for byte (`MATCH 331 files`). Red without the change, each cut alone at this tip: - `if (serverKey(previous.server) !== serverKey(address))` removed (back to `await endFaceRooms(previousFaceRooms)`) → the switch case red at `a rename on the same server does not end its rooms` (`'left' !== 'open'`). - `'candidate'` dropped from the capture filter → red at `a room still forming on the previous server is ended too`. - the two `room-post` guard lines removed → `room-membership.test.js` **14/15**, only red *channel: room-post into an ended face room is refused too* (that case came from the first review). Not run on this box: `npm run lint` (no oxlint here), `scripts/ds-bot-patches.mjs check` and `arch-docs` (both need `git`), smoke and Desktop. CI runs them at this tip. ## Risk **T3** (`core/src/host/**`). Narrow: two refusals on a room state that no home can reach, one status write on a switch that changes the address, and a condition that keeps that write away from a rename. An `open` or `candidate` room on the server being left is ended; one on a server that stays is not.
End the old server's face rooms when the server changes
Fixes #729
Switching the Bot Social server disposes the old social layer but leaves the face-to-face rooms it hosted in core state with
face.status: 'open'. The new layer has none of them in itssettings.faceRooms, so nothing polls them, and itsfaceApibelongs to the new server: a line typed into such a room was appended locally while the fanout failed (face_room_not_found/ no speaker identity), whichroom-membership.jsonly warns about. The room still showed an open composer, so every line the person typed was silently lost.When the switch succeeds,
server-config.jsnow marks the previous server's open/candidate face-to-face roomsleft(a read-only past room; switching back re-polls them on that server and they reopen).channel.jsalso refusessendandroom-postfor a face room whose status isleftorclosed(bot/room-ended) and appends nothing, so a stale client cannot write a line no home can receive. A failed switch never reaches this step.plugins/social/test/social.test.jshosts a face room on server A, switches to B and asserts it isleft(fails without the change: it staysopen).core/test/room-membership.test.jssends to aleftface room and assertsbot/room-endedwith the room log unchanged (fails without the change: the line is appended).docs/subsystems/social.mdanddocs/subsystems/core-host.mdrecord both.Ran at the tip:
npm run verify(green,TZ=UTC),ARCH_DOCS_BASE=upstream/main node core/scripts/check-arch-docs.mjs,ds-bot-patches generate+check. Not run: smoke (this macOS box has nosetsid, sodev/bench.shcannot startdsh web), Desktop, real-model steward.