Skip to content

fix(studio): Save waits for the CEL verdict to reach the page before it reads the hold - #36636

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-d5iokd
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-d5iokd

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #36619

What changes

studioSaveBar.tsx: the top bar's Save, after its existing wait past the lint debounce, now also awaits a render of its own at transition priority (useRendersSettled) before it reads the buffers' held. React commits that render only once no default-priority render is left, so the verdict's whole effect chain has reached the buffer's Save entry when Save reads it. No test file changes; the test is not skipped, retried, narrowed or slowed.

Why — root cause (product race, not test timing)

Both red cases fail on the first Save, before the tab is ever left: under load, all 4 red runs failed at DataPillar.panelHold-27629.test.tsx:233 (expect(save).not.toHaveBeenCalled() right after typing record.status == and pressing Save). Case (b)'s studio-held-message miss is the same race one step later: that Save already sent the broken text, the draft is clean, so no hold is left to name.

The Save read held a fixed 50 ms past LINT_DEBOUNCE_MS (VERDICT_SETTLE_MS). An action predicate's verdict reaches the object's Save entry through four effect-driven renders after the lint resolves: CelPredicateField → ConditionBuilder (onBlockingIssuesChange effect) → ActionDefaultInspector (effect) → ObjectActionsPanel (onCelVerdictsChange effect) → DataPillar (held, copied into the entry ref by a layout effect). On a busy main thread the lint timer and Save's timer come due in the same timer pass, so Save's continuation runs before any of those renders and reads the pre-edit verdict (count: 0, judged on true), then sends visible: "record.status ==". That is the product sending a formula its check has not judged, the invariant the Save bar's header states; the rule-guard cases have a shorter chain and stayed green.

Out of scope (Acceptance notes): the fix covers verdicts already reported when Save's timer fires. A lint still in flight then (a first-load dynamic import of the CEL engine on a slow network) is not awaited; closing that needs a pending-check signal from metadata-admin/CelPredicateField.tsx, outside this card's file surface. Not reproduced; recorded here only.

Verification

Loaded box: 4-core container, 4 busy-loop CPU stressors, vitest run --maxWorkers=2 on the file alone, consecutive runs.

runs red where
before (origin/main 9e2a4ac) 7 4 all at :233, case (a)
after (head ff094d2) 20 0 20 of 20 green in a row, all 5 cases each run

Every app-shell test file that saves through the top bar (27 files, 155 tests, the ones using pressStudioSave or useStudioSaveCoordinator): green locally.

Local tsc --noEmit on app-shell reports no error in the changed file beyond the container's unbuilt @object-ui/* module resolution, which every file shares; the type-check lanes are CI's.

Clause-②: no
Metadata-protocol: none

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 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: its generated artifacts are regenerated and committed. (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_01JQwxbXCSJnUMMhWxyBmuqA

… the hold

The top bar's Save read the buffers' held state a fixed 50 ms past the
lint debounce, but an action predicate's verdict climbs to the Data
pillar's Save entry through four effect-driven renders. On a busy main
thread the Save read the pre-edit verdict and sent the unparsable text
(DataPillar.panelHold-27629, 4 of 7 runs red under a CPU stressor).
Save now also awaits a transition-priority render of its own, which
React commits only after every default-priority render, the verdict's
last hop included.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXCSJnUMMhWxyBmuqA
@github-actions github-actions Bot added size/s 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 23, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

维护者速读

修好 Studio 里一个偶发失败的测试,它会把别人的 PR 踢出合并队列。原因在产品本身:系统忙时,顶部「保存」可能读到旧的校验结果,把写错的条件表达式也存了进去。现在保存会先等校验结果传到位再判断。
测试本身一行没改;修复后在高负载机器上连跑 20 次全绿,修复前 7 次红 4 次。
CI 全绿,65 行,非受管面,席位落地。合并后 2 号座位的 #36591、#36442 可以重新入队。
要你做的:无。

席位核对 — ACCEPT (L1) · repo:objectstack#1 · head ff094d24 · 2026-11-23T05:54Z

  • Shape: Fixes #36619. ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx (+55/−3) plus one patch changeset. Test file untouched: no skip, quarantine, retry or narrowing. Tier S (check-governed-merges: not governed); no L2 face (Clause-②: no).
  • Root cause (named by the thread, read by the seat): a product race. The top-bar Save read every buffer's held once VERDICT_SETTLE_MS had passed after the lint debounce. An action predicate's verdict reaches DataPillar's buffer through four effect-driven, default-priority renders (CelPredicateField → ConditionBuilder → ActionDefaultInspector → ObjectActionsPanel → DataPillar). On a loaded main thread, Save's timer and the lint timer fire in the same pass, Save reads the pre-edit verdict, and it sends record.status ==. Every red run failed at :233, the first Save, before the tab is left. Case (b)'s missing held line is the same race one step later.
  • Read: useRendersSettled commits a transition-priority state update and resolves in that render's effect. React does not start a transition-lane render while a default-lane update is pending, and it flushes pending passive effects before each render, so a synchronous effect chain already running finishes first. Waiters resolve on unmount, so Save never hangs. Residual, stated in the PR body: a lint still in flight when Save's timer fires (the engine's first import) is not awaited. Closing that needs metadata-admin/CelPredicateField.tsx, which is outside the surface. Not reproduced; no card filed.
  • Evidence: loaded box (4 busy-loop stressors on 4 cores, --maxWorkers=2, file alone). Before, on main 9e2a4acb: 4 red of 7, all at :233. After: 20 of 20 consecutive runs green, all 5 cases each. Also green: the 27 app-shell test files that save through the top bar (155 tests).
  • Gates: 56 checks on ff094d24: 41 success · 15 skipped · 0 failed (Test UI 16/16 included). landing-k can't answer for a ui-only PR (no Test Core ran); the seat's own reading is merge-base 9e2a4acb, K = 1 first-parent commit behind main.
  • Landing: ready + auto-merge now. On merge the seat tells seat 2, so fix(app-shell): a menu reordered in design mode is saved in the order the sidebar draws it #36622 and feat(console): preview images, PDF, text and CSV in the page from attachments and file fields #36587 can merge main and re-queue.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 05:54
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 17f3db8 Nov 23, 2026
57 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-d5iokd branch November 23, 2026 06:15
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… of the object (objectstack-ai#36651)

<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ82MfFjFxvJRAyoku6XCvWt4)_

Fixes objectstack-ai#36648
Fixes objectstack-ai#36653

## What changes

- `StudioDesignSurface.tsx`, the Data pillar's object load: a re-read on
the live-metadata pulse alone (`refreshOnly`) no longer clears the dirty
flag, the kept CEL verdicts and the served verdict as its effect starts.
It drops them when it installs, after the existing in-flight check
(`refreshOnly && objBuffersHeldRef.current` ⇒ keep the buffer). A full
load (another object, a publish, a reload) resets at the start as
before.
- New `DataPillar.pulseAfterSave-36648.test.tsx` (2 cases): types into
the window deterministically (the hook wrapped to report its release;
the keystroke runs in the microtask after it) and pins that the edit
stays, that a valid one is sent by the next Save, and that an unparsable
one is held. Both cases fail on `main` (`expected '' to be …`: the edit
is gone) and pass here.
- `DataPillar.panelGate.test.tsx` and `panelHold-27629` are untouched:
nothing skipped, retried, narrowed or slowed.

## Why — root cause (product, pre-existing; not objectstack-ai#36636)

The red in run 45133910959 is the **second** Save of the first case
(`panelGate.test.tsx:166`): `findByTestId('studio-save')` ran its full 4
s and the button never came back after the case typed `record.status
==`. The button is drawn only while the page holds an edit, so the edit
was gone.

A Save's publish sends the live-metadata pulse. The pillar holds it
while the buffer has work (`useMetadataRefreshNonce(objBuffersHeld)`)
and releases it in an effect the moment the Save ends; the next render's
load effect re-reads the object. That effect called `setDirty(false)`
(and cleared the verdicts) **as it started**, before the in-flight
check. A keystroke landing between the release and that effect therefore
lost its dirty flag; the read, finding nothing held, installed the
server's body over it; the edit and the Save button went with it. The
window is one scheduler gap, which a loaded merge-queue runner can open
between the case's Save and its next keystroke. For an author it is a
keystroke right after pressing Save that silently disappears.

Not objectstack-ai#36636: `StudioDesignSurface.tsx` and `useMetadataRefreshNonce.ts`
are byte-identical between objectstack-ai#36636's parent `99ece3c4` and `main`; the
window predates it. objectstack-ai#36636 changed only when Save reads `held`, before
any write.

## Verification

Loaded box: 4-core container, 4 busy-loop CPU stressors, `vitest run
--maxWorkers=2`, 20 consecutive runs.

| tree | files | runs | red |
|:--|:--|:--|:--|
| objectstack-ai#36636's parent `99ece3c4` | panelGate | 20 | 2: both `expected
"vi.fn()" to not be called` (:167, :175), the objectstack-ai#36619 verdict race objectstack-ai#36636
fixed |
| `main` `e9fa6b5d` | panelGate | 20 | 0 (the :166 timeout did not recur
in 20; the deterministic case above reproduces it) |
| this head `6e21473c` | panelGate + panelHold-27629 +
pulseAfterSave-36648 | 20 | 0: 20 of 20 green in a row, all 10 cases
each run |

Also green locally: every studio-design test file that saves through the
top bar, reads the pulse, or is a `DataPillar.*` suite (50 files, 259
tests).

## Also: the unit-project red that blocked this PR (objectstack-ai#36653)

`Test UI (7/16)` went red on `romanizeHan.test.ts:24` (`expected '
weixiu zhongxin ' to be '维修中心'`), a file the fix above does not touch.
Cause: test order, not product. The `unit` project runs files with
`isolate: false`; `layout/__tests__/designModeMenuCreate-36364.test.ts`
(landed 08:11Z with objectstack-ai#36606) calls `loadHanRomanizer()` in its
`beforeAll`, so when it ran earlier in the same worker the shared
`romanizeHan` module was already loaded and the "before the dictionary
has loaded" cases read romanized text.

- Reproduction: `vitest run --project unit --maxWorkers=1
designModeMenuCreate-36364.test.ts romanizeHan.test.ts` fails at `:24`
with CI's exact message on `main` `3cf6a44b`.
- Fix (separate commit, test only, no product code, no changeset): the
before-load describe reads its own instance (`vi.resetModules()` +
dynamic `import('./romanizeHan')`) and still pins "unchanged and pending
until loaded"; a new case pins that the same instance stops being
pending once it loads. Nothing skipped, retried or narrowed.
- Counts: neighbour first, `--maxWorkers=1`, 4 busy-loop CPU stressors
on a 4-core box, 20 consecutive runs: 20 of 20 green (red before).
Alone: green.

Clause-②: no
Metadata-protocol: none

## Human Minimum

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JQwxbXCSJnUMMhWxyBmuqA

<!-- signed: repo:objectstack#1 · os-warren ·
session_01JQwxbXCSJnUMMhWxyBmuqA -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants