Repository navigation
fix(app-shell): Studio's shared draft autosave sends an edit made while a save is in flight — one sent-snapshot check in useDraftAutoSave for every caller (objectui#11204) - #11230
Conversation
…le a save is in flight (objectui#11204) useDraftAutoSave now hands every save it sends a DraftSend claim on the snapshot it sent. A caller's post-await set*Dirty(false) runs only while sent.unmoved(): the buffer, as last committed, still serialises to what the save sent. An edit taken while the save was in flight keeps the buffer dirty, and the autosave, unblocked when the save ends, sends it next. Callers: the Interfaces page inspector, the nav autosave, DataPillar (its autosave, and the grid column reorder it sends itself, via sending(body)), and AutomationsPillar. The nav autosave's per-pillar edit generation (navGen, objectui#11189) is retired in favour of the same claim: content comparison also clears an edit that was undone while the save was in flight, which a generation left dirty for good. The hook's committed-snapshot ref is now written in a layout effect, so a save that lands right after an edit reads the edit. Claude-Session: https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec Co-authored-by: Claude <noreply@anthropic.com>
…accessible name (objectui#11204) Claude-Session: https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec Co-authored-by: Claude <noreply@anthropic.com>
|
changeset-claim-re-read
|
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Contract reviewServed-tier: PR objectui#11230 for card objectui#11204 (p1; triage ① Derived judgmentsCheck-runs on the head. Read at the start with ten runs still in progress, then re-read until every run had completed (the last, the The base measurements (right). Six cases, 5 red / 1 green on base The
Every post-await clear goes through the claim (right). Nine
The hook's return and the layout effect (right; no risk found).
No NavTree row, no import line (right). The import block is The two ablation legs (coherent; read as reported, not re-run). Leg A (the claim always unmoved) 6 red / 6 green: the four in-flight pins here plus the two in-flight pins of objectui#11189's suite are exactly the pins the check carries; the Data control, the nav undo case (unmoved is the right answer there) and the four other objectui#11189 pins do not depend on it. Leg B (Automations' unconditional clear restored) 1 red / 11 green, the Automations pin alone. Both legs total 12, six here and six there. The first leg B attempt was a tool refusal before any run, not a reading. Restores blob-equal to the head. ② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
Fixes #11204
Clause-②: no
What changes
Studio's shared
useDraftAutoSave(inStudioDesignSurface.tsx) now owns the one check that every caller's post-await dirty clear goes through. It hands each save it sends aDraftSendclaim on the snapshot that save sent. A save that lands runs itsset*Dirty(false)only whilesent.unmoved()is true, which means the buffer, as last committed, still serialises to what was sent. If an edit is taken while the save is in flight, the buffer stays dirty. The autosave is unblocked when the save ends, and it sends that edit next.{ flush, sending }. Both come from a state initializer, so their identity is stable (AGENTS.md [WIP] Enhance every detail of the designer #10).flushbehaves exactly as objectui#11189 left it.sending(body)gives a claim to a save that the caller sends itself, not through the timer.pendingRef, also read byflush) is now written in a layout effect. It is therefore current as soon as a render commits, so a save that lands right after an edit reads that edit.useDraftAutoSaveis module-private. No schema, prop, type or accepted set moves.Measured before the fix: base
c3df43a42, every callerThe mount is happy-dom, with the real pillars and the real registered
FlowPreview/FlowInspectorandPagePreview/PageBlockInspector/PageDefaultInspector, as in the objectui#11124 and objectui#11136 harnesses. The Data pillar's records grid is a double that hands the pillar a column order through the grid's own authoring context. A server double holds the first save in flight. Each row is read 3.5 s after that save lands. The pins below are these same cases. They are red on the base, and the red diffs are these readings.doSave(the control)doSave(autosave)doReorderFields(a save the pillar sends itself)doSavedoNavSave(withnavGen)All five reproduce. The Automations row reproduces objectui#11189's reading, so it is the control. Data and the page inspector reproduce too; they had been read at source only. The nav row is the case the per-pillar generation got wrong: the buffer equals what landed, yet it stays dirty for good, and the leave guard, the copilot refresh hold and "Done" all stay stuck until another edit is made.
Every post-await dirty clear, and where each one goes now
doSavebecomesif (sent.unmoved()) setIfDirty(false).doNavSavebecomesif (sent.unmoved()) setNavDirty(false), replacing thenavGencomparison.doSavebecomesif (sent.unmoved()) setDirty(false).doReorderFieldsis outside the hook's timer, but its clear goes through the same check, with a claim fromsending(body).doSavebecomesif (sent.unmoved()) setAutoDirty(false).The unconditional clears that remain are buffer replacements, not save completions: each pillar's load effect, and the nav read-only put-back. The objectui#11167 effect's text is unchanged.
navGen: folded into the hookThe nav autosave now reads the same claim.
navGen, its bump inonNavPatchand the committed generation are gone.navCommittedRefkeeps onlydirty, which the app load's same-package install guard still reads, unchanged. The nav autosave can use the hook's mechanism because every nav edit changesappDraft, the snapshot the hook already serialises, anddoNavSavesends a cleaned copy of exactly that snapshot. The claim compares content, not an edit count, which is the last table row: a generation cannot tell an edit that was undone during the flight from one that was not. PR objectui#11202's pins still assert the same behaviour and are green unmodified: "Done" flushes, an Add during a held save lands in the next save, and the leave guard holds.For objectui#11203, which rides after this card
A nav save that lands after a package switch has installed the other package's app now reads the buffer as moved, and leaves
navDirtyset.navGencleared it, because a load's install never bumped the generation. So the switch-during-a-save-in-flight interleaving now also reaches that card's spurious save on the switched-to package. Before, only the ordinary case (an unsaved edit, no save in flight) did. That card's reset gets simpler: there is no generation left to keep in step. A reset ofnavDirtyand nav editing at the switch closes this interleaving too, because the landing save's claim reads moved and leaves the reset alone.Tests
New:
StudioDesignSurface.autosaveInFlight-11204.test.tsx, with 6 cases:Ablation, at
201233e1aEach leg went through objectstack's
scripts/ablation-replace.mjsin WRAP mode, which verifies the anchor count, the blob change, the restore blob against HEAD, and thatgit diff HEADis empty afterwards. The subject is the source, imported by relative path, so nodistis involved. The prediction for every leg was red on the named pins.Gates, at
201233e1aturbo run build --filter=@object-ui/app-shell^...): 28/28, exit 0.pnpm --filter @object-ui/app-shell type-check: exit 0.tsconfig.test.json --listFilesOnlylists the new test.vitest run packages/app-shell/src/views/studio-design/, in 3 chunks: 77 files / 437 tests passed.scripts/__tests__/suite, because a changeset is markdown: 177 files passed, 2 skipped; 5371 tests passed, 2 skipped.StudioDesignSurface.tsxkeeps its 18 warnings, the same rules and messages as the base copy apart from line numbers.check-changeset-presence,check:control-bytes,check:new-line-citations(0 new),check:changeset-claims,check:pending-changeset-literals,changeset:checkandmarkdown-test-inputs --audit.Declared narrowing: the whole-repo
pnpm test,pnpm lintand other packages' type-checks run in CI. Only suites understudio-design/mount these pillars; the consoleStudioRoutetests stub the surface.Acceptance notes
autoDirtyin itsfinally, which also runs when the load fails. Read, not measured; not filed.pendingRefis not pinned. The harness's edits are discrete events, which also flush passive effects in the same commit.6681-declared-lazy-marketplace-routes.mdnames this file only as an importer ofSuggestedBindingsPanel. That stays true.The author is the
domain:uiseat 2 dev agent, sessionhttps://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec, branchclaude/issue-11204-draft-autosave-generation.Generated by Claude Code