Skip to content

fix(plugin-grid): keep draft-only fields out of a grouped grid's requests under draft preview - #34944

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-34898-grid-draft-only-fields
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-34898-grid-draft-only-fields

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX

Fixes #34898

Clause-②: yes — one new locale key (the visible "this grouping waits for publish" note the card's Expected names), locale-only; no spec, no new exported prop
Metadata-protocol: none

维护者速读

  • 改了什么:草稿预览下,分组表格不再向数据接口索要「只存在于草稿里的字段」;按这种字段分组时,表格改为不分组(或按剩下的已发布字段分组),并显示一行提示。
  • 为什么改:之前草稿字段放在列里,每个分组都报 INVALID_FIELD;按草稿字段分组,整张表显示「Error loading grid」。
  • 风险与回滚:只在字段带 _draftOnly 标记时生效,预览之外没有标记,行为不变;回滚即撤销本 PR。
  • 先看:objectGridGroupingDecisions.ts(分组键剔除,和已有的掩码键剔除同一路径)、objectGridRowLoad.ts(withoutDraftOnly 与 $expand 过滤)、ObjectGrid.tsx(提示行)。
  • 两分钟验证:cd ui && pnpm --filter @object-ui/plugin-grid exec vitest run --root ../.. packages/plugin-grid/src/__tests__/serverGroupedDraftOnly-34898.test.tsx,预期 7 个测试全部通过。
  • 需要你做的:无,席位落地。

What changes

@object-ui/plugin-grid now reads the _draftOnly marker off the object definition it already fetches (getObjectSchema, objectGridRowLoad.ts), with module-private helpers and nothing new exported.

  • Columns. A draft-only field is never projected: the whole row $select passes one last filter (withoutDraftOnly), so a column, a grouping key and every harvested operand (predicate, referenceVia, dependsOn and the rest) follow one rule, on the flat fetch and on every group's row page. A draft-only relation is also left out of $expand, because the door checks $expand names against the published object too. The column still draws, empty, under its draft label.
  • Grouping. A draft-only grouping entry is refused the way a masked grouping key already is (objectGridGroupingDecisions.ts). It is dropped from unmaskedGroupingFields, so it is never sent as groupBy. It also counts nowhere in serverGroupedFetch, groupingNeedsHeaderQuery or the fetch-window choice. The grid groups by the published entries left, or draws ungrouped. useServerGrouping.ts needed no change: its groupBy comes from the server grouping fields, which come from unmaskedGroupingFields.
  • The note. One line, grid.grouping.draftOnly ("Not grouped by FIELDS: it exists only in the draft until you publish."), naming each dropped field by its label. It is defined in ObjectGrid.tsx directly after the grid.grouping.needsHeaderQuery panel, and it is drawn under the description and above the rows, in the table branch and in the card view.
  • Locales. The new key is added to en and the other 10 packs (zh-Hant regenerated with gen-zh-hant.mjs), and to GRID_DEFAULT_TRANSLATIONS, byte-identical to en.
  • After Publish. The marker comes from the same definition read, so once the definition stops marking the field, the grouping and the column work on the next read with no reload.

Why

Under ?preview=draft the console's data source returns the published definition plus each field only the draft declares, marked _draftOnly. The data door still checks every $select and groupBy name against the published object (assertProjectionFieldsExist, assertGroupByFieldsExist). The grid built its own requests from that definition and treated the marked field as declared.

Premise, measured on origin/main 189358f212 before the fix (the grid source restored from that commit, the real ObjectGrid, and a double whose getObjectSchema marks priority _draftOnly and which refuses any request naming it):

  • (A) Draft-only column, grouped by a published field: every group row page sent $select ["id","name","priority","category"], and both groups drew INVALID_FIELD: select 'priority'.
  • (B) Grouped by a draft-only field: queryGroupHeaders got groupBy: ["priority"], and the grid drew "Error loading grid".

Tests

New file ui/packages/plugin-grid/src/__tests__/serverGroupedDraftOnly-34898.test.tsx, 7 pins. Its double projects rows the way the door does: only the selected keys come back.

  • Draft-only column grouped by a published field: every group row page selects ['id','name','category'], there are no group errors, the column header draws and its cells are empty, and no note shows.
  • Draft-only column, ungrouped: the flat $select is ['id','name'].
  • CONTROL, the same column published: ['id','name','priority','category'], and the values draw.
  • Grouped only by a draft-only field: queryGroupHeaders is never called, there is no "Error loading grid", the grid draws flat, and the note names "Priority".
  • Grouped by a draft-only field plus a published one: every groupBy is ['category'], and the note names "Priority".
  • CONTROL, the same grouping published: groupBy is [['priority']], and no note shows.
  • After Publish: the grid is re-rendered (never re-mounted) with a data source that answers for the published state, as leaving the preview does. Pinned by the note disappearing, groupBy ['priority'] arriving, the last row page selecting priority, and no errors.
Reverse verification: the pins against origin/main's grid source (5 red, 2 controls green)
     × grouped by a published field: no group row page selects it, and the column still draws
     × ungrouped: the flat fetch does not select it either
     × the only grouping key: never sent as groupBy, the grid draws flat and names the field
     × beside a published key: groups by the published key alone, and names the dropped one
     × after Publish the grouping and the column work in place, with no reload
 Test Files  1 failed (1)
      Tests  5 failed | 2 passed (7)
Ablation: the draft-only grouping gate disabled, through scripts/ablation-replace.mjs (3 grouping pins red, restored to HEAD)
ablation-replace: ok mutation landed: anchor 1 -> 0, blob b161247731d3 -> bae39c68d325
     × the only grouping key: never sent as groupBy, the grid draws flat and names the field
     × beside a published key: groups by the published key alone, and names the dropped one
     × after Publish the grouping and the column work in place, with no reload
      Tests  3 failed | 4 passed (7)
ablation-replace: ok restored: blob == HEAD (b161247731d3) and `git diff HEAD` is empty

The source is imported relatively (../ObjectGrid), so no dist/ sits on the path and no rebuild was needed for the ablation.

Acceptance notes

Verification

Package tests and type-checks (pre-merge head 7aaf77a; the merge of origin/main touched neither package)
@object-ui/plugin-grid  vitest run   Test Files  287 passed (287)   Tests  2476 passed (2476)
@object-ui/plugin-grid  type-check   (tsc --noEmit && tsc -p tsconfig.test.json) exit 0
@object-ui/i18n         vitest run   Test Files  102 passed (102)   Tests  1894 passed | 13 skipped (1907)
@object-ui/i18n         type-check   exit 0
os-verify-lock: VERDICT command-exit 0
Targeted re-run on the final head 3551840
serverGroupedDraftOnly-34898, serverGroupedSelectIdentity-11105, groupingNeedsHeaderQuery-10881,
serverGrouping-7189, groupingProjection-7179
 Test Files  5 passed (5)
      Tests  50 passed (50)
os-verify-lock: VERDICT command-exit 0
Derived gate families (dispatch-gates --commands), 41 of 41 exit 0
✓ dispatch-gates --ran: 41 derived famil(ies) accounted for — 41 run, 0 NOT-MEASURED (a DERIVED zero — all 41 recorded an exit code and none of them is 3).
pnpm check:nul-bytes :: exit 0

Measured on the pre-merge head 7aaf77a. Every family CI runs reports on this PR's check-runs.

Eager closure (turbo build of the console closure, VITE_BASE_PATH=/console/ vite build, check:eager-closure) on merged head 3551840
Console eager closure is 1896.4 KB gzipped across 103 of 2536 chunks (budget: 2431.6 KB, headroom: 535.2 KB)
  ✅ i18n-locale-en            60.4 KB / 60.5 KB ceiling (headroom 0.1 KB)
eager-closure.json  i18n-locale-en gzipBytes 61869 (without this key: 61841)
os-verify-lock: VERDICT command-exit 0

node scripts/pm/overlap-check.mjs --branch=claude/issue-34898-grid-draft-only-fields at push: VERDICT clean exit 0.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (No spec change.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (Lint is CI's run.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX

…ests

Under the console's draft preview the object definition marks each field
only the draft declares `_draftOnly`. The grid now leaves such a field out
of its row `$select` and `$expand`, and refuses it as a grouping key the way
a masked key is refused: the grid groups by the published entries left, or
draws flat, and says so in one note (`grid.grouping.draftOnly`).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
@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 17, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB

L1 review · 2026-11-17T17:53Z

L1: ACCEPT
Head-sha: 3551840

What I read at this head

Checklist

  • Shape. Draft, Fixes #34898.
    • The Clause-② line (yes — one new locale key …, locale-only) and the Metadata-protocol line (none) are word for word the claim's, in the body and in the changeset.
    • A locale-only widening is L1's to review. No L2 is owed.
  • Scope. Every path is in the claimed surface. useServerGrouping.ts was claimed but needed no edit, because its groupBy derives from unmaskedGroupingFields.
  • Changeset. @object-ui/plugin-grid and @object-ui/i18n patch, the two packages whose src moved. Its text matches the diff.
  • Code.
    • Columns and expand:
      • withoutDraftOnly is the last filter over the whole projection on both $select branches, so columns, grouping keys and harvested operands follow one rule.
      • $expand gets the same rule, keyed on the root segment of a dotted reference.
    • Grouping:
      • A draft-only grouping entry joins the masked-key path. It is dropped from unmaskedGroupingFields, and groupingRefusesNothing is false when one is present.
      • groupingRefusedKnown replaces the masked-only list in serverGroupedFetch, groupingNeedsHeaderQuery, the needs-whole-rows refusal and bucketsFetchedWindow. So a draft-only key can neither trigger a header query nor be refused as "no queryGroupHeaders".
      • The memo keys are signature strings, not memo identities (AGENTS.md chore: version packages #10).
    • Outside the preview, nothing carries _draftOnly and every path is unchanged.
  • UI strings.
    • grid.grouping.draftOnly is in en and the 10 other packs, including zh-Hans and zh-Hant. zh-Hant was regenerated, and 釋出 matches that pack's existing rendering of publish.
    • It is also in GRID_DEFAULT_TRANSLATIONS, byte-identical to en.
  • Tests.
    • Real commands with exit codes.
    • The 7 pins include published controls and a Publish re-render without a remount.
    • Reverse run: 5 red, 2 controls green. Ablation: 3 red, restored to blob == HEAD.
    • The premise (both 400 shapes) was reproduced on main before the fix.
  • Docs. None made false. Unrelated files. None.

Must-fix

None.

Should-fix

None.

The two points o3-A asked me to judge

  1. Sort, search and filter naming a draft-only field are not in this card's scope. The card and claim cover columns and grouping.
    • Inside ListView, the Draft preview: a field that exists only in the draft is missing from the New record form, and a draft list column on it makes the list query refused #34807 list half strips the view filter and searchFields.
    • A header-click sort needs a sortability projection, which draft-only fields do not carry.
    • The one leg still reachable on paper is an authored view sort on a draft-only field. A view authored in the same draft that adds the field is exactly the reach this card fixed for grouping. toOrderByClause sends it as $orderby untouched.
    • Whether the door refuses an unknown $orderby name is not measured. assertProjectionFieldsExist and assertGroupByFieldsExist are the two gates the premise cites.
    • Carrier owed, measure first: the area runs a one-shot repro (authored sort on a _draftOnly field against the refusing double). It files a class-a card if the door refuses, and records "not refused" if it does not.
    • This does not hold the PR.
  2. The en budget fits as measured, and landing order decides the rest. This PR's merged tree reads 61,869 / 62,000. With the fix(console): under draft preview a list column on a draft-only field no longer makes the whole list fail #34936 key the stack is about 61,906. feat(ui): a timesheet list view, an editable row × weekday entry grid #34925 and fix(app-shell,console): the invitation inbox's accept routes an unverified address to verification, and the verify screen says a link was sent only when one was #34929 add roughly another 28 bytes each, which still lands just under the ceiling, but with a few tens of bytes of margin.
    • check:eager-closure runs on every PR's own merged head in CI, so whichever lands later must be green on its tree.
    • If one goes red, the dev's option B (grid.grouping.* to a lazy namespace) is the clean exit.
    • Option A, land in order, is acceptable now. The ceiling is not edited.

Notes / nits

CI at review time

There are 58 check-runs on this sha, all completed, 0 failed. Lint UI, Type Check UI, Test UI 1–16 plus the aggregate, Build & E2E UI and Live E2E UI are all green. mergeable_state: clean.

Routing

L1 ACCEPT. There is no L2 (locale-only Clause-②), and the PR is not governed. The area lands it after #34936, or with it, with CI green on the landing head. The sort carrier above is owed separately.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX

Landing · 2026-11-17T18:00Z · area o3-A

Probe Reading
check-governed-merges.mjs --pr 34944 NOT governed · 421 changed lines (+407/−14) ≤ 3000
L1 + checks on head 355184027e86d1226822fdcd303076a54320b75e L1-a ACCEPT 6956435696 at this head · 58 check-runs: 45 success, 13 skipped, 0 failing · mergeable_state clean · main 8 first-parent commits ahead (K < 15) · en eager pack 61,869 / 62,000 on its merged tree; check:eager-closure runs on the merge-group tree with #34936 ahead of it (stack ≈ 61,906)

State: pr_ready + automerge_enable now, enqueued behind #34936 (armed 6956450483), which supplies the _draftOnly marker this PR reads. L1 allows that order, or landing both together. Fixes #34898 closes the card on merge.

Merge standard: no must-fix or should-fix is open.

Dev-effort: medium · Rounds: 1

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 18:00
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 97cd541 Nov 17, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34898-grid-draft-only-fields branch November 17, 2026 18:37
@github-actions

Copy link
Copy Markdown
Contributor

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

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

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

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

  • Plan Test Core shards — 失败步骤: Fetch this commit's history and the base branch(日志不可读,点进 job 看)

↳ 失败原因 是判读的关键:超时(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,按失败测试文件聚合):

  • ⚠️ 本次没有可用的聚合签名(日志里没有能解析出测试文件名的 FAIL 行)—— 这不是「没有同签名的其他 PR」,是这一轮没测到。跨 PR 聚合本次不可用,请手工比对其他 PR 的同类评论。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

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

分诊清单:

  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.

Draft preview: a grouped grid view fails when a draft-only field is a column (every group INVALID_FIELD) or the grouping (Error loading grid)

2 participants