Repository navigation
fix(dashboard): 离线 bot 恢复行从 bots.json 带回 larkToolBinding 等保存值 - #2250
Merged
Merged
Conversation
Co-Authored-By: Claude Code <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 24, 2026 02:29
deepcoldy
added a commit
that referenced
this pull request
Oct 24, 2026
Co-Authored-By: Claude Code <[email protected]>
deepcoldy
added a commit
that referenced
this pull request
Oct 24, 2026
This was referenced Oct 24, 2026
|
🚀 Released in v3.51.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#2248 修好了 daemon 在线时 GET
/api/bot-default-oncall漏回larkToolBinding导致刷新回显恒为「开」的问题;双审时双方都确认了一个相邻的离线边角,本 PR 收口。改了什么
当某 bot 的 daemon 离线时,Dashboard 的
configuredBotDefaultsRecoveryRows(src/dashboard.ts)从磁盘 bots.json 合成离线行交给botDefaultsPayload。之前合成的稀疏对象只手工列了quotaFallbackBot、autoInviteOwnerOnGroupAdd、askOptionLayout,没有larkToolBinding——该字段缺省即开(j?.larkToolBinding !== false),所以磁盘上显式存的false在 daemon 离线期间会被回显成「开」。sparseOverridesFromRawBotConfig(rawEntry),集中维护「离线行需要从磁盘保真带回的字段」,其中larkToolBinding做 boolean 收窄(未配置/非法手改值 → undefined,仍交 payload 层按缺省归一化)。...sparseOverridesFromRawBotConfig(rawEntry),原有三个字段行为逐字不变。为什么这么改
离线行的 PUT 本就打不通(daemon 不在线),这是纯展示层保真问题;把字段集合收敛到一个纯函数后,后续再有「缺省态与保存态不同」的字段只需在同一处补,不必在 dashboard.ts 里继续手工列举,且可直接单测。
生效条件
Bot Defaults 页加载、某 bot 的 daemon 不在线时;daemon 恢复在线后仍走 IPC 回包(#2248 路径),不受影响。
影响面
验证
larkToolBindingfalse/true/缺失/非法值四态经稀疏函数与botDefaultsPayload后的结果;既有askOptionLayout/quotaFallbackBot/autoInviteOwnerOnGroupAdd透传不回归。larkToolBinding提取行 → 新用例红;② 去掉 boolean 收窄直接透传 → 非法值用例红。bun run test -- test/dashboard-bot-payload.test.ts test/dashboard-bots-roster-signature.test.ts:56 通过。bun run build(tsc + Dashboard 构建 + 资源审计)通过。🤖 Generated with Claude Code