Repository navigation
fix(client): keep the main view on a chat whose Bot left the roster (#261) - #880
Conversation
ad2feb2 to
8075aba
Compare
|
Written-by: Dev4 New tip: The first tip failed |
8075aba to
51f803c
Compare
|
Written-by: Dev4 New tip: |
A Bot a friend revokes (or removes) drops out of `roster.byId` while its session stays open. The main view's landing effect then fell through to `landOn(mainBotId, last, …)` and `landingPart` resolved `roster.byId[last.botId]` to `undefined`, so `landingPart` returned the Main Bot's part: the view jumped to Chief's chat with no click behind it. `landingPart` now asks the session list whether that conversation still exists, because the roster says which Bots are reachable, not which sessions are open. `landOn` passes `ctx.sessions.list`, and the sidebar hands over the id the view holds now, so a blank chat of that same session stays put while a New Session the user opened (a different id) still goes to the Main Bot. A session archived together with its Bot keeps the old answer: the Main Bot. The protected guard that keeps a chat with content from being swapped out is untouched.
51f803c to
e3823c4
Compare
|
Written-by: Dev4 New tip: |
|
Verdict: PASS at e3823c4 Ran:
What I checked: the defect is real (the roster drops a Bot whose session is still open, so the view lands on the Main Bot with no click), this is the change that reproduces it, and the rule is now "the session list, not the roster, says whether that chat still exists". Both sides are pinned: the held chat stays; a New Session the user opened and a session archived with its Bot still go to the Main Bot. Each half reddens exactly one test when reverted, so neither is carried by the other. Non-blocking notes:
|
Fixes #261
What changed
The main view jumped to the Main Bot's chat on its own.
useLandOnMainBotfalls through toactions.landOn(mainBotId, last, …)when the view empties or holds a blank chat whose Bot is no longer inroster.byId;landingPartthen looked uproster.byId[last.botId], gotundefined, and answered withthe Main Bot's part. A friend revoking the share (or removing the Bot) is exactly the case that drops it
from the roster while the session is still open, so the view moved with no click behind it. The three
earlier attempts did not reproduce it because
#280'slandingPartalready returns the held chat whilethe Bot is in the roster, and
sidebar.js's guard never swaps a chat with content out.landingPart(core/src/client/text.js) now asks the session list, not the roster, whether thatconversation still exists:
stay) whilelast.sessionIdis still inctx.sessions.list→ that same chat;view === last.sessionId) → that same chat;last.sessionIdarchived with its Bot → the MainBot, as before;
laststill means the Main Bot.landOn(core/src/client/index.js) passes the session snapshot andview; the landing effect(
core/src/client/sidebar.js) passes the id the view holds now. The guard atsidebar.js:667that keeps achat with content from being swapped out is untouched.
core/client.jsis rebuilt (19 changed lines, thethree call sites only). Docs:
docs/subsystems/core-client.md. Changelog:changelog.d/261-landing-part-session-list.fixed.md. Thepatches/ds-bot/mirrors are updated for the samefour files (
0001-core-fixes,0003-flybot-api-client,0008-client-bundle, and the whole-filepatches/ds-bot/files/test/land-on.test.js).Verification at the tip
Tip SHA: 51f803c
Ran:
core/test/land-on.test.js6/6; fullcoresuite 1308/1309, the only failure being the knownenvironment red
#177 "empty diff passes"(check-arch-docsrunsgit, and this tree is a codeload tarwith no
.git);node scripts/build-client.mjs --checkexit 0 after rebuildingcore/client.js(diffagainst the base bundle is 19 lines, all three call sites of this change).
Not run (and why):
scripts/ds-bot-patches.mjsitself (needsgit, absent here: the edited sections werereplayed against
ds-bot/and compared withcore/, and thepackagejob'sds-bot-patches checkis theauthority); the browser walkthrough (no browser here — the deterministic
land-on.test.jscases are thereproduction);
arch-docslocally (same missinggit).Evidence (withdrawing the change reds a test, and only the test that is about it)
#261: a roster that lost the Bot keeps the held chat whose session still existsred — 5/6, which is the reported bugstay || view === last.sessionId→ always)#261: a session that is gone, or a New Session the user opened, still goes to the Main Botred — 5/6, so a New Session cannot start landing on the old chatRisk
Low: one pure function plus two call sites, no wire change; the fallback for a session that is really gone
is unchanged, and a chat with content is still protected by the untouched guard. The only behaviour that
moves is the one the issue names: a Bot leaving the roster while its chat is open no longer moves the view.