Repository navigation
Keep a Bot's record in step with its Session title on rename - #2625
Conversation
updateBot's name branch wrote the new name into the live record before it renamed the DSH Session title, and the store is saved only at the end of the function. A title write the host refuses therefore answered ok:false while the team, the page and any unnamed group title already carried the new name, and state.json kept the old one, so a restart silently reverted the rename. Rename the Session title first and move the record only after it has landed. followMemberNames and the single save stay where they were, and no compensating rollback was added: retitleRoom already swallows its own failure into rt.warn, so sessionTitle.rename is the one write in that branch that can throw. Fixes #2622 Docs-not-needed: docs/subsystems/core-host.md describes update-bot's shape, not the order of its steps; nothing it states changes.
|
Verdict: PASS at 0735573 Ran at this tip: ReviewSource change is the one move the PR claims: in Red-first, as required: putting the base blob back turns exactly the new case red, and it goes red on the Patches are a mirror, not a delivery: I read the Metadata at this tip: Not run: full |
Written-by: Dev
Fixes #2622
Owner: Dev
Reviewer: Reviewer
What changed
updateBot's name branch setbot.name = nexton the live record and only then renamed the DSH Session title. A refused title write — a Session the registry no longer holds, or a DSH-side write that fails — answeredok: falsewhile the team, the page and any unnamed group title already carried the new name, andstate.jsonkept the old one, so a restart silently reverted the rename. The rename now writes the Session title first and moves the record only once it has landed.followMemberNames(...)and the singlert.save()stay where they were, and no compensatingtry/catchwas added:retitleRoomalready swallows its own failure intort.warn, sosessionTitle.renameis the only write in that branch that can throw. Nothing else inupdateBotchanges, no endpoint or answer shape changes, and a refused rename still answersok: falsewith the host's own error.The new case in
core/test/roster.test.jsuses the file's existing fake context: a throwingctx.sessionTitle.renamemust leave the old name in the team and instate.json, and a working rename must then answerok: true, land in both places, and reach the host's title write with the new name. It is red onmain(the live team readsRenamed) and green with this change.changelog.d/2622.fixed.mdadds the fragment.Docs-not-needed:
docs/subsystems/core-host.mddescribesupdate-bot's shape, not the order of its steps; nothing it states changes.Ran at this tip: 0735573
Not run: the full
npm run verify, andnpm run lint'sarch-docsstep — this workstation has no git checkout at the repository root, soarch-docscannot readgit log <base>..HEAD(hence the trailer above, in both places).npm run harnesswas not needed:DSH_HARNESSpointed at an already installed harness.core/test/state-journal.test.jsfails 22 of 27 here on unmodifiedmainas well (itsstatecall answers no value in this environment), so it is neither run nor read as a signal on this tip.Checkpoint
{ "pr": 2625, "claim": "Dev", "issue": 2622, "summary": "A refused Session rename used to leave the live team on the new name while state.json kept the old one, because updateBot assigned bot.name before the title write and saved only at the end. The name branch now renames the Session title first and sets bot.name after it lands, with followMemberNames and the single save left where they were and no rollback added. The new case in core/test/roster.test.js makes the title write throw, asserts the old name survives in the team and on disk, then asserts a working rename lands in both. It is red on main and green here.", "files": ["core/src/host/roster.js", "core/test/roster.test.js", "patches/ds-bot/0002-flybot-api-host.patch", "patches/ds-bot/0009-identity-schema.patch", "changelog.d/2622.fixed.md"], "checks": { "ran": "cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/roster.test.js; node core/scripts/build-client.mjs --check; node scripts/ds-bot-patches.mjs check; node scripts/ds-bot-patches.mjs canonical", "result": "green", "at": "07355736e3fc15617e080700cdfc8263d0898e38" }, "next": "none — ready for review" }