Skip to content

fix(drill): "Open in list" is offered only when the list can show exactly the drawer's records - #30735

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-qgekwo
Nov 6, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-qgekwo

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #30654

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:仪表盘和报表下钻抽屉里的「在列表中打开」,以及 drillDown.target: 'navigate',现在只有列表页的 URL 能把下钻筛选原样写出来时才给出口;写不全就不给,留在抽屉里。
  • 为什么改:下钻筛选 = 点中的分组 ∧ 组件筛选 ∧ 度量的下钻范围。URL 一个参数只能放一个值、也写不了 $in,以前会丢掉条件,打开的列表比抽屉里的数字更宽(抽屉 0 张发票,列表 4 张)。
  • 风险与回滚:只影响下钻出口是否显示;单条件等值和日期区间下钻的 URL 逐字节不变。布尔值分组的下钻现在也不再给出口(沿用相关列表「查看全部」的同一条精确规则)。回滚即 revert 本 PR。
  • 先看:ui/packages/app-shell/src/views/useOpenRecordList.ts(drillRecordListFilter、useRecordListDrillNavigation)、ui/packages/react/src/context/DrillNavigationContext.tsx(新可选成员)、ui/packages/plugin-charts/src/ObjectChart.tsx 的两处守卫。
  • 两分钟验证:app-showcase「Revenue Pulse (filtered)」→「Paid Rate by Status」表格 → Sent 行的 Paid Invoices 格子:抽屉 0 行,右上角没有「在列表中打开」;同一行的发票数格子仍有,点开 URL 是 filter[status]=sent 加组件的日期区间。
  • 需要你做的:无,席位落地。

What changes

  • @object-ui/react: DrillNavigationValue gains an optional canOpenRecordList(objectName, filter): boolean. Absent means the host claims every filter it is handed has an exact destination, which is how hosts behaved before.
  • @object-ui/app-shell: useRecordListDrillNavigation() returns { openRecordList, canOpenRecordList } for DashboardView and ReportView. Both go through the new pure drillRecordListFilter, which resolves placeholders first (resolveFilterPlaceholders with the same useFilterScope scope the navigate arm always used), then asks exactRecordListFilter (reused unchanged, with usePermissions().checkField(object, field, 'read')). openRecordList navigates to the exact filter and does nothing when there is none, so a caller that skipped the question still never lands on a wider list. useOpenRecordList stays as the navigate half.
  • @object-ui/plugin-dashboard: OpenInListButton renders nothing, and DrillDownDrawer's navigateOnly is false, when canOpenRecordList answers false. The drill then stays in the drawer, the same fallback as a host with no openRecordList.
  • @object-ui/plugin-charts: ObjectChart's navigate arm and its own drawer-header "Open in list" ask the same question (with drillFilter and merged respectively).
  • The 13 DashboardView / ReportView tests that mock ./useOpenRecordList now mock useRecordListDrillNavigation instead (mechanical, same vi.fn() opener).
  • One changeset: patch for the four packages (Metadata-protocol: none ⇒ patch; Clause-②: yes (widening) for the new optional interface member, per the claim amendment).

Answers to the claim's two questions:

  • A drillDown.target: 'navigate' click with no exact destination opens the in-place drawer (no navigation, no dead click).
  • Placeholders are resolved before the exactness check, inside drillRecordListFilter, with the scope useOpenRecordList already read; a {current_user_id} that resolves to the same value as a bucket on the same field is one exact param (pinned).

Tests

New pins:

  • useOpenRecordList.placeholderScope-9022.test.tsx, new top-level describe (6 cases): the repro shape composeDrillFilter({ status: 'paid' }, { status: 'sent' }) answers false and openRecordList does not navigate; an $in scope answers false; a plain equality bucket answers true and opens byte-for-byte /apps/crm/invoice/data?filter%5Bstatus%5D=sent; the same condition twice is one param; placeholders resolve before judging; an unreadable field answers false. The file's existing CONTROL (equality + date range URL pinned as a whole string) stays green unchanged.
  • DrillDownDrawer.escapeHatch.test.tsx, new top-level describe (4 cases): host answers false ⇒ no button, asked with the drill filter; navigate stays in the drawer; host answers true ⇒ button; host without canOpenRecordList ⇒ old behaviour for both the button and navigate.
  • ObjectChart.drillNavigate.test.tsx, new top-level describe (2 cases): host answers false ⇒ drawer, no header button; host answers true ⇒ navigates. The file's existing four cases (no canOpenRecordList) are the unchanged-host control.

Ablation (each on the committed fix, restored to the HEAD blob by scripts/ablation-replace.mjs; the tests import the source relatively, no dist/ involved):

Mutation Result
delete the OpenInListButton guard 1 failed / 7 (host answers false case)
DrillDownDrawer navigateOnly guard → true 1 failed / 7 (navigate stays in drawer)
ObjectChart navigate guard → true 1 failed / 6
ObjectChart header-button guard → true 1 failed / 6
drillRecordListFilter returns the resolved filter unjudged 3 failed / 12 (repro, $in, unreadable field)
Test runs

On 7643fb85 (before the main merge):

  • vitest run packages/plugin-dashboard/ packages/plugin-charts/ packages/react/ + the 42 app-shell test files that name useOpenRecordList, DrillNavigation, DashboardView, ReportView, OpenInList, DrillDownDrawer, drillUrlFilters, recordListPath or exactRecordListFilter: Test Files 485 passed (485), Tests 5230 passed | 15 skipped (5245).
  • type-check for @object-ui/react, @object-ui/plugin-dashboard, @object-ui/plugin-charts, @object-ui/app-shell: all four Done, lock VERDICT command-exit 0.

Declared narrowing: the rest of app-shell's 2208 test files are left to CI's Test UI (a full local run did not finish inside the box's budget at 2 workers).

On 7519c053 (after merging origin/main, which touched ui/packages/core exports, and a rebuild of the app-shell closure): plugin-dashboard + plugin-charts full + the same 42 app-shell files, Test Files 348 passed (348), Tests 3662 passed | 15 skipped (3677); the four type-checks Done; lock VERDICT command-exit 0.

Acceptance notes

  • exactRecordListFilter is reused unchanged, so its refusals now apply to drills too: a drill on a boolean bucket ({ is_paid: true }), on $ne, on a text operator, or with a placeholder that cannot resolve to a comparand the route carries no longer offers "Open in list" (the drawer still lists the records). Before, those opened a list scoped by a string comparand or with the condition dropped.
  • ReportView's group-key fallback drill (older server with no drill metadata) goes through the same host, so it is judged the same way.
  • The PR carries no assignee or reviewer: the seat sets them at hand-over.
  • Branch is the card thread's harness branch (claude/project-thread-qgekwo, claim amendment 6671583364), not claude/issue-30654-*.

Verification

Live, app-showcase on its own port (pnpm dev -- --fresh), Console via Vite, headless Chromium at 1440 px. "Revenue Pulse (filtered)" → "Paid Rate by Status", Sent row (Sent 4 0 0.0%):

Paid Invoices cell drawer "Open in list" there Invoice count cell "Open in list" URL
before (the seven source files at origin/main) 0 rows shown /apps/com.example.showcase/showcase_invoice/data?filter%5Bissued_on%5D%5Bgte%5D=2026-08-07&filter%5Bissued_on%5D%5Blte%5D=2026-11-05&filter%5Bstatus%5D=sent
after 0 rows absent identical string
Derived gates

node scripts/pm/dispatch-gates.mjs --commands on 7643fb85: 35 families, all exit 0. pnpm --dir ui exec vitest run scripts/ was killed by the container's memory limit while the live rig ran (exit 1, SIGKILL, no verdict) and re-run alone: Test Files 170 passed | 2 skipped (172), exit 0. --ran with exit codes: "35 derived famil(ies) accounted for — 35 run, 0 NOT-MEASURED (a DERIVED zero — all 35 recorded an exit code and none of them is 3)". check:nul-bytes exit 0.


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 6, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-sales · session_01L6bhgWn6zhNa4LL7VB1rtL

维护者速读

  • 改了什么:看板和报表的下钻抽屉里,"Open in list"(以及 drillDown.target: 'navigate' 和图表头部的按钮)只有在列表页的 URL 能一字不差地表达这次下钻的筛选时才出现;表达不了就留在抽屉里,不再打开一个比抽屉更宽的列表。
  • 为什么改:Drill drawer "Open in list" opens a wider list than the drawer when the drill filter has two conditions on one field or an $in #30654。比如「已发送发票里已付款的数目」是 0,抽屉也列出 0 条,可 URL 只能写 filter[status]=sent,打开后是 4 张发票,读者会被误导。
  • 风险与回滚:@object-ui/react 的 DrillNavigationValue 新增一个可选成员 canOpenRecordList;宿主不提供时,行为和改前完全一样。单条件等值下钻的 URL 逐字节不变。代价是布尔分组、$ne、$in、文本运算符的下钻也不再给出口(沿用 related list「View all」既有的精确规则),已另开 Drill "Open in list" and related-list "View all" are withheld when the drill holds a boolean, $ne, $in or text-operator condition: the list route's URL cannot carry them #30743 去扩 URL 的表达能力。回滚即撤本 PR。
  • 先看:ui/packages/app-shell/src/views/useOpenRecordList.ts 的 drillRecordListFilter 和 useRecordListDrillNavigation,再看 DrillNavigationContext.tsx 的新成员说明。
  • 两分钟验证:cd ui && pnpm exec vitest run packages/app-shell/src/views/useOpenRecordList.placeholderScope-9022.test.tsx packages/plugin-dashboard/src/__tests__/DrillDownDrawer.escapeHatch.test.tsx,预期全绿,其中的复现形状(status = sent 分桶叠加 status = paid 范围)不给出口。
  • 需要你做的:无,席位落地。
  • 席位意见:可合。

席位核对 — ACCEPT · head 7519c05

  • 形态:24 文件,+422/−50。check-governed-merges --pr 30735:0/24 条路径落在受管面,472 行 ≤ 3000。Fixes #30654,目标 main。全在认领 6671504511 与修订 2(6671622125)的文件面内:
    • 源文件:useOpenRecordList.ts、DashboardView.tsx、ReportView.tsx、OpenInListButton.tsx、DrillDownDrawer.tsx、ObjectChart.tsx,以及修订 2 放进来的 DrillNavigationContext.tsx。
    • 测试与 changeset:13 份 Dashboard/Report 测试只把 mock 换成新的 hook 名;另有 4 份新增或扩充的测试,一个 changeset(四个包均为 patch)。
    • 没碰:drillUrlFilters.ts、exactRecordListFilter 本体、RelatedRecordActionsBridge.tsx、ui/packages/core/**、packages/**。
  • 契约复核(TIER_DEFAULT,席位本人,Clause-② yes (widening)):
    • 放宽面只有一处:已发布接口 DrillNavigationValue 多了可选的 canOpenRecordList?(objectName, filter?): boolean。
    • 缺省时等同 true:三个出口都写成 !canOpenRecordList || canOpenRecordList(...),所以只接了 openRecordList 的老宿主行为不变,这有 CONTROL 测试钉住。
    • 没有删除或收紧任何已有成员。useOpenRecordList 仍然导出,现在是新 hook 的薄包装。
    • 新类型 RecordListDrillNavigation 和函数 drillRecordListFilter 只在 app-shell 内部模块里,不进包入口。
    • Metadata-protocol none,线上格式不动。changeset 给 @object-ui/react 打 patch,按 AGENTS 对非协议改动的规则,Check Changeset 绿。结论:PASS。
  • 席位逐行审读:
    • 宿主的判断顺序和导航臂一致:先用同一个 useFilterScope 解析占位符,再交给 exactRecordListFilter。
    • 字段读权限用 usePermissions().checkField(object, field, 'read')。没有 provider 或没有该对象的配置时答允许,和列表页丢弃不可读字段条件的规则一致。
    • openRecordList 只导航到 exactRecordListFilter 写出的那份筛选,答 null 时不导航,所以没先问 canOpenRecordList 的调用方也落不到更宽的列表。
    • navigate 拿不到精确目的地时退回抽屉,和没接导航的宿主是同一条退路。
  • 前提实测:dev 报告 6672865626。
    • 实测修复前,Sent × Paid Invoices 抽屉 0 行却给出口;修复后不给。Sent × Invoices 的 URL 前后完全相同。
    • 定向 9 个文件 84/84 绿;plugin-dashboard、plugin-charts、react 加 42 个下钻相关的 app-shell 测试文件共 485 文件、5,230 例绿。合 main 后的 7519c053 上复跑 348 文件、3,662 例绿。四个包 type-check 通过。
    • 五处消融(按钮守卫、抽屉 navigate 守卫、图表 navigate 守卫、图表头部守卫、drillRecordListFilter 不判)各自转红,已还原。
    • 派生门禁 35/35 exit 0,--ran 0 NOT-MEASURED。app-shell 其余测试文件交给 CI 的 Test UI,那里是绿的。
  • 门禁 check-runs:head 上 55 个,44 success,11 skipped,0 红。
  • 接受的偏差 / 收窄:布尔分组、null/Date 比较值、$ne、$in/$nin、文本运算符、$or 的下钻也不再给 "Open in list"。这是 exactRecordListFilter(record:related_list View all drops the list's object_name filter, so a reader admitted by approvalsVisibleToReaders sees 0 approval requests on the full list #25888)原有的规则,related list 的「View all」早就这样。以前这些下钻有时打开的就是更宽的列表,所以宁可不给。要恢复它们,得让列表路由能精确表达这些条件,已立 Drill "Open in list" and related-list "View all" are withheld when the drill holds a boolean, $ne, $in or text-operator condition: the list route's URL cannot carry them #30743,不在本卡。
  • 落地条款:中继 pr_ready + automerge_enable。合并即关卡(Fixes),席位同一笔摘掉 pm:dispatched;GitHub 没自动关卡就由席位手动关。

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.

Drill drawer "Open in list" opens a wider list than the drawer when the drill filter has two conditions on one field or an $in

1 participant