You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(hooks)!: remove deprecated ctx.session.tenantId alias — converge on organizationId (#3290) (#3305)
* feat(hooks)!: remove deprecated ctx.session.tenantId alias (#3290)
Converge the hook and action-body authoring surface on `organizationId`,
removing the `ctx.session.tenantId` / `ctx.user.tenantId` alias that #3280
added as a deprecated shim.
- spec: drop `tenantId` from `HookContextSchema.session` (only
`organizationId` remains; a stray key is now stripped by the schema).
- objectql: engine `buildSession()` no longer emits `session.tenantId`; the
audit-stamp plugin sources the `tenant_id` column from
`session.organizationId`.
- runtime: `buildActionSession()` and the REST action `ctx.user` no longer
emit `tenantId`.
- trigger-record-change: reads `session.organizationId` when forwarding the
writer's org to a runAs:'user' flow (behavior identical).
- check:org-identifier guard now also covers `packages/**` (tests and
comments excluded); docs/skills reference bodies migrated to
`organizationId`.
The generic driver-layer tenancy knob (ExecutionContext.tenantId,
DriverOptions.tenantId, SqlDriver.applyTenantScope, ExecutionLog.tenantId)
is deliberately untouched. Breaking: major bump for spec, objectql, runtime.
Closes#3290
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Q7R16SoGBeqKkEd7RCZRL
* docs: regenerate hook reference after removing session.tenantId (#3290)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Q7R16SoGBeqKkEd7RCZRL
---------
Co-authored-by: Claude <noreply@anthropic.com>
**BREAKING: remove the deprecated `ctx.session.tenantId` / `ctx.user.tenantId` alias from the hook & action authoring surface — converge on `organizationId` (#3290).**
9
+
10
+
#3280 made `organizationId` the blessed developer-facing name for the caller's active org across the JS authoring surface and kept `tenantId` as a `@deprecated` alias carrying the identical value. That alias is now **removed** from the hook `ctx.session`, the action-body `ctx.session`, and the action-body `ctx.user`. Read the caller's active org under the single blessed name:
11
+
12
+
```diff
13
+
- const org = ctx.session.tenantId; // hook or action body
The value is unchanged — `organizationId` is the same active-org id, matching the `organization_id` column and `current_user.organizationId` in RLS/sharing. `ctx.user` is `undefined` for system / unauthenticated writes, so read `ctx.session?.organizationId` when a hook or action must work regardless of a resolved user.
23
+
24
+
What changed internally:
25
+
26
+
-**`@objectstack/spec`** — `HookContextSchema.session` drops the `tenantId` field (only `organizationId` remains). A stray `tenantId` on a constructed session is now stripped by the schema.
27
+
-**`@objectstack/objectql`** — the engine's `buildSession()` no longer emits `session.tenantId`; the audit-stamp plugin sources the `tenant_id` column from `session.organizationId`.
28
+
-**`@objectstack/runtime`** — `buildActionSession()` and the REST action `ctx.user` no longer emit `tenantId`.
29
+
-**`@objectstack/trigger-record-change`** — reads `session.organizationId` (was `session.tenantId`) when forwarding the writer's org to a `runAs:'user'` flow; behavior is identical.
30
+
31
+
**Explicit non-goal (unchanged):** the generic **driver-layer** tenancy abstraction is *not* touched — `ExecutionContext.tenantId`, `DriverOptions.tenantId`, `SqlDriver.applyTenantScope` / `TenancyConfig.tenantField`, and `ExecutionLog.tenantId`. That isolation column is configurable and legitimately carries an *environment* id in database-per-tenant kernels; it is a distinct axis from the developer-facing org. The build-time `check:org-identifier` guard now also covers `packages/**` to keep reference bodies off the removed name.
0 commit comments