Skip to content

fix(components): re-measure the record header's width fold on another record - #36260

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35997-header-actions-width-cap
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35997-header-actions-width-cap

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread
Fixes #35997

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户在记录页或抽屉里用上一条/下一条切换记录时,顶栏操作按钮会按新记录重新排布:从操作多的记录切到操作少的记录后,放得下的操作重新直接显示(最多三个),不再被多余地收进「更多」菜单。
  • 属于记录页顶栏「最多显示三个操作、其余收进更多」那项改进的收尾,替经常翻记录的业务用户解决按钮莫名变少的问题。
  • 出错时最坏是顶栏某个操作仍被收进「更多」菜单里(点开仍可用),不影响数据;只是界面渲染变化,可直接撤回。
  • 无

What changes

  • PageHeaderActions (record header bar, fitWidth): the width cap the row's wrapping lowers is now stored with the key it was measured on, the record id from the record context plus the names of the page's own inline-eligible actions. A render whose key differs (another record, or a changed action set) draws the full budget (3, or the page's maxVisible), and the existing layout effect measures again, so a row that still wraps folds again one action at a time. The host-resize path (ResizeObserver clearing the cap) is unchanged.
  • The key is a string, so an equal record and action set never re-arms the fold and nothing loops: the cap is only set while the row wraps and the drawn budget is above the floor, as before.
  • The cap rule and the fold rule themselves (at most 3 inline, the primary never folds, host Edit never folds) are untouched.

Read first, by risk:

  1. ui/packages/components/src/renderers/layout/containers.tsx — the hunk at "A cap holds only for the record and action set it was measured on" (the key and the keyed read of the cap).
  2. same file — the layout effect writing setWidthCap({ key, cap: inline - 1 }).
  3. ui/packages/components/src/__tests__/page-header-record-bar-35593.test.tsx — the new top-level describe "re-measures the width fold on another record (objectstack#35997)".

Two-minute verification: pnpm --dir ui exec vitest run packages/components/src/__tests__/page-header-record-bar-35593.test.tsx from the repo root; expect 17 passed, among them "a record with fewer actions that fit draws min(maxVisible, count) again" and its CONTROL.

Tests

  • New pins in the existing shared harness for this row's width fold, as a new top-level describe (the harness file already pins the fold for the header bar, so the pins join it rather than a new file):
    • record A (four actions, the row wraps) folds to the primary; the host steps to record B (two actions, the row fits) by re-rendering the same tree with another record id and data: B draws both of its actions inline, i.e. min(maxVisible, count) = 2, with Edit kept.
    • CONTROL: the same switch where B's row still wraps folds B again to the primary (the fold still works after the reset).
  • Ablation (one-off, not kept): the keyed read reverted to an unkeyed one (widthCap ? widthCap.cap : null) through scripts/ablation-replace.mjs: the first pin goes red with expected [ 'Convert', 'Edit', 'More actions' ] to include 'Log call', 1 failed / 16 passed; restore verified by the tool (blob equals HEAD, git diff HEAD empty). The test imports the renderer from source, so no build sits between the mutation and the run.

Acceptance notes

  • Zone measurement: the record page and the drawers do not remount the view between records (the view's own comment on its feed key says no mount site passes a key=; the drawers swap recordIdOverride), so the row instance and its cap do survive a record switch; the defect reproduced in the new pin before the fix (the ablation leg is that reproduction).
  • The reset key carries the record id as well as the action names, as the card asks (record id or action list change). A switch between two records with the same action set therefore also re-measures once; that costs one extra synchronous layout pass and lands on the same fold.

Verification

Every reading below is at head 621ca521, taken under scripts/pm/os-verify-lock.sh (shared box).

Target file and package (green)
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/src/__tests__/page-header-record-bar-35593.test.tsx: Test Files 1 passed (1), Tests 17 passed (17).
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/: Test Files 503 passed, 1 skipped (504); Tests 4847 passed, 24 skipped (4871); lock VERDICT command-exit 0.
  • pnpm --filter @object-ui/components run type-check (both tsc --noEmit and tsc -p tsconfig.test.json; the test project lists the edited test file): lock VERDICT command-exit 0.
  • Dependency closure built first: turbo run build --filter='@object-ui/components^...' --concurrency=2, 48 of 48 tasks successful.
Ablation (red as expected, restored)
  • Mutation: the keyed read of the cap replaced by an unkeyed one, via scripts/ablation-replace.mjs (anchor 1 to 0, blob 4de451fd to cd81ae01).
  • Run: 1 failed, 16 passed; the failing case is "a record with fewer actions that fit draws min(maxVisible, count) again" with expected [ 'Convert', 'Edit', 'More actions' ] to include 'Log call'. The CONTROL stays green under the mutation, as a control should.
  • Restore: blob after restore equals HEAD (4de451fd), git diff HEAD empty.
Derived gates (dispatch-gates, 38 of 38 exit 0)
  • node scripts/pm/dispatch-gates.mjs --commands derived 38 commands for this diff; all 38 ran and exited 0, among them check:nul-bytes, check:published-files, check:cross-package-test-inputs, check:test-source-alias, check:type-check-coverage, check:type-check-debt, check:sdui-manifest, check-adr-0087-registration --base origin/main, check-empty-changeset --base origin/main, check-changeset-no-major --base origin/main and pnpm --dir ui exec vitest run scripts/ (Test Files 172 passed, 2 skipped; Tests 5122 passed, 2 skipped).
  • --ran reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN, every line carrying its exit code.
  • Outside the derivation: pnpm check:changeset-fixed exit 0 (its roster lives under .changeset/), and pnpm --dir ui run check:new-line-citations: 0 new citations.
  • Type-check lanes, the artifact-roster and wide-population families and the repo-wide lint are CI's.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5oLLK7uoxp33riiBJL

Final green head for L1: 621ca5215e9a956e3b087e2acfa5840ed82c1cbe. Check-runs on it (pr-state 04:20Z): 45 success, 13 expected skip, 0 unexpected skip, 0 failed, 0 pending; no commit status; mergeable state clean. Report: #35997 comment 7073895419. Sent to L1-d.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5ozidcgr4FYrKfmrjD

维护者速读

  • 在记录页或抽屉里切换记录后,顶栏操作按钮会重新按新记录排布:放得下的操作重新直接显示,不再沿用上一条记录被压低的个数。
  • 只改了顶栏按钮的排布计算,作者写的元数据不变。
  • 结论:通过。
  • 要你做什么:现在不需要。

席位核对 — ACCEPT (L1-d) · repo:objectstack#4 · head 621ca5215e · 2026-11-22T04:23Z

Read at 621ca5215e: 3 files, +109/−9. The face is Clause-②: no, Metadata-protocol: none. No contract face and not Tier H, so no L2 is owed.

Checked and fine

  • Shape. Draft, base main, first line Fixes #35997. Fixes is right: the card asks for the cap to reset on a record id or action list change, plus one pin; both are in the diff. l1-face is CLEAN (13 items).
  • The fix. widthCap is now { key, cap }. The key is JSON.stringify([ctx?.recordId, authored action names]), computed in renderHeaderActions, which runs on every render (not inside a memo), so a stale cap is never read. A cap is used only when its key equals the current one; otherwise the row draws maxVisible and the unchanged layout effect re-measures and writes a cap under the new key. Termination: each write is inline - 1 where inline = min(rowBudget, count) and rowBudget is the current cap, so caps strictly decrease and stop at the floor; the object state cannot loop. The ResizeObserver path still clears to null.
  • Premise. The report says the view is not remounted between records (drawers swap recordIdOverride), so the old cap did stick; the ablation leg reproduces it (keyed read reverted ⇒ the new pin red with expected [ 'Convert', 'Edit', 'More actions' ] to include 'Log call', CONTROL green, restore verified).
  • Tests. Two pins in the existing shared harness page-header-record-bar-35593.test.tsx, a new top-level describe. The placement deviation follows the AGENTS.md shared-harness rule and is accepted. The CONTROL pin shows the fold still lowers after a switch.
  • Changeset. Read sentence by sentence against the diff: the fold description, "stepping to another record … keeps the same row", "the full budget (3, or the page's maxVisible)", "a row that still does not fit folds as before" and "nothing an author writes changes" all match.
  • Seat 1 overlap. The diff touches containers.tsx only, not RecordDetailView.tsx or RelatedList.tsx. overlap-check.mjs --branch=pr-36260 --pr=36234,36236,36208: origin/main and all three seat-1 PR heads merge cleanly.
  • Epic. Consistent with 专题:记录详情页重做(头部两行;宽屏时字段在左、页签在右;全部子表各一页签;主从子表默认只是页签,分组指定才进字段区并随主记录一起保存) #35590's header rule (at most 3 inline, primary and host Edit never fold); that rule is untouched.
  • Gates. At 621ca5215e: 45 success, 13 expected skip, 0 unexpected skip, 0 failed, 0 pending; Lint & Repo Gates and TypeScript Type Check success; mergeable_state clean. Local runs in the body: components package 4847 passed, type-check exit 0, dispatch-gates --ran 38/38.

Nit (no re-read)

  1. The first pin switches record id and visible action set together (OTHER's status hides two actions), so it does not isolate the record-id half of the key alone. The card's scenario is exactly that switch, so nothing is owed.

Landing

  • Fixes #35997: merging closes the card; the area clears pm:dispatched at close per landing rule B. Non-governed, the area lands it.

Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5oLLK7uoxp33riiBJL

Landing · head 621ca5215e9a956e3b087e2acfa5840ed82c1cbe · ACCEPT → PR #36260 comment 7074159975 (L1-d)

Probe Reading
check-governed-merges.mjs --pr 36260 NOT governed; 118 changed lines (+109 / −9), under 3000
check-runs on the head 45 success, 13 expected skip, 0 unexpected skip, 0 failed, 0 pending; mergeable clean

State: ready + auto-merge; on MERGED Fixes #35997 closes the card and the area clears pm:dispatched.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 04:25
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit a60740a Nov 22, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35997-header-actions-width-cap branch November 22, 2026 04:47
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.

记录页顶栏操作宽度折叠:切换到操作更少的记录后,可见操作上限停留在旧的较低值

1 participant