Repository navigation
fix(settings): keep edits made while a channel save is in flight - #36102
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The one-shot sync matches what Notes
[DESIGN-REVIEWED] 3d95497 Description read[DESCRIPTION-READ] 716960f69c4f7ed8e6d369ba7cd1e428d0ff392eb71f9cfc382852074df99f7c That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The PR adds no new controls or strings. The before and after screenshots show the edit made during the save still there after "Saved.", and the blind reader saw it that way too. [UX-REVIEWED] 3d95497 Description read[DESCRIPTION-READ] d2317cac01f1e74d8e22b3a09a2c47f551e3cfc41745891d7cfac2ea7843653e That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item exists to stop the onSuccess reseed from dropping edits made during a save, and the one unfixed sibling (Slack) is deferred to #36100. What this change shipsInventory (6 items) — 6 justifiedIntent: a user's edit made while a channel save runs survives the save. FIX (#36099).
[FIRST-PRINCIPLES-REVIEWED] 3d95497 Description read[DESCRIPTION-READ] 3d0e909f3cd7de8bbfba3b61b87250e6f4a0227e3424ab1b1fd66861714bdcb1 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
The Telegram, Discord, Teams and Webex panels re-armed their draft sync after every successful save. The save's invalidation refetched the config, and when it came back changed (a channel that just connected, say) the sync effect rebuilt the draft from the server and dropped any field the user had edited while the request was running, under a "Saved" notice. Like the iMessage panel, they now leave the draft authoritative after the initial load and clear only the secret they just sent, and only while its field still holds that value. Fixes #36099
d1cea51 to
3d95497
Compare
Code change approver recommendation: ApproveWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. The fix achieves its goal in Telegram, Discord, Teams and Webex. The form now fills from the server only on first load, so edits made during a save survive the refetch, matching what IMessagePanel already does. A secret field is cleared after a save only if it still holds the value that was sent, read from a ref at the moment the save lands. The secret fields remount to their stored preview only when no newer edit is pending, and the controlled An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
bolichen97
left a comment
There was a problem hiding this comment.
I read the whole diff on this head. Every check is green. The five cancelled runs from 2026-11-12 22:58 each have a newer passing run on this head.
- The root cause is fixed the same way in all three panels (BotChannelPanel for Telegram and Discord, Teams, Webex). A save's
onSuccessno longer re-arms the draft sync, so the invalidation refetch cannot reseed the form over fields edited while the save was in flight. - Secrets are cleared only if the field still holds exactly what was sent. They are read through a ref, so
onSuccesssees the value as it is when the save lands. The secret field collapses back to its preview (formKeybump) only when no newer edit or clear is pending, andeditingkeeps a pending value open after the refetch reports a stored credential. - The two things the old reseed did on purpose are kept by hand: the Teams App ID is blanked after it was sent, unless it was edited, and a blank folder name shows the channel name it was saved as, unless it was cleared after a named folder was sent.
- The tests cover an allow-list entry, a tenant ID, a cleared folder name and a replacement token, each edited during a pending save.
- This is frontend state only. It adds no refusal and no regex.
Approving. Auto-merge is already armed by its holder, so I leave it as is.
Problem / Motivation
Goal: An edit made in the Telegram, Discord, Teams or Webex settings while a save is still running survives that save.
Every field stays editable during a save; only the Save button waits. On success the panels re-armed their draft sync and invalidated the config query. When the refetch came back changed (a channel that just connected, say), the sync effect rebuilt the draft from the server and dropped the newer edit, under a "Saved" notice. A save that verifies a pasted token against the provider can take several seconds, which is plenty of time to edit another field.
Why it matters
The user sees "Saved" and a form that quietly reverted the change they made during the save (an allow-list entry, a toggle), and nothing marks it as unsaved, so they believe it was stored.
Not a goal
SlackPanel.tsx; tracked separately.What changed (motivation → approach → change)
Symptom: in-flight edits lost after "Saved". Root cause:
onSuccessre-armed the one-shot draft sync, so the next changed refetch reseeded the draft.IMessagePanel.tsxalready avoids this on purpose. Change, inBotChannelPanel.tsx(Telegram, Discord),TeamsPanel.tsxandWebexPanel.tsx:Backwards compatibility
Compatible: every save sends the same payload as on main; only what the form shows after a successful save changes.
Removes nothing: no field, key or setting changes.
Tests
website/src/test/SettingsBotChannelPanelCov80.test.tsx: an allow-list entry added during the save stays after the refetched (connected) config renders; a replacement token typed during the save stays on screen.website/src/test/SettingsTeamsPanelCov80.test.tsx: a Tenant ID edited during the save stays after the refetched (active) config renders, and the sent password is cleared.website/src/test/SettingsWebexPanelCoverage.test.tsx: an address added during the save stays after the refetched (active) config renders. A folder name cleared during a save of a named folder stays blank, and a token typed during the first token save stays in its editor.Proof: not provable -- frontend test (prove.py runs Python only). Checked by hand: each new test fails against the main-branch panel.
Manual verification
Captured with a local Playwright harness (not part of this PR) that mounts the real
TelegramPanel, holds the save open, adds an allow-list entry, then lets the save succeed with the channel now connected. It asserts whether the entry survives before writing each frame.Screenshots / video
Telegram settings (the shared
BotChannelPanel), English. A save is started, an allow-list entry (222222222) is added while it runs, then the save succeeds and the channel connects.Before (main), while the save runs, then after "Saved." — the entry added during the save is gone:
After (this PR), the same two moments — the entry is still there after "Saved.":
Related Issues
Fixes #36099
Deferred: #36100
Sibling sweep
Swept: git grep -n "syncArmed.current = true" -- website/src/pages/settings
Sibling: website/src/pages/settings/BotChannelPanel.tsx -- changed here
Sibling: website/src/pages/settings/TeamsPanel.tsx -- changed here
Sibling: website/src/pages/settings/WebexPanel.tsx -- changed here
Sibling: website/src/pages/settings/SlackPanel.tsx -- tracked in #36100
Pattern harvest
Rule candidate: review-prompt
Pattern: a settings form that re-arms its server-to-draft sync in a mutation's onSuccess discards edits made while the request was in flight.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.