Repository navigation
Commit 17f3db8
fix(studio): Save waits for the CEL verdict to reach the page before it reads the hold (#36636)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ82MfFjFxvJRAyoku6XCvWt4)_
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
- [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>1 parent 99ece3c commit 17f3db8
2 files changed
Lines changed: 62 additions & 3 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views/studio-design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
| |||
116 | 125 | | |
117 | 126 | | |
118 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
119 | 165 | | |
120 | 166 | | |
121 | 167 | | |
122 | 168 | | |
123 | 169 | | |
124 | 170 | | |
| 171 | + | |
125 | 172 | | |
126 | 173 | | |
127 | 174 | | |
| |||
152 | 199 | | |
153 | 200 | | |
154 | 201 | | |
| 202 | + | |
| 203 | + | |
155 | 204 | | |
156 | 205 | | |
157 | 206 | | |
| |||
189 | 238 | | |
190 | 239 | | |
191 | 240 | | |
192 | | - | |
| 241 | + | |
193 | 242 | | |
194 | 243 | | |
195 | 244 | | |
| |||
0 commit comments