Skip to content

chore(lint): org-identifier authoring guard for deprecated session.tenantId (#3280 follow-up)#3289

Merged
os-zhuang merged 1 commit into
mainfrom
feat/org-identifier-gate
Jul 19, 2026
Merged

chore(lint): org-identifier authoring guard for deprecated session.tenantId (#3280 follow-up)#3289
os-zhuang merged 1 commit into
mainfrom
feat/org-identifier-gate

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Follow-up to #3280 (merged in #3284) and #3288. Makes the session.tenantId deprecation discoverable at build time for our own reference apps.

Why

#3280 made organizationId the blessed developer-facing name for the caller's active org in hook/action bodies; ctx.session.tenantId is now a deprecated alias. TSDoc @deprecated only nudges an author whose editor surfaces it — nothing stopped our own reference apps (examples/, apps/), which authors and AIs copy from, from re-introducing session.tenantId.

What

scripts/check-org-identifier.mjs — a hard-fail guard (authoring surfaces carry zero occurrences today, so any match is new), wired into the lint workflow next to check:nul-bytes / check:role-word. Deliberately narrow:

  • Scope: author-facing reference code only (examples/, apps/). Internal framework packages legitimately read session.tenantId (the engine's own buildSession, the record-change trigger) — that's the driver-layer alias, a Unify the developer-facing org identifier: hooks expose session.tenantId while RLS/seed/columns use organizationId (add organizationId as the blessed name) #3280 non-goal, and is not flagged.
  • Excludes skills/ + content/docs/: they deliberately show the deprecated form when teaching the deprecation.
  • Precise pattern: matches only the session.tenantId token, never execCtx.tenantId / opts.tenantId / DriverOptions.tenantId (the generic driver-layer tenancy knob, explicitly out of scope).
  • Escape hatch: os-allow-tenant-id comment on the line, for a genuine driver-layer use in an example.

Proven red (防假绿)

  • Injected ctx.session.tenantId into a tracked example hook → guard fails (exit 1, points to organizationId).
  • Reverted → green (194 files scanned, 0 occurrences).
  • Same line with os-allow-tenant-idsuppressed.
  • New script carries no raw NUL byte (passes check:nul-bytes); ESLint clean.

Tooling-only (no package touched) → no changeset needed.

🤖 Generated with Claude Code

…n.tenantId (#3280 follow-up)

`organizationId` is the blessed developer-facing name for the caller's active
org in hook/action bodies (#3280); `ctx.session.tenantId` is a deprecated alias.
TSDoc `@deprecated` only nudges an author whose editor surfaces it — nothing
stopped our own reference apps (examples/, apps/), which authors and AIs copy
from, re-introducing `session.tenantId`.

scripts/check-org-identifier.mjs is a hard-fail guard (authoring surfaces carry
zero occurrences today) wired into the lint workflow. Deliberately narrow:
- scans author-facing reference code only (examples/, apps/) — internal packages
  legitimately read `session.tenantId` (driver-layer alias, a #3280 non-goal);
- excludes skills/ + content/docs/, which teach the deprecated form on purpose;
- matches only the `session.tenantId` token, never `execCtx.tenantId` /
  `opts.tenantId` / `DriverOptions.tenantId` (the generic tenancy knob);
- escape hatch: `os-allow-tenant-id` comment on the line.

Proven red on a new occurrence, green when reverted, suppressed by the marker.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jul 19, 2026 2:32pm

Request Review

@github-actions github-actions Bot added ci/cd dependencies Pull requests that update a dependency file size/m labels Jul 19, 2026
@os-zhuang
os-zhuang merged commit 64e0bbd into main Jul 19, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the feat/org-identifier-gate branch July 19, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd dependencies Pull requests that update a dependency file size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant