Repository navigation
fix(board): 同毫秒写入的关联按写入顺序展示,修 master 红 - #2282
Merged
Merged
Conversation
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 24, 2026 13:33
#2266 合入后 master push CI 的 test (3/3) 确定性红: test/decision-board-store.test.ts「关联对象去重并记一条历史」在 addItem 与 updateItem 落在同一毫秒时拿到 [chat, pr] 而非 [pr, chat]。 board_links 是 WITHOUT ROWID 表,links() 用 ORDER BY created_at, kind, ref; created_at 毫秒精度打平后只剩主键序(kind 字母序 chat<pr),作者写入顺序 被打乱。PR CI 因两次调用跨毫秒而侥幸绿,master runner 上同毫秒暴露。 修复: - board_links 加 per-item 严格单调 ord 列(新插入才占序号,upsert 命中 既有关联不改次序),links() 改为 ORDER BY ord - schema v1→v2:WITHOUT ROWID 不能 ADD COLUMN,功能未发版、v1 仅存在于 开发机,迁移丢弃 links 表由 CREATE 重建(items/events/批次保留) - 补两条用例:显式同毫秒跨调用 + 单次多关联的顺序;v1→v2 迁移(items 保留、links 重建后顺序正确、再开不重复迁移) - 变异:ORDER BY 退回 created_at,kind,ref 后两条新用例精确变红 Co-Authored-By: Claude <[email protected]>
deepcoldy
force-pushed
the
hotfix/board-links-order
branch
from
October 24, 2026 13:48
9a84c3a to
ecfd609
Compare
Owner
Author
|
复审后追加一处精确化(新 head 复审指出原 upsert(DO UPDATE SET label=COALESCE(...))在「命中既有关联只改 label」时 SQLite 也返回 changes=1,导致 改为真正精确:
新增用例:同次调用 [pr 改 label, chat 新增] 直查库断言 ord=[pr:0, chat:1];变异回退 DO UPDATE 写法该用例精确变红。store 23 例 bun/vitest 两腿全绿,tsc/build 绿。 |
deepcoldy
pushed a commit
that referenced
this pull request
Oct 24, 2026
- links 整段采用 #2282 的实现(DO NOTHING + 单独改标签,ord 从 0 起无空洞) - board_files.ord 走 schema v3:迁移在 open() 的 BEGIN IMMEDIATE 里,缺列才 ADD COLUMN,按看板内 (created_at, id) 从 1 回填;新插入按 app_id 取 MAX+1 - 保留 listItems / listDrafts 同毫秒按编号兜底 - 测试:v2→v3 迁移(id 逆序的同毫秒老图、多看板分区、links 保留、重开幂等)、 直接断言 ord 列值、高版本库 fail-closed Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚀 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.
背景
#2266 合入(976946a6f)后 master push CI 的
test (3/3)确定性红(run 40089721668),后续 master 提交 ac0a072 的 push CI 同样被这个用例带红:test/decision-board-store.test.ts > 关联对象去重并记一条历史在addItem与updateItem落在同一毫秒时实际得到[chat, pr],断言期望[pr, chat]。根因(真 bug,非 flake)
board_links是WITHOUT ROWID表,links()排序是ORDER BY created_at, kind, ref。created_at只有毫秒精度,两次写入同毫秒打平后退回主键序(kind 字母序 chat < pr),管家给出的关联写入顺序被打乱。PR head CI 因两次调用跨毫秒侥幸绿,master runner 同毫秒暴露。修复
board_links加同一事项内严格单调的ord列(仅新插入占序号,upsert 命中既有关联不改次序),links()改ORDER BY ordcreated_at, kind, ref后两条新用例精确变红,恢复后 22/22本地:tsc、build 绿;vitest 5 相关文件 73 例、bun 4 文件 65 例全绿。
Co-Authored-By: Claude [email protected]