Skip to content

fix(app-shell): Studio's new rules, hooks and actions start from safe defaults (objectui#11820) - #11918

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-11820-studio-safe-defaults
Oct 8, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-11820-studio-safe-defaults

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #11820

Clause-②: no

Studio's create flows for validation rules, hooks and actions start from safe defaults, as the triage grade's direction (option A) asks. Only what Studio offers and saves first changes; editing an existing rule, hook or action is unchanged.

What changes

  • Validation rules (ObjectValidationsPanel.tsx). A new Script, Cross-field or Conditional rule is no longer written to the object draft with the guard 'false'. It is listed and open, marked "Not saved — needs a condition", with the line the Data pillar uses for an edit it holds (engine.studio.held.line, objectui#11786) and that hold's input hint under the guard. The first edit that gives it a condition writes it (a Conditional also waits for its Then rule's condition; its seeded Then rule shows an empty condition where it goes). Every new rule starts on Create + Update (events: ['insert', 'update']). A type with no guard (State machine, Format, JSON schema) is written at once, as before. A type switch on an EXISTING rule still seeds the valid 'false' placeholder, because that rule is already in the draft.
  • Hooks (HookDefaultInspector.tsx, ObjectHooksPanel.tsx). A new hook already targeted the object it is made from (addHook seeds object: objectName on 5e446ab); that is now pinned. The target picker is told which objects belong to this package (new module-internal HookTargetScopeContext, provided by the hooks panel from loadPackageSurfaces(client, 'object', packageId), the published-plus-draft merge the pillars' rails use). It lists this package's objects under "This package" and every other object, other packages' and the platform's own sys_* tables alike, under "Other objects" with a one-line reach warning. "All objects (*)" shows a reach warning when chosen. Choosing either deliberately still writes what it wrote before. The metadata admin's hook editor, which knows no package, keeps its flat list.
  • Actions (ObjectActionsPanel.tsx). A new action is "Update fields on this record — no code": operation: 'update' with an empty patch, type left to the spec default, no sandboxed-JS body.
  • Designer rows in metadata-admin/i18n.ts (en and zh): 5 keys added (engine.studio.held.needsCondition, engine.studio.held.needsThenCondition, engine.studio.rules.notSaved, engine.inspector.hook.outsideReach, engine.inspector.hook.allObjectsReach; the group headings reuse engine.inspector.objectPicker.groupPackage / groupOther), engine.studio.rules.celMid reworded and engine.studio.rules.celPost removed (the guard caption no longer says new rules default to false).
  • Changeset: .changeset/11820-studio-safe-defaults.md, patch on @object-ui/app-shell.

No export, prop, type member or language-pack key reaches the package entry: after pnpm --filter @object-ui/app-shell build, HookTargetScope appears only in dist/views/metadata-admin/inspectors/HookDefaultInspector.d.ts, and no other .d.ts in dist/ imports that file.

Measurements behind the route (the dispatch's hypotheses)

  1. Validation rule. The installed @objectstack/spec 17.7.0 declares events: z.array(z.enum(['insert', 'update'])).default(['insert', 'update']). Measured: a rule parsed without events comes back with ['insert', 'update'], so the card's "no Runs on event checked" rule did run on both; it was a no-op only because of condition: 'false'. The panel shares the Data pillar's useDraftAutoSave through onPatch, but the objectui#11786 hold lives off this card's surface: its predicate is objectHeldEdit in metadataError.ts, which holds a draft the object write guard refuses, and its "Show me" routes a field selection in StudioDesignSurface.tsx (a file this seat's objectui#11823 step 2 holds). A rule that has never been written is not an edit of that draft, so the panel holds it itself and reuses the hold's wording and input hint rather than adding a second vocabulary. Known cost against the pillar's hold, stated in the panel's header and the changeset: leaving the Rules view, or the object, before the rule has a condition drops it, and Publish does not wait for it.
  2. Hook target. The spec offers a declared flag (ObjectSchema.isSystem), but on objectstack main 3 of the 83 sys_* objects in *.object.ts files do not declare it (sys_inbox_message, sys_file, sys_upload_session). The grouping therefore keys on package membership (the server's package filter on _packageId, plus the package's drafts), not on the flag and not on the sys_ name prefix; everything outside the package, platform objects included, lands in the warned group. Raw camelCase event names (beforeInsert, afterUpdateMany): the designer string table has no label pattern for hook events, so no vocabulary is invented here (named under Acceptance notes).
  3. Action default. update_field is not an ActionType; the declarative single-record write is operation: 'update' + patch on the default script route (objectstack issue 14092). Measured through the spec's ActionSchema: url, flow, modal, api and form without a target are each refused at target; operation: 'update' without patch is refused ("nothing to write"); operation: 'update' with patch: {} parses, with type materialised as script. It is the only declarative skeleton valid without further input. The console's ActionRunner already dispatches operation before type.
  4. Security carrier — read, not changed, not filed; see Acceptance notes.

Tests

All runs on 54f36e2 (the branch head), from the worktree root, through os-verify-lock.sh:

  • pnpm exec vitest run --maxWorkers=2 packages/app-shell/src/views/studio-design/ — Test Files 122 passed (122), Tests 762 passed (762).
  • pnpm exec vitest run --maxWorkers=2 packages/app-shell/src/views/metadata-admin/inspectors/ plus the 12 test files outside studio-design/ and metadata-admin/inspectors/ that git grep finds naming a changed module or a changed string (ConditionWidget.conditionSubjects, ResourceEditPage.conditionScope, src/__tests__/select-placeholder-literal-11252, two data-objectstack envelope tests, three packages/i18n key tests, four scripts/__tests__ i18n / dts tests) — Test Files 155 passed (155), Tests 2394 passed | 1 skipped (2395); the skip is the pre-existing spec-gated skipIf in flow-node-config.spec-reconciliation.test.ts.
  • pnpm --filter @object-ui/app-shell type-check (tsc --noEmit && tsc -p tsconfig.test.json) — exit 0; --listFilesOnly on the test project lists all six changed test files. Run on the working tree committed unchanged as 54f36e2.
  • pnpm exec eslint on the 11 changed .ts/.tsx files — 11 files judged (from --format json), 0 errors, 4 warnings: one new (react-refresh/only-export-components on the exported context, the shape studio-canvas-preview.tsx already has) and three pre-existing react-hooks/set-state-in-effect.
  • Gates, each exit 0 with its own verdict: check:control-bytes, check:test-path-roots, check:changeset-claims, check:pending-changeset-literals, check:i18n-keys, check:i18n-drift ("Every changed designer-table en value was followed by its zh row."), check:i18n-dead-keys (no new key listed), check:i18n-designer-parity ("Every en row has a zh row, and every shared row carries the same placeholders."), check:new-line-citations (0 new), check:action-forward-parity, check:designer-field-key-parity, and scripts/check-changeset-{presence,no-major,fixed,overwrite}.mjs.

New pins: ObjectValidationsPanel.newRuleWaits-11820.test.tsx, ObjectActionsPanel.newActionDefault-11820.test.tsx (newActionPin), HookDefaultInspector.reach-11820.test.tsx, ObjectHooksPanel.newHookTarget-11820.test.tsx. Rewritten: the ObjectValidationsPanel.test.tsx case that pinned the 'false' default (it pinned exactly the branch removed here), and whenKeyPin's New-menu cases, which now parse the rule the panel finally writes. Controls inside the pins: an existing rule edits and type-switches as before; a type with no guard is written at once; "All objects" chosen deliberately writes *; no package known means the flat list with no warning.

Ablation (node scripts/ablation-replace.mjs from objectstack, WRAP mode, run on 54f36e2): addRule's wait was replaced by the old immediate write with the 'false' guard (anchor 1 to 0, blob 21757a5a4e64 to da230345381a, marker count 1 on disk before the run). The three validation test files went red as expected: Tests 14 failed | 15 passed (29), every failure an assertion, none a crash (13 AssertionError, 1 jest-dom toBeChecked; for example expected "vi.fn()" to not be called at all, but actually been called 1 times). Restore proven by the tool: blob after restore 21757a5a4e64 equals the HEAD blob, git diff HEAD empty.

Acceptance notes

Security carrier — how the server binds an authored hook on a platform object or * (objectstack main at c6fe02d7, read only; triage routes it):

  • packages/objectql/src/hook-binder.ts, bindHooksToEngine: every hook is registered on each object normalizeObjects(hook.object) names, '*' included, through engine.registerHook(event, wrapped, { object, packageId, meta }). The only target it refuses is an empty one.
  • packages/objectql/src/plugin.ts, ObjectQLPlugin.readAuthoredHookRows and resyncAuthoredHooksNow: Studio-authored hook rows are read from sys_metadata across all organizations (its own comment: engine hooks fire process-wide) and bound under the package id metadata-service.
  • The one platform-object refusal found: packages/spec/src/data/hook.zod.ts, refuseBodyOnStoredMetadataTarget, mirrored at bind by packages/runtime/src/sandbox/body-runner.ts, hookBodyRunnerFactory (through storedMetadataBodyHookBindingRefusal): a hook carrying a body that names sys_metadata or sys_metadata_history is refused; '*' binds and its body is skipped for those two tables' events.
  • Nothing else found in the parse or the bind refuses a sys_* object, an isSystem object or another package's object as a target. hook-wrappers.ts has zero hits for organization / tenant / _packageId / isSystem (a grep zero; the same search hits hook-run-as.ts).

Found on the way, not changed here (reported to the seat with evidence):

  • The Actions "What it does" path back to a script: ActionDefaultInspector's commitOperation clears operation and patch and seeds no body, and patchBody writes { source } without language. Measured through ActionSchema: the switched action is refused at body (a script needs a body or a target), and after typing a body it is refused at body.language until a language is picked explicitly. Pre-existing for any update action; this PR makes it the path for every author who wants a script action.
  • "Runs on" offers Delete, which the spec's events enum refuses (ObjectSchema.safeParse answers invalid_value at validations.0.events.N).
  • A rule with no events shows no "Runs on" box checked though the spec runs it on Create + Update, and ticking "Create" narrows it to Create only.
  • The guard editor's empty state reads "Always — no condition." (ConditionBuilder) right above the "Required" hint on a new rule.
  • Hook events are labelled with their raw camelCase names; the designer string table has no pattern for them.
  • An update action created through the inspector's "What it does" carries an explicit type: 'script', so the Actions list shows a SCRIPT chip for it, while the new default (type left off) shows none; and the inspector's Type control still reads "Script — run an expression / sandboxed JS" (disabled, pinned) on an update action, by the objectui#7551 design.

NOT MEASURED: browser verification of the three panels (not run this round; the pins drive the real components with the real spec); the rest of @object-ui/app-shell's 1133 test files beyond the two directories and the grep-derived files above (pnpm test in CI runs them); check:readme-exports (exit 1 on 73 README imports whose packages' dist/index.d.ts is not built in this worktree, none of them app-shell; the package's exports are unchanged).

Authored in session https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8 (seat domain:ui#3, claim comment 6053007704).


Generated by Claude Code

… defaults (objectui#11820)

- Validation rules: a new Script / Cross-field / Conditional rule stays out of
  the object draft until it has a condition (a Conditional, its Then rule's
  too), listed and marked not saved with the hold's line and input hint; every
  new rule starts on Create + Update. An existing rule's type switch still
  seeds the valid 'false' placeholder.
- Hooks: the target picker splits this package's objects (the package's own
  list, published and draft, provided by the hooks panel) from every other
  object, which sits under "Other objects" with a reach warning; "All objects"
  carries one too. A new hook still targets the object it is made from.
- Actions: a new action is a declarative field update (operation 'update',
  empty patch, type left to the spec default) instead of a sandboxed-JS script.

Claude-Session: https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 334 chunks) 3298.7 KB 3307.0 KB
Main entry chunk (gzip) 71.3 KB 350 KB
Entry file index-BeqUsm6Y.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) 17.82KB 6.58KB
app-shell (runtime-config.js) 22.59KB 7.89KB
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.15KB 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.11KB 7.97KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.28KB 2.60KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.50KB 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) 586.28KB 141.14KB
core (index.js) 10.00KB 3.96KB
create-plugin (index.js) 27.94KB 9.51KB
data-objectstack (index.js) 240.39KB 67.09KB
fields (index.js) 266.92KB 67.47KB
i18n (LocalizationContext.js) 2.92KB 1.42KB
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.52KB 2.39KB
i18n (pickLocalized.js) 9.86KB 3.95KB
i18n (provider.js) 39.35KB 12.88KB
i18n (translateFn.js) 0.20KB 0.18KB
i18n (useDisplayLocale.js) 3.52KB 1.76KB
i18n (useObjectLabel.js) 38.37KB 10.31KB
i18n (useSafeTranslation.js) 7.14KB 2.92KB
layout (index.js) 41.50KB 11.82KB
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.04KB 3.92KB
plugin-calendar (index.js) 53.39KB 15.52KB
plugin-charts (index.js) 84.71KB 23.25KB
plugin-chatbot (index.js) 199.63KB 47.46KB
plugin-dashboard (index.js) 144.82KB 39.17KB
plugin-designer (index.js) 231.46KB 48.87KB
plugin-detail (index.js) 248.57KB 65.47KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 176.62KB 45.75KB
plugin-gantt (index.js) 179.17KB 45.07KB
plugin-grid (index.js) 246.17KB 68.02KB
plugin-kanban (index.js) 52.17KB 16.37KB
plugin-list (index.js) 117.45KB 29.33KB
plugin-map (index.js) 27.24KB 9.03KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 44.12KB 12.29KB
plugin-timeline (index.js) 39.10KB 11.81KB
plugin-tree (index.js) 15.07KB 5.33KB
plugin-view (index.js) 91.07KB 22.93KB
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) 120.63KB 39.56KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.50KB 2.06KB
react (schema-input.js) 4.31KB 2.07KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (body-dialect.js) 4.50KB 1.99KB
sdui-parser (codegen.js) 9.45KB 3.76KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 7.30KB 3.12KB
sdui-parser (input-type.js) 2.84KB 1.40KB
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) 23.87KB 7.83KB
types (ai.js) 4.39KB 2.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 4.12KB 1.61KB
types (authoring-nodes.js) 0.20KB 0.19KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (cloud.js) 0.20KB 0.18KB
types (complex.js) 4.44KB 2.07KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (dashboard-widget-layout.js) 2.06KB 0.96KB
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) 1.13KB 0.65KB
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) 5.78KB 2.70KB
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 (node-slots.js) 7.18KB 2.34KB
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) 4.99KB 1.96KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (strict-authoring-face.js) 19.93KB 7.25KB
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants