Repository navigation
fix(studio): an edit typed as a Save ends survives the Save's re-read of the object - #36651
Merged
Merged
Conversation
The Data pillar's re-read on the live-metadata pulse cleared the dirty flag and the kept CEL verdicts as its effect started. The pulse is released the moment a Save ends, so a keystroke landing between that release and the effect lost its dirty flag, the read then saw nothing held and installed the server's body over it, and the top bar's Save went with the edit. A pulse-only re-read now drops the buffer's state only when it installs, behind the existing held check. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXCSJnUMMhWxyBmuqA
This was referenced Nov 23, 2026
The `unit` project runs files with isolate: false, so a file earlier in the same worker that loads the pinyin dictionary (designModeMenuCreate-36364 does, in its beforeAll) left the shared module instance loaded, and the "before the dictionary has loaded" cases read romanized text. Those cases now read their own instance (vi.resetModules + dynamic import), and pin that the same instance stops being pending once it has loaded. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXCSJnUMMhWxyBmuqA
Contributor
Author
|
repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj 维护者速读修好 Studio 里又一个偶发失败的测试(它把别人的 PR 踢出过合并队列)。原因在产品本身,而且早就存在,不是上一个修复带来的:在数据设计里点「保存」后,页面会重新读取对象;如果用户在保存刚结束的一瞬间又敲了字,这次输入会被服务端的旧内容盖掉,「保存」按钮也一起消失。现在这次输入会被保留,可以接着保存。 席位核对 — ACCEPT (L1) · repo:objectstack#1 · head
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Warren · project thread
Fixes #36648
Fixes #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.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 onmain(expected '' to be …: the edit is gone) and pass here.DataPillar.panelGate.test.tsxandpanelHold-27629are untouched: nothing skipped, retried, narrowed or slowed.Why — root cause (product, pre-existing; not #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 typedrecord.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 calledsetDirty(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 #36636:
StudioDesignSurface.tsxanduseMetadataRefreshNonce.tsare byte-identical between #36636's parent99ece3c4andmain; the window predates it. #36636 changed only when Save readsheld, before any write.Verification
Loaded box: 4-core container, 4 busy-loop CPU stressors,
vitest run --maxWorkers=2, 20 consecutive runs.99ece3c4expected "vi.fn()" to not be called(:167, :175), the #36619 verdict race #36636 fixedmaine9fa6b5d6e21473cAlso 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 (#36653)
Test UI (7/16)went red onromanizeHan.test.ts:24(expected ' weixiu zhongxin ' to be '维修中心'), a file the fix above does not touch. Cause: test order, not product. Theunitproject runs files withisolate: false;layout/__tests__/designModeMenuCreate-36364.test.ts(landed 08:11Z with #36606) callsloadHanRomanizer()in itsbeforeAll, so when it ran earlier in the same worker the sharedromanizeHanmodule was already loaded and the "before the dictionary has loaded" cases read romanized text.vitest run --project unit --maxWorkers=1 designModeMenuCreate-36364.test.ts romanizeHan.test.tsfails at:24with CI's exact message onmain3cf6a44b.vi.resetModules()+ dynamicimport('./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.--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
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbXCSJnUMMhWxyBmuqA