Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

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

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-11204-draft-autosave-generation
Sep 30, 2026

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #11204
Clause-②: no

What changes

Studio's shared useDraftAutoSave (in StudioDesignSurface.tsx) now owns the one check that every caller's post-await dirty clear goes through. It hands each save it sends a DraftSend claim on the snapshot that save sent. A save that lands runs its set*Dirty(false) only while sent.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.

  • The hook now returns { flush, sending }. Both come from a state initializer, so their identity is stable (AGENTS.md [WIP] Enhance every detail of the designer #10). flush behaves exactly as objectui#11189 left it. sending(body) gives a claim to a save that the caller sends itself, not through the timer.
  • The hook's committed-snapshot ref (pendingRef, also read by flush) 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.
  • useDraftAutoSave is module-private. No schema, prop, type or accepted set moves.

Measured before the fix: base c3df43a42, every caller

The mount is happy-dom, with the real pillars and the real registered FlowPreview / FlowInspector and PagePreview / 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.

caller first edit (sent, held) edit during the flight saves received on screen
Automations doSave (the control) start label 'Kick-off' 'Kick-off two' 1, carrying 'Kick-off' 'Kick-off two'
Data doSave (autosave) Add field, field_3 Add field, field_4 1, carrying title, status, field_3 '4 fields'
Data doReorderFields (a save the pillar sends itself) column reorder to status, title Add field, field_3 1, carrying status, title '3 fields'
Interfaces page inspector doSave page label 'Welcome' 'Welcome two' 1, carrying 'Welcome' 'Welcome two'
Interfaces nav doNavSave (with navGen) Add nav item Add nav item, then remove it again 1, carrying Home menu, Landing menu, New item the same one item added. The pillar still reports dirty; 2 s after "Done", editing is still open, still dirty, and nothing more was sent

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

  • Interfaces page inspector doSave becomes if (sent.unmoved()) setIfDirty(false).
  • Interfaces nav doNavSave becomes if (sent.unmoved()) setNavDirty(false), replacing the navGen comparison.
  • DataPillar doSave becomes if (sent.unmoved()) setDirty(false).
  • DataPillar doReorderFields is outside the hook's timer, but its clear goes through the same check, with a claim from sending(body).
  • AutomationsPillar doSave becomes if (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 hook

The nav autosave now reads the same claim. navGen, its bump in onNavPatch and the committed generation are gone. navCommittedRef keeps only dirty, 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 changes appDraft, the snapshot the hook already serialises, and doNavSave sends 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 navDirty set. navGen cleared 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 of navDirty and 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:

  • one in-flight pin per caller: Automations; Data autosave; Data column reorder; page inspector;
  • a Data control (a reorder with nothing edited meanwhile is the only save);
  • the nav undo case.

Ablation, at 201233e1a

Each leg went through objectstack's scripts/ablation-replace.mjs in WRAP mode, which verifies the anchor count, the blob change, the restore blob against HEAD, and that git diff HEAD is empty afterwards. The subject is the source, imported by relative path, so no dist is involved. The prediction for every leg was red on the named pins.

  • Leg A removes the check: the claim always reads unmoved. Result: 6 failed / 6 passed. Red are the four in-flight pins here and the two in-flight pins of the objectui#11189 suite. Green are the Data control, the nav undo case (unmoved is the right answer there) and the four other objectui#11189 pins.
  • Leg B restores Automations' own unconditional clear. Result: 1 failed / 11 passed, with only the Automations pin red.
  • The first attempt at leg B was refused by the tool before anything ran, because its replacement text was a substring of the anchor. It was re-run with a distinct replacement.
  • Both legs are restored; the blob equals HEAD.

Gates, at 201233e1a

  • Closure build (turbo run build --filter=@object-ui/app-shell^...): 28/28, exit 0.
  • pnpm --filter @object-ui/app-shell type-check: exit 0. tsconfig.test.json --listFilesOnly lists the new test.
  • vitest run packages/app-shell/src/views/studio-design/, in 3 chunks: 77 files / 437 tests passed.
  • The root scripts/__tests__/ suite, because a changeset is markdown: 177 files passed, 2 skipped; 5371 tests passed, 2 skipped.
  • eslint on the 2 changed sources: 0 errors. StudioDesignSurface.tsx keeps its 18 warnings, the same rules and messages as the base copy apart from line numbers.
  • Exit 0 on each of: check-changeset-presence, check:control-bytes, check:new-line-citations (0 new), check:changeset-claims, check:pending-changeset-literals, changeset:check and markdown-test-inputs --audit.

Declared narrowing: the whole-repo pnpm test, pnpm lint and other packages' type-checks run in CI. Only suites under studio-design/ mount these pillars; the console StudioRoute tests stub the surface.

Acceptance notes

  • The dev report on this card carries a measured, separate defect for the seat to route (not filed here). The Automations pillar and the Interfaces page inspector send one leaf's edited document as another leaf's draft when the author opens another flow or page inside the autosave's debounce while that leaf's load is slow. This PR does not touch that path.
  • The Automations load clears autoDirty in its finally, which also runs when the load fails. Read, not measured; not filed.
  • The layout-effect write of pendingRef is not pinned. The harness's edits are discrete events, which also flush passive effects in the same commit.
  • The pending changeset 6681-declared-lazy-marketplace-routes.md names this file only as an importer of SuggestedBindingsPanel. That stays true.

The author is the domain:ui seat 2 dev agent, session https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec, branch claude/issue-11204-draft-autosave-generation.


Generated by Claude Code

…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>
@github-actions

Copy link
Copy Markdown
Contributor

changeset-claim-re-read

⚠️ 1 pending changeset(s) describe a file this change touches

Their bodies publish verbatim into the CHANGELOG at the next release, so this is a request to re-read them against your diff — addressed here because you are the one seat that can answer it without re-deriving anything.

⛔ Nothing here blocks, and nothing here is a verdict on your change. This gate exits 0, is not a required context, and judges name resolution, never meaning: it asked whether a pending body names a file you touched. "Is this sentence still true?" is the one question it will not answer, and the one you are being asked to answer.

.changeset/6681-declared-lazy-marketplace-routes.md

  • names views/studio-design/StudioDesignSurface.tsx → packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx — edited by this change

    Both marketplace chunks were held by CHUNK CO-TENANCY, not by any import of the page: rolldown had parked components/SuggestedBindingsPanel.tsx (statically imported by the eager views/studio-design/StudioDesignSurface.tsx) in the first, and console/marketplace/InstalledListWidget.tsx (bare-imported by the package barrel for its SDUI registration) in the second. An app-shell-eager-leaves group in apps/console/vite.config.ts isolates those co-tenants so the three declared-lazy pages chunk by their own dynamic-only reachability. The console eager closure moves 3180.2 KB → 3171.5 KB gzipped (−8,888 bytes, 48 → 45 eager chunks) with the three per-chunk ceilings unmoved.

Read the paragraph, not the line: both false halves of the objectui#8617 claim sat in one paragraph, and correcting either alone would have left it asserting the same wrong thing.

If a claim did go false, correct the body. That is precedented and prose-only, frontmatter untouched; check-changeset-overwrite.mjs will report the correction as its own case 2 ("correcting a declaration on purpose … legitimate"), which is the intended shape — one gate asks for the read, the other records the write.

Not covered, stated so nobody reads this as more: a born-false claim that spells no line address at all (objectui#9495 coordinated one by ORDINAL — "a grep finds that member first" — and deciding that means reading what the sentence means), a claim spelled as a symbol or a package rather than a backticked file name, and a file named ambiguously.

Compared the checked-out tree with dded788ad (merge-base with origin/main): 2 file(s) changed outside .changeset/, read against 1818 pending declaration(s) that publish a body (2428 pending in total). · run

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 330 chunks) 3576.8 KB 3607.4 KB
Main entry chunk (gzip) 149.7 KB 350 KB
Entry file index-Cy5QB0Si.js —
Status PASS —

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

Package Size Gzipped
app-shell (consoleActionDispatch.js) 0.20KB 0.19KB
app-shell (index.js) 16.88KB 6.25KB
app-shell (runtime-config.js) 20.68KB 7.36KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.11KB 3.87KB
auth (ActiveOrganizationStorage.js) 27.95KB 10.04KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 2.07KB 1.00KB
auth (AuthProvider.js) 40.22KB 10.61KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.17KB 5.40KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.72KB 2.24KB
auth (SocialSignInButtons.js) 9.70KB 3.93KB
auth (UserMenu.js) 3.39KB 1.21KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 40.70KB 10.94KB
auth (createAuthenticatedFetch.js) 8.54KB 3.46KB
auth (index.js) 3.63KB 1.64KB
auth (invitation-status.js) 1.22KB 0.70KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 5.30KB 1.02KB
auth (useWorkspaceAdminStatus.js) 11.08KB 4.58KB
collaboration (CommentThread.js) 27.13KB 7.95KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 569.07KB 136.05KB
core (index.js) 10.00KB 3.96KB
create-plugin (index.js) 27.94KB 9.51KB
data-objectstack (index.js) 228.91KB 63.54KB
fields (index.js) 261.19KB 66.27KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (builtinAggregateLabels.js) 0.86KB 0.49KB
i18n (currency.js) 2.59KB 1.22KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 8.87KB 3.64KB
i18n (index.js) 5.24KB 2.27KB
i18n (pickLocalized.js) 9.86KB 3.95KB
i18n (provider.js) 39.40KB 12.91KB
i18n (translateFn.js) 0.20KB 0.18KB
i18n (useDisplayLocale.js) 3.52KB 1.76KB
i18n (useObjectLabel.js) 34.35KB 9.18KB
i18n (useSafeTranslation.js) 5.60KB 2.33KB
layout (index.js) 40.88KB 11.46KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.75KB
mobile (index.js) 1.99KB 0.87KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 6.62KB 2.45KB
mobile (useResponsive.js) 0.72KB 0.42KB
mobile (useSpecGesture.js) 5.52KB 2.10KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 13.86KB 5.00KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.52KB 2.26KB
permissions (discardProofCache.js) 1.04KB 0.55KB
permissions (evaluator.js) 8.33KB 3.07KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 4.83KB 2.27KB
plugin-ai (index.js) 16.01KB 3.93KB
plugin-calendar (index.js) 52.17KB 15.06KB
plugin-charts (index.js) 84.09KB 22.93KB
plugin-chatbot (index.js) 198.22KB 46.97KB
plugin-dashboard (index.js) 138.73KB 37.05KB
plugin-designer (index.js) 215.78KB 44.42KB
plugin-detail (index.js) 242.01KB 63.55KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 172.30KB 44.19KB
plugin-gantt (index.js) 172.43KB 42.85KB
plugin-grid (index.js) 230.79KB 63.39KB
plugin-kanban (index.js) 48.44KB 15.11KB
plugin-list (index.js) 116.28KB 28.88KB
plugin-map (index.js) 22.90KB 7.62KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 44.04KB 12.21KB
plugin-timeline (index.js) 32.26KB 9.42KB
plugin-tree (index.js) 11.20KB 3.89KB
plugin-view (index.js) 90.32KB 22.76KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.81KB 3.58KB
providers (index.js) 0.45KB 0.23KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.62KB 2.34KB
react (LazyPluginLoader.js) 4.47KB 1.63KB
react (SchemaRenderer.js) 119.55KB 39.23KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.50KB 2.06KB
react (schema-input.js) 4.25KB 2.04KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (body-dialect.js) 4.78KB 2.09KB
sdui-parser (codegen.js) 9.45KB 3.76KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 6.17KB 2.73KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (kanban-quick-add.js) 3.89KB 1.87KB
sdui-parser (parse.js) 25.28KB 7.80KB
sdui-parser (provenance.js) 3.84KB 1.90KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 22.61KB 7.40KB
types (ai.js) 4.39KB 2.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 4.12KB 1.61KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 3.19KB 1.62KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (data-display.js) 3.75KB 1.85KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.85KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (expression.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-inflight.js) 8.87KB 3.73KB
types (http-retry.js) 4.32KB 2.02KB
types (icon-key-migration.js) 4.26KB 1.63KB
types (index.js) 4.74KB 2.26KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 5.00KB 2.39KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 2.52KB 1.31KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (select-option.js) 0.20KB 0.19KB
types (spec-report.js) 5.05KB 1.93KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (strict-authoring-face.js) 19.82KB 7.15KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 8.11KB 3.32KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 201233e1acec19b06bfafc4398cf8db1f0908d3b
Local-runs: none

PR objectui#11230 for card objectui#11204 (p1; triage 5911686087, unlock 5913035564, claim 5913109805, dev report 5914734135). Inputs: the card body and its four comments, the PR body, its three-file list, the net diff against main at the head, the head source read through the contents API, and the head's check-runs with filter=latest (42 at the first read, 43 at completion).

① Derived judgments

Check-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 Test aggregate, landed before the wait cap). 43 runs: 40 success, 3 skipped (the two coverage jobs and dependabot, skipped by design), 0 failure, none still running. Green: the eight Test shards and their Test aggregate, which carry the new pin file and objectui#11202's unmodified suite; Type Check; Lint; Build & E2E; Test (dist pins); Spec Main Shape Gate; Governed Surface Queue Guard; Line Citation Gate; Control Byte Scan; the five changeset gates; Bundle Analysis; and the docs and skill checks. These conclusions are the gate verdicts this record rests on.

The base measurements (right). Six cases, 5 red / 1 green on base c3df43a42, taken in a detached base worktree with the new pin file copied in. The five red are the readings the report and the PR table state: Automations 'Kick-off' sent with 'Kick-off two' on screen; Data autosave three fields sent with '4 fields' shown; Data reorder two fields sent with '3 fields' shown; the page inspector 'Welcome' sent with 'Welcome two' in the input; the nav with navGen, one save equal to the buffer yet dirty for good, "Done" unable to close. The one green is the Data control (a reorder with nothing edited meanwhile is the only save), which is base behaviour and has to be green there. The Automations row is objectui#11189's reading reproduced, so the control the direction asked for is in place; Data and the page inspector were measured before the fix, as the direction required, and both reproduce. Right.

The DraftSend claim (right, with notes). At the head useDraftAutoSave (:217, not exported) hands every send a claim whose unmoved() is an equality between pendingRef.current.snapKey and the serialised key it sent, and each caller's post-await clear runs only while that holds.

  • Content, where the direction said "snapshot or generation": inside the direction, and the better of the two. A generation cannot tell an edit undone during the flight from one that was not: on A→B→A the generation leaves dirty set, and because lastAttemptRef already holds A's key the timer never sends A again, so dirty is stuck for good, with the leave guard and "Done" held. That is the nav row on base. Content reads A→B→A as unmoved, which is the truth (the server holds A), and clears. Right.
  • Cost: unmoved() is a string equality on snapKey, which the hook already memoises per snapshot change, so a check serialises nothing; sending(body) serialises once per self-sent save. Cheap. Right.
  • A key-order or undefined-only difference reads as moved and costs one extra save that then lands unmoved. Harmless.
  • Pre-existing, not widened, no finding: an edit that brings the buffer back to the last attempted key inside the debounce (B sent and landed, then B→C→B) leaves dirty set with nothing sent, on base and on the head alike, because lastAttemptRef refuses a repeat. A limitation of the objectui#5813 / objectui#11189 dedupe, not of this PR; the seat may file it.

Every post-await clear goes through the claim (right). Nine set*Dirty(false) sites at the head. Five are save completions and all five read the claim: page inspector doSave :2131, nav doNavSave :2175, Data doSave :3329, Data doReorderFields :3376, Automations doSave :4251. The four unconditional ones are buffer replacements, as the report says: :1722 the nav read-only put-back (setAppDraft(navBaselineRef.current), then the clear); :2102 the page load after setDraft(body ?? baseline); :3148 the Data load, synchronous, before its await; :4225 the Automations load's finally. Each verified; none completes a save.

navGen folded (right). Zero references to navGen, setNavGen, sentGen or a .gen member remain at the head. The state, its bump in onNavPatch and the committed generation are gone; navCommittedRef keeps dirty alone, and its one reader, the same-package install guard at :1971, is unchanged. The nav autosave can use the hook's mechanism because its snapshot is appDraft and every onNavPatch writes appDraft; doNavSave sends a cleaned copy of exactly that snapshot, and the claim is on the buffer, which is the right subject (the question is whether the buffer moved, not whether the body differs). The report says which: content, not a count. objectui#11202's test file is not in this PR's file list, so its pins are unmodified; their colour on the head is the Test shards' verdict, below.

The hook's return and the layout effect (right; no risk found). flush keeps its behaviour and its identity (a state initialiser); its only reader is the nav "Done" effect at :2196, which lists it as a dependency. sending is new and module-private. pendingRef and saveRef are now written in a layout effect: refs only, no setState and no DOM work, so no render cascade; a layout effect is current before any passive effect of the same commit, and both readers (flush from a passive effect, unmoved() after an await, a macrotask) see the committed buffer. For discrete-event edits the passive effect was already flushed synchronously, which is why the harness cannot pin the move; for a non-discrete update (a timer, a continuous event) the move closes a window in which a landing save could read a stale key. App-shell tests run under happy-dom, where layout effects run at commit; React is 19.2.8 in dev with a ^18 || ^19 peer range, and only React 18 server rendering warns on a layout effect, which the Studio surface, a client editor, does not exercise.

doReorderFields (right). It writes setObjDraft(body) and takes sendingObjDraft(body): the hook's snapshot is objDraft, so once the write commits the pending key equals the claim's key, and a field added during the flight moves it. It leaves lastAttemptRef alone, which is correct: the reorder never sets dirty, so the timer has nothing to dedupe against, and a later autosave key differs anyway. The pin and the control cover both branches.

No NavTree row, no import line (right). The import block is :17 to :139 and NavTree is :1403 to :1431; the source hunks start at :184 and then :1687, and none touches either. The diff adds no import: DraftSend and draftSnapshotKey are file-local.

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

.changeset/11204-draft-autosave-in-flight-edit.md: @object-ui/app-shell patch. Right: a behaviour fix in a module-private hook and its callers inside one file. useDraftAutoSave is not exported (:217), the three pillars' props are untouched, and no schema, type or accepted set moves. The text names the four editors and the nav undo change accurately. Changeset Declaration, Bump Policy, Claim Re-read, Fixed Group Check and Overwrite Report are green on the head. Clause-②: no — right, on the same ground.

③ Boundary flags

  1. PR title "sent-snapshot check" against the order's "generation check": the direction said "snapshot or generation"; the title names the branch taken. Answered; not a deviation.
  2. The detached base worktree and the uncommitted probe file: process only; the file list carries no probe file and the type-check listing the dev cites has none. Answered.
  3. The hook's return shape and the layout-effect move: judged in ①, right.
  4. doReorderFields inside the file surface: the card names Data's clears as a site and the claim names DataPillar's hook caller; a second post-await clear in the same pillar is inside that surface, and it was measured before the fix. Answered.
  5. Ablation leg B's refused first attempt: a no-op, re-run with a distinct replacement. Answered.
  6. open_questions: none.
  7. Out-of-scope 1 (a flow or page switch inside the debounce, while the load is slow, writes the old leaf's document to the newly opened leaf; Automations and the page inspector measured, Data read as safe). Class (a) at a public door on a writable package: a cross-item write, worse than the loss this card fixes, and its reach is every slow load. Verified not introduced and not touched here: the timer effect's dependencies are unchanged in effect (api is stable), the save is read through saveRef as on base, the load effects are untouched, and the layout-effect move changes nothing at the 1.5 s scale. Data is safe because :3148 clears dirty synchronously before its await. It does not bear on this verdict. Escalated to the seat as the family closure card it names, with objectui#11203 as a member; the hook-level remedy the dev offers (drop a send whose target changed) fits the direction's "fix it once" better than a per-pillar clear.
  8. Out-of-scope 2 (carrier objectui#11203). Yes, this PR opens one more interleaving to that card's spurious save: a nav save landing after a package switch has installed the other app now reads moved and leaves navDirty set, and the unblocked timer then saves the switched-to app; navGen cleared it because an install never bumped. It is not a regression this PR must close: the ordinary path (an unsaved edit, then a switch) already reaches the same save on main and is the wider window; the seat sequenced objectui#11203 immediately after this card for this very state; closing it here would mean an install-aware exception, a second mechanism of the kind the direction retired; and objectui#11203's reset of navDirty and editNav at the switch closes both, since the landing claim only declines to clear and never sets. Escalated: the seat's objectui#11203 dispatch must name this interleaving (a switch during an in-flight nav save) as a pin.

Implemented-by: claude/issue-11204-draft-autosave-generation
Reviewed-by: session_011p7ikEivgXefNDaE5S5Uec

VERDICT: PASS


Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review September 30, 2026 16:02
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 395f4fa Sep 30, 2026
45 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-11204-draft-autosave-generation branch September 30, 2026 16:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

2 participants