Skip to content

fix(plugin-form): an open edit form's second save sends the version its first save returned (objectui#10565) - #10641

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-10565-occ-token-after-save
Sep 25, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-10565-occ-token-after-save

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #10565
Clause-②: no

What this changes

useOccSave (in packages/plugin-form/src/occSave.tsx) now remembers, per object and record, the updated_at that its last successful write returned. It sends that version as the next save's ifMatch while the form still holds the same read. This covers the guarded save and the Overwrite retry alike. Every edit layout (simple, modal, drawer, tabbed, split, wizard) calls this one hook, so all six are covered without touching any call site.

  • A baseRecord with a different token is a newer read of the record, and its token wins over anything remembered.
  • A read without updated_at stays unguarded. The change is in which version a guarded save sends, never in whether a save is guarded.
  • A write result without a version clears the entry, so the next save falls back to the read's token (the old behaviour).
  • ⛔ No new export. ⛔ What the payload carries is unchanged: the dirty-fields rule from PR objectui#10546 stands.
  • ⛔ No edit to ObjectForm.tsx or to any of the six baseRecord call sites, so no overlap with open PR objectui#10620.

Measurement first: the defect, against the real enforcement

Enforcement point: updateData in objectstack's packages/metadata-protocol/src/protocol.ts (assertVersionOf, which compares instants). REST maps it to 409 CONCURRENT_UPDATE. objectui's adapter forwards ifMatch as an If-Match header through @objectstack/client.

Rig: objectstack origin/main at 949e99bed9 in a scratch worktree. The dependency closure was built, then one app object was booted with @objectstack/verify's bootStack: the real kernel, the ObjectQL engine, the sqlite-wasm driver, REST, Hono, auth and security. It was exposed on a loopback HTTP listener. The objectui side used the real ObjectStackAdapter (@objectstack/client 17.4.0) over real HTTP. No mock enforced anything. Nothing from the rig is committed.

Before the fix (objectui base e0f820246):

  • Raw HTTP: a read gave updated_at = V0. PATCH with If-Match: V0 answered 200, and the saved record it returned carried a newer updated_at (V1). A second PATCH with the same If-Match: V0 answered 409 CONCURRENT_UPDATE with currentVersion = V1 ("Record occm_device/ID was modified by another user (current version V1, expected V0)"). Control: PATCH with If-Match: V1 answered 200.
  • Real useOccSave over the real adapter: the first save landed and its result carried V1. The second save from the same baseRecord sent V0, was refused 409, and opened the conflict dialog against the user's own save.
  • A mounted ObjectForm in edit mode with the real adapter: after two submits, the second sent the first read's token, got 409, and the dialog opened.

⇒ The first write's response does carry the new version, so the fix takes it from there. No refetch after save is needed.

After the fix, on the same rig: the second hook save sent V1 and landed, with no dialog. The mounted ObjectForm's second submit sent the first write's version and landed, with no dialog. When another writer changed the record between the two saves, the second save still answered 409 and opened the dialog, so the guard is still live.

Pins

New packages/plugin-form/src/occSave.secondSave.test.tsx, beside the existing OCC suites. It has 9 hook rows and 1 ObjectForm row. The data source double is shaped from the measurement:

  • no token means no check, and a token naming another instant earns a 409;
  • each accepted write stamps a strictly later ISO-Z updated_at and returns the whole record;
  • a refusal carries the measured 409 body. That body is built into an Error the way @objectstack/client builds one, then passed through the adapter's real normaliseClientError.

The rows: single-save control · second save sends the first write's version · third save sends the second's · another writer still earns the dialog · after Overwrite the next save sends the overwrite's version · a newer read wins · per-record keying · an unguarded read stays unguarded · a result without a version falls back to the read · two submits from one mounted ObjectForm.

Ablation (the remembered-token read removed, versionToSend returning the read's token), at head 7e1e06d0f, through ablation-replace.mjs (the anchor hit 1 to 0, the marker 0 to 1, and the blob moved from f0d66a02 to 02c4b75a). Over the three OCC suites: 5 failed | 16 passed (21). Red: the second save, third save, another-writer, after-Overwrite and ObjectForm rows. Green: the single-save control, the four other new rows, and all 11 existing OCC rows. Restore was proven by blob: f0d66a02 equals HEAD, git diff HEAD is empty, and the marker count is 0.

Gates (at 7e1e06d0f)

  • pnpm exec vitest run packages/plugin-form/ (repo root): Test Files 122 passed (122) · Tests 1309 passed | 1 skipped (1310).
  • pnpm --filter @object-ui/plugin-form run type-check (the script name echoed; the closure was built first with pnpm --workspace-concurrency=2 --filter '@object-ui/plugin-form^...' run build): exit 0. tsconfig.test.json --listFiles includes the new test file.
  • pnpm check:control-bytes OK · pnpm check:new-line-citations: 0 new · node scripts/check-changeset-presence.mjs: 1 changeset for 1 released package · check-changeset-no-major OK · check-changeset-overwrite: reports the one deliberate edit below.
  • pnpm check:changeset-claims: the self-contradiction reading is clean. It asked for a re-read of .changeset/6237-wizard-step-config-split.md, because that file names content/docs/plugins/plugin-form.mdx. I read that paragraph: it is about the section-predicate support table and is still true.
  • ESLint over the two touched source files, with --no-inline-config, per rule, head against base. occSave.tsx: 3 @typescript-eslint/no-explicit-any warnings at both head and base, unchanged, and 0 react-hooks/exhaustive-deps at both. The new test file: 0 findings. react-hooks/exhaustive-deps is on (warn) for these files, and the config is not type-aware, so this diff cannot move a verdict on an untouched file.
  • check-governed-queue-guard --test: NOT GOVERNED (6 paths).

File surface: beyond the claim, and why

The claim declared occSave.tsx, the pins and one changeset. This change also edits three prose files, because it made a sentence in each of them false:

  • packages/plugin-form/README.md and content/docs/plugins/plugin-form.mdx said an edit save carries the updated_at the form read. Both now say what a save sends once the open form has already saved.
  • .changeset/10156-edit-form-writes-only-changed-fields.md (pending, so it publishes verbatim in the same release) said "The update still carries ifMatch = the updated_at the form read". One clause names the objectui#10565 behaviour. It is a prose-only change, and its front matter is untouched.

Acceptance notes

  • Observation, not filed: two saves in flight at once (a double submit before the first resolves) still read the same token, so the later one can meet a 409. That was true before this change and was not measured.
  • Observation, not filed: booting objectstack's bootStack logs Port 0 is in use, using port N instead from the Hono server plugin. It is a log line only. Carrier: none.

Session: https://claude.ai/code/session_01BA3nKVUwKQJf8DBxrSVtNC


Generated by Claude Code

… last save returned

useOccSave now remembers, per object and record, the updated_at that its
last successful write returned (the guarded save and the Overwrite retry
alike) and sends it as the next save's ifMatch while the form still holds
the same read. A newer read's token wins; a read without updated_at stays
unguarded; a write result without a version falls back to the read.

Before, every layout re-sent the first read's updated_at, so the second
save from a form that stays open was refused 409 CONCURRENT_UPDATE over
the user's own first save.

Claude-Session: https://claude.ai/code/session_01BA3nKVUwKQJf8DBxrSVtNC
@github-actions github-actions Bot added documentation Improvements or additions to documentation plugin tests labels Sep 25, 2026
@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/6237-wizard-step-config-split.md

  • names content/docs/plugins/plugin-form.mdx → content/docs/plugins/plugin-form.mdx — edited by this change

    Documentation repair in the same stroke: the support table in the README and in content/docs/plugins/plugin-form.mdx still said formType: 'tabbed' sections drop the predicate. That stopped being true when the tabbed arm landed — the row now reads Yes, the surrounding prose no longer claims two inert arms or a diagnostic that fires for tabbed, and the wizard row stays No, which is still exactly true.

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 2803fac9b (merge-base with origin/main): 4 file(s) changed outside .changeset/, read against 1490 pending declaration(s) that publish a body (2074 pending in total). · run

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 329 chunks) 3051.0 KB 3104.5 KB
Main entry chunk (gzip) 148.0 KB 350 KB
Entry file index-BixWSM9s.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.57KB 6.15KB
app-shell (runtime-config.js) 20.68KB 7.36KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.06KB 3.86KB
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.17KB 10.58KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.15KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.65KB 2.22KB
auth (SocialSignInButtons.js) 9.61KB 3.89KB
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.21KB 10.80KB
auth (createAuthenticatedFetch.js) 8.52KB 3.45KB
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) 546.99KB 130.83KB
core (index.js) 9.22KB 3.71KB
create-plugin (index.js) 27.94KB 9.51KB
data-objectstack (index.js) 223.91KB 62.28KB
fields (index.js) 260.06KB 65.86KB
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 (useDisplayLocale.js) 3.52KB 1.76KB
i18n (useObjectLabel.js) 34.34KB 9.17KB
i18n (useSafeTranslation.js) 5.60KB 2.33KB
layout (index.js) 39.28KB 11.09KB
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.52KB 4.88KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.24KB 2.16KB
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) 51.40KB 14.61KB
plugin-charts (index.js) 74.94KB 20.89KB
plugin-chatbot (index.js) 198.36KB 47.20KB
plugin-dashboard (index.js) 133.54KB 35.39KB
plugin-designer (index.js) 216.25KB 44.39KB
plugin-detail (index.js) 232.96KB 61.65KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 151.56KB 38.88KB
plugin-gantt (index.js) 169.64KB 41.91KB
plugin-grid (index.js) 215.37KB 58.92KB
plugin-kanban (index.js) 48.26KB 15.04KB
plugin-list (index.js) 114.44KB 28.25KB
plugin-map (index.js) 22.42KB 7.38KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 43.55KB 11.99KB
plugin-timeline (index.js) 30.67KB 8.95KB
plugin-tree (index.js) 10.52KB 3.69KB
plugin-view (index.js) 87.84KB 21.96KB
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.66KB 3.50KB
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) 116.21KB 38.14KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.03KB 1.86KB
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) 6.58KB 2.74KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 5.78KB 2.56KB
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.66KB 1.82KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 18.27KB 6.20KB
types (ai.js) 4.11KB 2.06KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 1.00KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 2.93KB 1.49KB
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.25KB
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) 17.15KB 6.32KB
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
objectstack-fleet Bot marked this pull request as ready for review September 25, 2026 13:49
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit f99f9cd Sep 25, 2026
45 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-10565-occ-token-after-save branch September 25, 2026 14:07
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 plugin tests

Projects

None yet

1 participant