Skip to content

fix(core,console): an id never travels without its object on the form route (#4292) - #4311

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-4292-recordid-object-identity
Aug 11, 2026
Merged

fix(core,console): an id never travels without its object on the form route (#4292)#4311
yinlianghui merged 1 commit into
mainfrom
claude/issue-4292-recordid-object-identity

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#4292. Builds directly on #4278 (PR #4293), which is the reason this became worth closing now.

The defect

ActionRunner.executeForm forwarded /forms/:name?recordId= for any context record, and that URL carries no object. The form route therefore has to resolve the id against the only object it knows — the FormView's own target — which is right whenever the action fired from a record of that object, and which nothing checked. An action whose locations put it on an Account but whose target is showcase_task.edit is publishable metadata today.

Where primary keys are per-table integers, GET /api/v1/data/showcase_task/42 answers happily for the user who was looking at Account 42. The server cannot flag it either — getData echoes the path's object back, so the response is perfectly self-consistent, which is exactly why #4278's payload-mismatch guard cannot see this shape.

Pre-#4278 the blast radius stopped at a duplicate INSERT. Now that the route honours the param, the same mis-scoped action performs a targeted UPDATE of a different object's record, with no error anywhere and the record the user was actually on left untouched.

The ruling this implements

Per the PM ruling on the card (quoted verbatim):

裁决(不变量表述):id 不得脱离其对象身份旅行;不匹配在两端都 fail-closed。

Both halves land here, in one PR.

Producer — packages/core/src/actions/ActionRunner.ts (executeForm)

The id is forwarded only when the firing context record's object matches the target view's object; on a mismatch neither param is forwarded, so the bare /forms/:name preserves create semantics — a "log time" action fired from a Task at another object's create view is a CREATE launched from a record, which is what that shape did before #4278 and is not a broken edit. When the id IS forwarded, the object rides with it as ?recordObject=.

Object identity is measured, not invented. The source is context.objectName, which is already this repo's one spelling of that fact:

  • @object-ui/react's ActionProvider documents the flat trio (record, user, objectName) and mirrors it into the canonical ctx.* scope;
  • useConsoleActionRuntime seeds context: { ...(objectName ? { objectName } : {}), … }, so every console surface that fires record actions (DeclaredActionsBar, ObjectView, RecordDetailView) already publishes it — and RecordDetailView passes it explicitly a second time;
  • app-shell's recordFormNavigation resolver already reads that same key as its last precedence step.

action.objectName is deliberately not consulted: it declares where an action is placed, not which record the id came from, and trusting metadata about the action to describe the record is the conflation that made this defect possible. A test pins that it cannot talk the runner into forwarding across a boundary.

The target's object is asked as a prefix match against the object already in hand rather than by parsing an object name out of the view name — view identity is object + . + key (ADR-0017; viewEnvelope builds exactly that, defaultListViewId compares exactly this way), so the metadata keeps owning that fact.

Consumer — apps/console/src/components/FormPage.tsx

When recordObject is present and disagrees with the FormView's object, the route takes #4278's existing fail-closed path: the refusal fires before the object-schema fetch and before the record read, so a mismatch costs zero /data/ traffic and can never reach a write. When the param is absent or blank it asserts nothing and behaviour is unchanged, so hand-authored deep links and old links keep working — the guard only tightens where identity information is actually present.

recordObject is an assertion, never an override: it cannot change which object the form edits (that comes from the view metadata alone), only make the form refuse. Reading it as a selector would let any hand-authored URL aim a form at an arbitrary object — the same hole re-opened from the other side. The registry's formObject is deliberately the other thing (it selects the object the record-form overlay edits); same naming shape, opposite powers, separate surfaces.

Why both halves, when the producer already refuses to emit the bad URL

Defence in depth is the ruling's 两端. The producer stops emitting a cross-object id at all, so in a healthy console the consumer guard never fires. It is still not redundant: URLs arrive bookmarked, hand-written, pasted, or from a producer that predates this fix, and the console cannot tell those apart.

Tests

New: packages/core/src/actions/__tests__/ActionRunner.formObjectIdentity.test.ts (13 cases) and apps/console/src/components/FormPage.recordObject.test.tsx (9 cases), plus #4292 cases in FormPage.test.ts including a behavioural round-trip pin — the real ActionRunner produces a URL and this route's real reader consumes it, so a rename on either side fails rather than silently disarming the guard.

Reverse verification per half, directions predicted before running and recorded in each file's docblock (git checkout origin/main -- FILE after committing, never git stash):

RevertedPredictedObserved
producer onlythe 9 identity/cross-object producer pins red, the 4 "not comparable" controls green; the consumer DOM suite entirely green, since it feeds URLs directly and never asks the runnerexactly that — 9 failed | 4 passed (13), consumer DOM suite 9 passed. The headline failure is the defect verbatim: expected '/forms/showcase_task.edit?recordId=42' to be '/forms/showcase_task.edit' (Account 42's id handed to a Task form)
consumer onlyonly the 4 forged-URL cases red; all 13 producer pins greenexactly that — 4 failed | 18 passed (22), each failure "Unable to find … /Refusing to open it/", i.e. the refusal is gone and the form loaded the other object's record

One honest gap: with the consumer reverted, FormPage.test.ts cannot be run at all — it imports FORM_RECORD_OBJECT_PARAM, which lives in the reverted file, so it fails at collection rather than producing a verdict. Its round-trip pin was exercised in the producer-reverted direction instead, where it went red on all 3 cases (the only console-side signal that can catch a producer regression).

Controls, green both sides on purpose: same-object edit (#4278's main path — load, prefill, PATCH) byte-identical; recordId with no recordObject unchanged; a host publishing no objectName still gets the plain ?recordId=; the public /f/:slug surface reads neither param; #4278's payload-mismatch guard still fires on its own condition with its own distinct wording.

Local verification: the affected suites plus, because @object-ui/core sits upstream of 36 packages, the full repo suite — 1254 files, 15929 passed | 1 skipped, exit 0. type-check green on @object-ui/core, @object-ui/app-shell and @object-ui/console (both tsc commands each, after building the dependency closure). check:action-forward-parity, check:control-bytes, check:changeset-presence and check:changeset-no-major all green.

Scope

ActionDef / actionKeys untouched — this is behaviour in executeForm, not new vocabulary, and check:action-forward-parity is green without a whitelist edit. The only app-shell change is one prose row in the urlParams registry table so no page repurposes the name; no functional change there.


Generated by Claude Code

… route (#4292)
`ActionRunner.executeForm` forwarded `/forms/:name?recordId=<id>` for any
context record, and that URL names no object — so the form route resolves the
id against the FormView's own target object. When the action fired from a
record of a DIFFERENT object and ids collide across objects (per-table integer
keys), `GET /data/showcase_task/42` answers for the user who was on Account 42.
The server cannot flag it: it echoes the path's object back, so the response is
self-consistent. Since #4278 gave the route a write side, that stopped being a
duplicate INSERT and became a targeted UPDATE of the wrong object's record.
Producer (`packages/core/src/actions/ActionRunner.ts`): forward the id only
when the firing context record's object matches the target view's object, and
send the object with it as `?recordObject=`. Object identity is read from
`context.objectName` — the key `ActionProvider` documents, every console
surface seeds via `useConsoleActionRuntime`, and `recordFormNavigation` already
resolves — not from a new source. On a mismatch neither param is forwarded, so
a create-intent view opened from another object's record still creates, which
is what that shape did before #4278.
Consumer (`apps/console/src/components/FormPage.tsx`): refuse — before any
`/data/` request, so no read and no write — when `recordObject` disagrees with
the FormView's object. Absent or blank asserts nothing and behaves exactly as
before, leaving hand-authored deep links working.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Qqyix2QcnpUC9XeYVDzx3
@vercel

vercelBot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 11, 2026 12:47pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)29.6 KB350 KB
Entry fileindex-IwbKIEi1.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.88KB3.25KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)8.92KB3.41KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)488.62KB108.26KB
core (index.js)3.04KB1.15KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)150.04KB39.79KB
fields (index.js)228.45KB56.62KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)16.38KB5.47KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.98KB10.85KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)45.23KB12.45KB
plugin-charts (index.js)61.73KB17.54KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)121.07KB31.39KB
plugin-designer (index.js)210.91KB42.67KB
plugin-detail (index.js)238.98KB59.76KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)114.58KB27.68KB
plugin-gantt (index.js)164.14KB39.98KB
plugin-grid (index.js)187.97KB49.90KB
plugin-kanban (index.js)48.60KB13.41KB
plugin-list (index.js)109.93KB26.65KB
plugin-map (index.js)17.00KB5.32KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.60KB10.58KB
plugin-timeline (index.js)26.21KB7.52KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)23.71KB7.96KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.23KB0.66KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (dashboard-filter-alias.js)6.23KB2.74KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)3.05KB1.52KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

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

@yinlianghui
yinlianghui marked this pull request as ready for review August 11, 2026 13:00
@yinlianghui
yinlianghui added this pull request to the merge queueAug 11, 2026
Merged via the queue into main with commit 9461dd3Aug 11, 2026
21 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-4292-recordid-object-identity branch August 11, 2026 13:00
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

?recordId= carries no object, so a form action fired from the wrong object can edit a same-id record in the target object

2 participants

@yinlianghui@claude