Skip to content

fix(app-shell): a deleted record leaves the recently-accessed list - #34108

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-u5sd7i
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-u5sd7i

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Fixes #33826

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:删除记录成功后,该记录立刻从「最近访问」里移除(⌘K 命令面板、环境首页、本地缓存与服务端 ui.recent 偏好同步)。
  • 为什么改:删掉的记录还挂在最近访问第一条,点进去落到一条不存在的记录,最近访问越用越不可信。
  • 风险与回滚:只加了一个订阅数据源删除事件的监听,只删 record:对象:ID 这一条;回滚即 revert 本 PR,无数据迁移。
  • 先看:ui/packages/app-shell/src/context/RecentItemsProvider.tsx(useDropDeletedRecordsFromRecents)→ ui/packages/app-shell/src/console/ConsoleShell.tsx(唯一挂载点)。
  • 两分钟验证:打开一条客户记录 → 更多 → 删除 → 确认,然后按 ⌘K:「最近访问」里不再有它;点 Toast 上的撤销回到该记录后再按 ⌘K,它重新出现在第一条。
  • 需要你做的:无,席位落地。

What changes

  • useDropDeletedRecordsFromRecents(dataSource) (new, module-internal to @object-ui/app-shell, not exported from the package index): subscribes to the data source's onMutation and, on a delete event that names its record (resource + id), calls the provider's existing removeRecentItem with the record entry's id, record:OBJECT:RECORD_ID (the id the record page writes). removeRecentItem already writes the list, localStorage and the debounced ui.recent save, and writes nothing when the entry is absent.
  • ConnectedShellInner mounts it once (DeletedRecordsLeaveRecents, beside UserStateBridge), on the connected adapter. The console's ConsoleShell holds RecentItemsProvider above every ConnectedShell, so the palette (CommandPalette), Home and the sidebar read the trimmed list. One subscriber covers every delete door that reports its record (record header, list row, action) with no call at each door, and RecordDetailView.tsx is untouched.
  • Undo: the record page's Undo restores the record and navigates back to it; that visit records it again through the record page's existing addRecentItem effect. A restore emits no mutation event by design (restoreRecycleBinEntry: "a restore is never a create"), so nothing re-inserts the entry before the visit.
  • No public surface changes: the useRecentItems() value and the package exports are unchanged, so Clause-②: no holds.

Tests

  • ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx gains one top-level describe (the shared harness file): the deleted record leaves the list, localStorage and the saved row; CONTROL another record's delete (same object, other object) leaves it listed and saves nothing; CONTROL an update event and an id-less delete (bulk) drop nothing; after an undo the revisit lists it again at the head; the listener unsubscribes on unmount.
  • ui/packages/app-shell/src/console/__tests__/ConnectedShell.deletedRecordLeavesRecents-33826.test.tsx (new): the real ConnectedShell under the real recents provider; a delete reported by the adapter drops that record only; the subscription goes away with the shell.
  • No forced test edits.
Test runs (head a6cbed1)
  • pnpm --dir ui exec vitest run packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx packages/app-shell/src/console/__tests__/ConnectedShell.deletedRecordLeavesRecents-33826.test.tsx: Test Files 2 passed (2), Tests 28 passed (28), lock VERDICT command-exit 0.
  • Ablation 1 (scripts/ablation-replace.mjs, mutation landed anchor 1 to 0, restored blob == HEAD): DeletedRecordsLeaveRecents mount deleted from ConsoleShell.tsx turns the shell pin red, Tests 2 failed (2).
  • Ablation 2: the removeRecentItem(recordRecentItemId(...)) call in the hook replaced by a no-op turns 3 pins red (deleted record gone; undo revisit; shell drop), Tests 3 failed / 25 passed (28); restored, git diff HEAD empty.
  • No build between legs: ui vitest resolves @object-ui/* to src/ through ui/vitest.config.mts aliases.

Acceptance notes

  • A bulk delete (bulkDelete, bulk('delete')) emits one resource-level delete with no id, so its records stay in the recents until opened. Closing it needs the mutation event to carry the deleted ids (DataSourceMutationEvent in @object-ui/types), a public-type widening outside this card's surface. carrier: seat (named in the report's open_questions).
  • A record deleted elsewhere (another session or user) is not reported to this tab's data source, so it stays listed until opened. The card's optional route ("opening a recent whose record answers 404 drops it") lives in the record page's load path (RecordDetailView.tsx), which this card's claim fenced off; not done here. carrier: seat.

Verification

Local gates (head a6cbed1)
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 37 commands, each run, all exit 0 (including pnpm --dir ui exec vitest run scripts/ under the lock, pnpm check:test-source-alias, pnpm check:cross-package-test-inputs, pnpm check:nul-bytes, pnpm check:published-files).
  • --ran reconciliation: 37 derived, 37 run, 0 NOT-MEASURED, 0 UNRUN.
  • pnpm --filter @object-ui/app-shell type-check (after turbo run build --filter='@object-ui/app-shell^...'): both tsc --noEmit and tsc -p tsconfig.test.json, lock VERDICT command-exit 0.
  • pnpm --dir ui run check:new-line-citations: 0 new citations.
  • Every other family (lint, Test UI shards, Build and E2E UI, the required set): this PR's CI check-runs.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

维护者速读

  • 卡:删除记录后,命令面板「最近访问」仍列出该记录 #33826 — 删除的记录应立刻离开「最近访问」。
  • 改了什么:RecentItemsProvider.tsx 新增 useDropDeletedRecordsFromRecents,订阅数据源 onMutation 的 delete 事件,只移除 record:对象:ID 这一条;在 ConsoleShell.tsx 挂载一次(DeletedRecordsLeaveRecents),覆盖所有会上报记录的删除入口。
  • 钉子:RecentItemsProvider.test.tsx 新增一组(含对照:别的记录、update 事件、无 id 的批量删除都不动;撤销后重访回到首条;卸载即退订);新文件 ConnectedShell.deletedRecordLeavesRecents-33826.test.tsx 走真实 shell。两次消融各自转红(去掉挂载 2 红;no-op 掉移除 3 红)。
  • 面:5 个文件;ConsoleShell.tsx 与其钉子已在卡上补登文件面修订;RecordDetailView.tsx 未动(席位 1 的 编辑记录保存成功后,记录页约 3 秒内仍显示旧值 #33827 栅栏守住)。
  • CI:head a6cbed1 — success 38 · skipped 13 · 无失败;main 领先 0。
  • 风险:无公开类型或导出变化(Clause-② no);回滚即 revert;changeset 在根 .changeset/。

席位意见

从数据源删除事件统一入手,而非在每个删除入口各加一行,属于根因修法。遗留两点已在 PR 写明并由席位承接:批量删除事件不带 id(需扩 DataSourceMutationEvent 公开类型,另卡);他处删除需靠打开时 404 清除(落在 RecordDetailView.tsx,待 #33827 落地后再议)。同意落地。

席位核对 — ACCEPT · domain:ui#2 · head a6cbed1 · 2026-11-15T19:38Z

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 19:38
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43756689931 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test UI (2/16) — 失败步骤: Run the ui tests (shard 2/16)

    × a page behind the gate mounts once, so its child reads once per load 15ms
    FAIL   dom  packages/app-shell/src/hooks/__tests__/useLauncherApps-26838.test.tsx > the first /me/apps read is pending from the first render (objectstack#28085) > a page behind the gate mounts once, s
      ↳ 失败原因: AssertionError: expected "vi.fn()" to be called 1 times, but got 0 times
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • packages/app-shell/src/hooks/__tests__/useLauncherApps-26838.test.tsx — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 28 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

删除记录后,命令面板「最近访问」仍列出该记录

2 participants