Skip to content

Commit 911da5f

Browse files
claude[bot]claude
andauthored
refactor(plugin-auth): remove the inert AUTH_SCIM_PROVIDER_SCHEMA export (#12008)
`AUTH_SCIM_PROVIDER_SCHEMA` was a publicly exported `scimProvider` column mapping with zero consumers -- exactly one repo-wide hit, its own declaration -- and inert by construction: `@better-auth/scim` hardcodes its model and exposes no `schema` option (still true of the installed `@better-auth/scim@1.7.0-rc.1`, whose `SCIMOptions` declares no `schema` / `modelName` / `fields` member), so there was nowhere to hand it. Removed under ADR-0049 enforce-or-remove: it was a second source of truth for the four SCIM column names, where the load-bearing one is the adapter layer (`AUTH_MODEL_TO_PROTOCOL` + camelCase-to-snake_case field resolution in `objectql-adapter.ts`) over the `sys_scim_provider` platform object. A dead copy cannot fail when it drifts, and the next reader cannot tell which of the two is authoritative. A NOTE in its place records why no mapping exists and what owns the names instead, following the sibling sso NOTE in the same file. Fixes #11777 Claude-Session: https://claude.ai/code/session_01APWX2AwT3a4xDcjPCe8bk4 Co-authored-by: Claude <noreply@anthropic.com>
1 parent aa0688a commit 911da5f

2 files changed

Lines changed: 30 additions & 31 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/plugin-auth': minor
3+
---
4+
5+
**BREAKING (public export removed):** `AUTH_SCIM_PROVIDER_SCHEMA` no longer exists. It was a `scimProvider` column mapping exported from `@objectstack/plugin-auth` (via `export * from './auth-schema-config.js'`) that nothing ever read — one repo-wide hit, its own declaration — and that nothing ever could: `@better-auth/scim` hardcodes its model and exposes no `schema` option, still true of the installed `@better-auth/scim@1.7.0-rc.1`, whose `SCIMOptions` declares no `schema`, `modelName` or `fields` member at all. Its sibling constants in the same file are genuinely passed to their plugins; this one had nowhere to go, by construction and by its own doc comment.
6+
7+
Removed under ADR-0049 enforce-or-remove, because it was a **second source of truth** for the same four column names. The load-bearing one is the adapter layer — `AUTH_MODEL_TO_PROTOCOL` plus the mechanical camelCase-to-snake_case field resolution in `objectql-adapter.ts`, over the `sys_scim_provider` platform object that declares the columns — and it is pinned by the dedicated sso/scim block in `better-auth-schema-parity.test.ts`. A dead copy is worse than none: nothing fails when it drifts from the live names, and the next reader cannot tell which of the two is authoritative. A comment in its place records why no such mapping exists and what owns the names instead, so it is not re-added.
8+
9+
Behaviour is unchanged. No SCIM column name, platform object, adapter mapping or wire shape moves.
10+
11+
Breaking ships as `minor` per the launch-window convention (`scripts/check-changeset-no-major.mjs`).
12+
13+
<!-- adr-0087: not-required (no-migration-prescription) A dead public constant is deleted; nothing consumed it in this repo, in the sibling repos or in the org (measured on origin/main and by org-wide code search, with a positive control on a live symbol in the same file), so no caller has code to rewrite. It is not a metadata surface: no Zod schema, no `packages/spec` declaration, no authorable key and no stored representation, so `objectstack migrate meta` has nothing to visit and there is no tombstone to mint. The column names it duplicated are unchanged and keep their real declaration on the `sys_scim_provider` platform object; an external importer, if one exists, is told by the compiler at the import line, which is more precise than a ledger entry. Nothing to migrate, so no migration is prescribed. -->

packages/plugins/plugin-auth/src/auth-schema-config.ts

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -980,37 +980,23 @@ export const AUTH_SSO_PROVIDER_SCHEMA = {
980980
// SCIM plugin – scimProvider table (@better-auth/scim)
981981
// ---------------------------------------------------------------------------
982982

983-
/**
984-
* `@better-auth/scim` plugin `scimProvider` model mapping.
985-
*
986-
* Each row is a SCIM connection: a bearer token an external IdP (Okta / Entra)
987-
* uses to auto-provision / deprovision THIS environment's users — the env is
988-
* the SCIM Service Provider (ADR-0071). This plugin hardcodes its model and
989-
* exposes NO `schema` option — still true of the installed
990-
* `@better-auth/scim@1.7.0-rc.1` (`SCIMOptions` declares no `schema` /
991-
* `modelName` / `fields` member at all; measured 2026-08-19). It is no longer
992-
* true of `@better-auth/sso@1.7.1`, which this doc used to lean on for the
993-
* comparison and which now accepts one (#8224). So for scim — and for scim
994-
* alone — the ADAPTER layer (AUTH_MODEL_TO_PROTOCOL + field resolution in
995-
* objectql-adapter.ts) is the only available route: the mapping cannot be
996-
* handed to the plugin.
997-
*
998-
* | camelCase (better-auth) | snake_case (ObjectStack) |
999-
* |:------------------------|:-------------------------|
1000-
* | providerId | provider_id |
1001-
* | scimToken | scim_token |
1002-
* | organizationId | organization_id |
1003-
* | userId | user_id |
1004-
*/
1005-
export const AUTH_SCIM_PROVIDER_SCHEMA = {
1006-
modelName: 'sys_scim_provider',
1007-
fields: {
1008-
providerId: 'provider_id',
1009-
scimToken: 'scim_token',
1010-
organizationId: 'organization_id',
1011-
userId: 'user_id',
1012-
},
1013-
} as const;
983+
// NOTE: there is intentionally no `scimProvider` mapping constant here, and no
984+
// `buildScimPluginSchema()`. `@better-auth/scim` hardcodes its model and exposes
985+
// NO `schema` option — still true of the installed `@better-auth/scim@1.7.0-rc.1`
986+
// (`SCIMOptions` declares no `schema` / `modelName` / `fields` member at all;
987+
// measured 2026-08-19), so there is nowhere to hand one. This is no longer true
988+
// of `@better-auth/sso@1.7.1`, which now accepts one (#8224) — for scim, and for
989+
// scim alone, the ADAPTER layer is the only available route.
990+
//
991+
// `sys_scim_provider`'s column names are therefore owned by that adapter layer
992+
// alone: AUTH_MODEL_TO_PROTOCOL + the camelCase → snake_case field resolution in
993+
// objectql-adapter.ts, pinned by the sso/scim block in
994+
// better-auth-schema-parity.test.ts. A copy of those names here would be a
995+
// SECOND declaration of one contract that nothing reads and nothing enforces —
996+
// it could drift from the live one with every gate green, and the next reader
997+
// could not tell which was authoritative (ADR-0049 enforce-or-remove). Do not
998+
// re-add one unless the plugin grows a `schema` option AND it is passed there.
999+
// See ADR-0071.
10141000

10151001
// ---------------------------------------------------------------------------
10161002
// Helper: build device-authorization plugin schema option

0 commit comments

Comments
 (0)