Skip to content

fix(components): a wide table's right seam shadow shows when the table widens after its rows are drawn - #37253

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37239-sharing-rules-seam-shadow
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37239-sharing-rules-seam-shadow

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #37239

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:管理员在工作室「全部元数据」列表(例如共享规则)里,表格比可视区域宽时,右侧固定列前那道提示「右边还有列」的阴影现在每次都会出现;以前大约一半的打开次数不出现。
  • 为什么做:夜间回归测试因此变红(共享规则列表在 1440 宽下的可达性检查),这是让它恢复的产品修复。
  • 出错会怎样:最坏只是宽表右侧阴影不显示或多显示一次,不影响数据和操作;改动可直接撤回。
  • 要你做什么:无。

What changes

  • ui/packages/components/src/custom/use-horizontal-overflow.ts (useHorizontalOverflow): the box re-reads its overflow when the box, each child of the box, or each child's own children resize. Before, it watched the box and its direct children only.
  • Why that matters: every table here sits inside the shadcn Table wrapper (relative w-full, overflow-visible inside a box that scrolls). The wrapper keeps the box's width, so when the table element widens past the box with no row added and the box unchanged, no observer fired, overflowRight stayed false, and data-table's right seam shadow (data-table-scroll-shadow-right) was never drawn.
  • The same hook drives HorizontalOverflowBox (data-overflow-right and its edge or pinned seam), so a table placed in that box inside a wrapper (the approvals inbox mounts one that way) follows the table's width too. Pinned below; not measured live.
  • Changeset: @object-ui/components patch.

Why

Nightly nightly-tiers run 45554381420 (0a1b69c0b) failed ui/e2e/live/declared-sharing-rules-reach-13091.spec.ts: the seam shadow was not found within 5 s although the table's scroll box was wider than its client box.

Which suspect it is. #36978 (c48f06c87, the metadata list on ObjectGrid) is the change that exposed it, and is not itself wrong. It moved the list onto data-table and pointed the spec at data-table's shadow. That shadow carried a latent defect in useHorizontalOverflow, and the new list's layout hits it about half the time. #37089 (the permission set full-screen) is ruled out: it does not touch this list's grid or the overflow hook. Nothing else changed the data-table seam shadow between the last green nightly (d9c799c10, 2026-11-24) and the red one. The only other data-table.tsx edit in that window is #37124 (the footer summary row), which does not touch the overflow read.

Measured DOM (Chromium 1440x1000, this tree's Console against the workspace showcase backend, a requestAnimationFrame log of the scroll box from first paint):

before the fix, a failing open (12 of 20 opens ended like this):
  +1315ms sw=1134 cw=1134 child=1134 table=1134 rows=3 shadow=false   rows drawn, the table fits
  +1331ms sw=2168 cw=1134 child=1134 table=2168 rows=3 shadow=false   the columns widen the table
  +1384ms sw=1826 cw=1134 child=1134 table=1826 rows=3 shadow=false   ...and it stays without a shadow
a passing open: the table is already wider than the box when the rows draw (sw=1826 at the first frame)

after the fix (20 of 20 opens with a shadow), the same sequence:
  +1379ms sw=1134 cw=1134 child=1134 table=1134 rows=3 shadow=false
  +1391ms sw=2168 cw=1134 child=1134 table=2168 rows=3 shadow=false
  +1427ms sw=1826 cw=1134 child=1134 table=1826 rows=3 shadow=true

child is the wrapper, the box's only child, and it stays at 1134 throughout. That is why the old read never ran. The scrollbar-at-rest read in data-table already observed the table element itself, which is why the bar showed while the shadow did not.

So the product regressed, and the spec is unchanged. It still measures that the controls are in reach and that a seam shows while columns remain to the right.

Tests

  • data-table-scroll-shadow-12463.test.tsx: a new top-level describe. A recording ResizeObserver calls back only the observers watching the element that resized, as a browser does. The table element alone grows past the box (no scroll, no row added), and the shadow is drawn. CONTROL: a table that grows but still fits draws none.
  • horizontal-overflow-12708.test.tsx: a new top-level describe, the same reading for HorizontalOverflowBox with a wrapped table. CONTROL: a resize of the wrapper itself still re-reads.

Read first (by risk):

  1. use-horizontal-overflow.ts: the nested observe loop. It adds observers on grandchildren and changes no read.
  2. data-table-scroll-shadow-12463.test.tsx: the recording observer and the new describe.

Two-minute check: pnpm --dir ui exec vitest run packages/components/src/renderers/complex/__tests__/data-table-scroll-shadow-12463.test.tsx. Expect 8 passed, including "draws the shadow once the table alone grows past the box".

Unit and package runs at ddb6f6f: both pin files 15/15; the whole components package 510 files passed, 1 skipped; type-check green
pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/src/renderers/complex/__tests__/data-table-scroll-shadow-12463.test.tsx packages/components/src/__tests__/horizontal-overflow-12708.test.tsx
 Test Files  2 passed (2)
      Tests  15 passed (15)
pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/
 Test Files  510 passed | 1 skipped (511)
      Tests  4970 passed | 24 skipped (4994)
os-verify-lock: VERDICT command-exit 0
pnpm --filter @object-ui/components type-check   (tsc --noEmit && tsc -p tsconfig.test.json, the ui/ dependency closure built first)
os-verify-lock: VERDICT command-exit 0
Local gate families at ddb6f6f: 38 derived, 38 run, every one exit 0
node scripts/pm/dispatch-gates.mjs --ran FILE
Run reconciliation — 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3).
pnpm check:test-source-alias  -> exit 0
node scripts/pm/overlap-check.mjs  -> VERDICT clean exit 0 (origin/main; and with --pr=37168,37169,37166,37226: every one merges cleanly)

Acceptance notes

  • Ablation (one run, both pins, scripts/ablation-replace.mjs): deleting the grandchild-observe line, anchor 1 -> 0, blob 7965aaa9a907 -> aae15c0c6be7, makes both new pins fail. The data-table one fails with "Unable to find an element by: data-testid=data-table-scroll-shadow-right", and both CONTROLs stay green (Tests 2 failed | 13 passed (15)). Restored: blob == HEAD (7965aaa9a907), git diff HEAD empty. Both test files import the hook from source, so no build is involved.
  • Size: 4 files, 182 changed lines (176+, 6-).
  • Deviation: part of the scratchpad logs (the raw Playwright and probe outputs) was deleted mid-session by a process this run does not own. The readings above were copied from those runs as they finished.

Verification

The stack the nightly boots, step for step: ui/e2e/live/ci/start-backend.sh (this tree's CLI serving examples/app-showcase, a throwaway database), the Console built with VITE_BASE_PATH=/ and served by vite preview, then Playwright from ui/ with playwright.live.config.ts, Chromium.

Before the fix (main at d7f299c): the spec fails 5 of 10 repeats, with the nightly's error
playwright test --config=playwright.live.config.ts declared-sharing-rules-reach-13091.spec.ts --repeat-each=10
    Error: expect(locator).toBeVisible() failed      (Locator: getByTestId('data-table-scroll-shadow-right').first())
  5 failed
  5 passed (57.3s)
After the fix (Console rebuilt from this branch): 20 of 20, and the whole nightly list 28 of 28
playwright test --config=playwright.live.config.ts declared-sharing-rules-reach-13091.spec.ts --repeat-each=20
  20 passed (55.0s)
pnpm --dir ui run test:e2e:live:nightly     (the 14 spec files console-live-specs.live.test.ts runs)
  28 passed (1.7m)

The backend and the preview server this run started were stopped by their recorded PIDs.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (CI)
  • 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: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

Generated by Claude Code

…idth

useHorizontalOverflow watched the scroll box and its direct children only.
A shadcn Table sits in a full-width wrapper, so when the <table> widened
past the box with no row added, nothing called the read and the right
seam shadow never drew (Studio metadata list, nightly live spec).

Claude-Session: https://claude.ai/code/session_01QSeKYnxVj5xoUcFUWLa5Aw
Co-authored-by: Claude <noreply@anthropic.com>
@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 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head ddb6f6fbaab645200d0587125792f85db0406f4d · 2026-11-25T08:54Z

  • Shape. The PR is a draft against main, its first line is Fixes #37239, and a full close is right because the card is the nightly red and this PR is its whole fix. It changes 4 files, +176/−6: the hook, two pin files and one changeset. Nothing touches content/docs/releases/, CHANGELOG.md or packages/spec. The card is open, priority:p1 and pm:dispatched. The zone report is comment 7156592524 on nightly-tiers: red on main #37239 (2026-11-25T08:05:21Z).
  • Cause, checked on git. In the window between the last green nightly d9c799c10 and the red one 0a1b69c0b, three commits touch components/src/custom/, data-table.tsx, ui/table.tsx or the spec:
  • Root cause, not a mask. At head, data-table.tsx renders scroll box > <Table containerClassName="overflow-visible">. The shadcn Table is <div class="relative w-full …"><table/></div>. So the <table> is the box's grandchild, and before this PR it was never an observer target.
    • The other two effects in data-table (scrollsSideways and the rightShadow measure) already observe tableRef. That is why the bar showed while the shadow did not, which matches the PR's DOM log.
    • The fix changes no read. It only adds observer targets, so the shadow now follows the element whose width actually drives scrollWidth.
  • Cost and loops. The added targets are each direct child's children, all on the one existing ResizeObserver. That is 2 targets for data-table (wrapper and table) and 2 for the approvals inbox (wrapper and table). The grouped grid has min-w-max div plus a few data-table shell nodes. Rows sit at depth ≥3 (table > tbody > tr), so the count does not grow with table size.
    • read sets a boolean, and React skips the update when the value is unchanged.
    • Both shadows render as siblings outside the observed box (data-table-scroll-shadow-right; horizontal-overflow-shadow in HorizontalOverflowBox). data-overflow-right toggles only before: opacity. No observed node changes size because of a read, so there is no ResizeObserver loop.
  • Pins re-run at head (seat, throwaway worktree). Command: vitest run data-table-scroll-shadow-12463.test.tsx horizontal-overflow-12708.test.tsx. Result: Test Files 2 passed (2) · Tests 15 passed (15).
  • Ablation (seat). I deleted the single for (const grandchild …) observer.observe(grandchild); line and re-ran. Result: Tests 2 failed | 13 passed (15).
    • The HorizontalOverflowBox pin fails with Unable to find an element by: [data-testid="horizontal-overflow-shadow"].
    • The data-table pin fails with Unable to find an element by: [data-testid="data-table-scroll-shadow-right"].
    • Both CONTROLs stay green. Restoring the line gives a clean git diff. This matches the PR's ablation reading.
  • Pin quality. The recording ResizeObserver calls back only the observers registered on the element that resized, so these pins test which elements are targets. The data-table pin also checks the DOM shape (table.parentElement !== box, grandparent === box), so a later refactor that removes the wrapper cannot leave it green for the wrong reason.
  • Live evidence: the dev's reading, not re-run by the seat.
    • Before the fix: 5/10 repeats red with the nightly's error.
    • After the fix: 20/20, and test:e2e:live:nightly 28/28.
    • The raw logs were lost mid-session (this is declared as a deviation). The PR quotes them verbatim, with commands.
    • CI Live E2E UI is success at head.
  • Other consumers.
    • useHorizontalOverflow from custom/ has two callers: data-table.tsx:3585 and HorizontalOverflowBox.
    • HorizontalOverflowBox has two in-tree mounts. The first is ObjectGrid grouped (box > div.min-w-max, already covered as a direct child). The second is ApprovalsInboxPage (box > Table wrapper > table, now covered).
    • components/src/hooks/use-horizontal-overflow.ts (used by containers.tsx) is a separate hook with the same name. The PR does not touch it.
  • CI at head. There are 58 check-runs, all completed: 45 success, 13 skipped (path-filtered or opt-in), and 0 failure or pending. Lint & Repo Gates, TypeScript Type Check, Type Check UI, Test UI (16/16 shards), Live E2E UI, Check Changeset and Dogfood Regression Gate are all success. The whole-package 4,970-test reading is covered by the Test UI shards.
  • Merge state. origin/main is 9171bed0a65a. K = 6 (first-parent since merge-base d7f299c0b1e0). git merge-tree --write-tree origin/main HEAD exits 0 with no conflicts. None of the PR's four files, nor data-table.tsx or ui/table.tsx, changed on main since the merge-base.
  • Overlap. I checked all 40 other open PRs. Only feat(spec,console): ask_ai action type — focus the in-app assistant on a record #37215 touches any of these paths: it edits data-table.tsx, but not the scroll box or the overflow lines. A pairwise merge-tree with fix(components): a wide table's right seam shadow shows when the table widens after its rows are drawn #37253 is clean. No open PR touches use-horizontal-overflow.ts or either pin file.
  • Declarations. Clause-②: no and Metadata-protocol: none appear line-initial in both the PR body and the changeset. Kind none takes patch, and the changeset is '@object-ui/components': patch. That package has no private flag, so it is published and needs a changeset, which it has. There is no ! and no (narrowing), so dogfood_battery n/a is right.
  • Changeset, read sentence by sentence.
    • (1) The shadow while columns remain to the right: true, it is drawn from overflowRight.
    • (2) "only re-read … when the box itself or the element directly inside it changed size": true for size triggers. See N1.
    • (3) The wrapper keeps the box's width, and the shadow failed about half the time at 1440 px: matches the Table markup and the 5/10 reading.
    • (4) "now also watches what sits inside that wrapper": true, this is the grandchild loop.
    • (5) "every page that puts a table in the shared overflow box (for example the approvals inbox)": true for both in-tree mounts. See N2.
  • 维护者速读, read sentence by sentence.
    • "右侧固定列前那道…阴影现在每次都会出现": the spec's header says the seam sits at the pinned cells, and the 20/20 reading backs "every time".
    • "共享规则列表在 1440 宽下的可达性检查": this matches the spec, which uses viewport 1440×1000 and LIST = /studio/~all/metadata/sharing_rule.
    • "最坏只是…阴影不显示或多显示一次": true; this is a read-only visual affordance.
    • "要你做什么:无": true for Tier S, not governed.
  • N1 — In changeset sentence (2), the box also re-read on every scroll. So the shadow stayed hidden "until the user scrolled", not "never". This is cosmetic; a release-time rewording would be enough.
  • N2 — The grandchild depth is a heuristic. A public HorizontalOverflowBox consumer that nests the table three or more levels deep, with full-width wrappers, would still miss the widening. Effect deps are [ref, disabled], so targets are collected once and are not re-collected when the children are swapped. Neither applies to an in-tree consumer today (the <Table> in both mounts is static JSX). Both are pre-existing, and this PR does not make either worse. If it ever bites, the more precise design is an explicit content-element option (such as data-table's own tableRef).
  • N3 — feat(studio): a permission set opens full-screen at its metadata address; the sharing overview gets its own route #37089 is not literally "not touching this list". It edits ResourceListPage.tsx, but only on the permission-type branch, which this list never reaches. The ruling holds; only the PR body's wording is loose.
  • Landing: the zone lands it after measuring K; if K ≥ 15 it merges main first; a merge-only head move keeps this ACCEPT.

No must-fix, no should-fix.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYkkwuF6UuFtu85Yd5H

Landing · 2026-11-25T08:54Z · head ddb6f6fbaa · zone a4-S (#37239, p1)

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 08:55
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 7939732 Nov 25, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37239-sharing-rules-seam-shadow branch November 25, 2026 09:17
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.

nightly-tiers: red on main

2 participants