Repository navigation
Description
Background
#3280 converged the developer-facing org identifier onto organizationId across the JS authoring surface:
- Hooks —
ctx.user.organizationId/ctx.session.organizationId(Unify the developer-facing org identifier: hooks exposesession.tenantIdwhile RLS/seed/columns useorganizationId(addorganizationIdas the blessed name) #3280, merged in feat(spec,objectql): unify developer-facing org identifier in hooks — organizationId is blessed (#3280) #3284). - Actions —
ctx.user.organizationId/ctx.session.organizationId(feat(runtime): expose organizationId to action-body ctx (user + session) — follow-up to #3280 #3288). - Build-time guard keeping our reference apps off the deprecated name (chore(lint): org-identifier authoring guard for deprecated session.tenantId (#3280 follow-up) #3289).
ctx.session.tenantId was kept as a deprecated alias carrying the identical value, marked @deprecated in TSDoc. This issue tracks its eventual removal from the hook/action ctx.session surface, once a deprecation window has passed.
Scope of the removal (when it happens)
- Drop
session.tenantIdfromHookContextSchema.session(spec) — keep onlyorganizationId. - Drop the
tenantIdalias emitted by the engine'sbuildSession()and the runtime'sbuildActionSession()/ actionctx.user. - Flip
scripts/check-org-identifier.mjsfrom a hard-fail authoring guard to also coveringpackages/**where those are authoring-example bodies (leave the driver layer alone). - Changeset as a breaking change for
@objectstack/spec+@objectstack/objectql(+@objectstack/runtime).
Explicit non-goals (do NOT remove/rename)
The generic driver-layer tenancy abstraction stays as-is — it is not "org", the isolation column is configurable, and it legitimately carries an environment id in database-per-tenant kernels:
ExecutionContext.tenantId,DriverOptions.tenantIdSqlDriver.applyTenantScope/tenantFieldByTable,TenancyConfig.tenantFieldExecutionLog.tenantId(flow-execution audit isolation field)
Timing
Schedule for the next major (v11/v12 train). Do not land before a real deprecation window — the alias must stay green for at least one minor cycle so third-party .hook.ts / .action.ts authors can migrate. The @deprecated TSDoc + the #3289 guard are the migration aids in the meantime.
Related
- Unify the developer-facing org identifier: hooks expose
session.tenantIdwhile RLS/seed/columns useorganizationId(addorganizationIdas the blessed name) #3280 (the convergence), feat(spec,objectql): unify developer-facing org identifier in hooks — organizationId is blessed (#3280) #3284, feat(runtime): expose organizationId to action-body ctx (user + session) — follow-up to #3280 #3288, chore(lint): org-identifier authoring guard for deprecated session.tenantId (#3280 follow-up) #3289. - Distinct from Driver-native tenant scope hides platform-global (NULL-org) rows from an org-context read (sys_license: admin sees 0, anon sees row) #3249 (a standalone driver-native tenant-scope correctness bug — same layer name, different problem).
Activity
docs: regenerate hook reference after removing session.tenantId (#3290)
feat(hooks)!: remove deprecated ctx.session.tenantId alias — converge…
fix(spec): 让 spec 测试层真的进 tsc,`@ts-expect-error` 退役 pin 不再是幽灵检查 (objec…
fix(spec): keep the removed `session.tenantId` token out of published…
fix(plugin-audit): the NULL-tenant audit guard reads the session key …
docs(comments): date the #3290 session.tenantId removal to v16, not v11
fix(plugin-audit): the NULL-tenant audit guard reads the session key …
docs(comments): date the objectstack-ai#3290 session.tenantId removal…
docs(skills): correct removed-in-v11 to v16 for objectstack-ai#3290 s…
docs(spec): retarget v11 → v16 datings of the objectstack-ai#3290 ses…
fix(scripts): correct v11 to v16 in check-org-identifier self-test fi…
fix(scripts): correct v11 to v16 in check-org-identifier self-test fi…