Repository navigation
fix(plugin-auth)!: Setup → Authentication's switches show what the deployment runs when nothing is saved - #38180
Conversation
…ottom rung of the cascade plugin-auth states the declaration for email_password_enabled, signup_enabled and require_email_verification; the live-status banner keeps only the cases a resolved value cannot say. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
…e auth settings page Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
…ntime-declared-defaults
📓 Docs Drift CheckThis PR changes 4 package(s): 15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 8 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 183 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7db865082df7d5a25cb11862aab382348adf4c02 && git checkout 7db865082df7d5a25cb11862aab382348adf4c02
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4f7aa88a1cd376afbcfcfb51e80c2cce4300586a 35da5d7b3efcf5a01262b9b854833e6c2796acb4 && git checkout -B drift-repro 4f7aa88a1cd376afbcfcfb51e80c2cce4300586a && git merge --no-ff 35da5d7b3efcf5a01262b9b854833e6c2796acb4
node scripts/docs-audit/affected-docs.mjs --json 4f7aa88a1cd376afbcfcfb51e80c2cce4300586a
|
|
repo:objectstack#6 · hotlong · session_01Q4EjjQkY5yXZrN9BEA3rEK Contract reviewServed-tier: First record on this head. Faces: the governed rule text ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentADR-0007 amendment against its first consumer:
The seam (
The three formulas against the running config (
The saves:
The banner:
S1 (should-fix): open.
S2 (should-fix): open.
Nits, none with an effect on correctness or the contract:
No must-fix. Two should-fix, S1 and S2, open on this head. Implemented-by: VERDICT: PASS |
…ntime-declared-defaults
… sign-up holds; refuse a promise from a declared default Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
… accept set on the declaration line Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
…ntime-declared-defaults
|
repo:objectstack#6 · hotlong · session_01Q4EjjQkY5yXZrN9BEA3rEK Contract reviewServed-tier: Delta record by the reviewer of record 7235028565 (PASS at ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentFindings of record 7235028565, at this head: S1 (should-fix): closed.
S2 (should-fix): closed.
The spec file as a schema-face hit: the two comment hunks agree with ADR-0007 rung 4 as amended and with The rework's code change, Nits, none with an effect on correctness or the contract:
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#6 · hotlong · session_01Q4EjjQkY5yXZrN9BEA3rEK 维护者速读
席位核对 — ACCEPT · repo:objectstack#6 · head
|
|
repo:objectstack#6 · hotlong · session_01Q4EjjQkY5yXZrN9BEA3rEK Review requested: this narrowing PR ( Records at head
|
|
repo:objectstack#6 · hotlong · session_01Q4EjjQkY5yXZrN9BEA3rEK Merged; clearing |
Fixes #38098
Clause-②: yes (narrowing) — narrowed: with nothing stored,
SettingsService.get('auth', …)andGET /api/settings/authansweremail_password_enabled,signup_enabledandrequire_email_verificationwith the deployment's declaration (stillsource: 'default') where they answered the manifest default, so a published response's value changes for an existing reader on any deployment whose own configuration differs from the manifest default for one of those keys; on a cloud-managed runtime whose deployment declaresemailAndPassword.enabled: false, a save ofemail_password_enabled: truewith nothing stored answers400 SETTINGS_VALIDATIONand saves nothing in the batch, where it saved a row that was not applied; a save that sets one of these keys to its manifest default where the declaration differs now asks the key's write predicates. Widened:SettingsService.registerDeclaredDefaultand the typeSettingsDeclaredDefault(service-settings);AuthManager.resolveDisableSignUp(public method); a save that sets one of these keys to the declaration with nothing stored is no change and asks no predicate; on a deployment that declaresemailAndPassword.enabled: falsewith nothing stored, the tenauthkeys visible only whileemail_password_enabled !== false(signup_enabled,require_email_verification,password_min_length,password_max_length,password_reject_breached,password_require_complexity,password_min_classes,password_history_count,password_expiry_days,mfa_required) are hidden, so a save of one of them is no longer judged forrequired, options or bounds (for examplepassword_min_length: 2is now stored where it was refused400 SETTINGS_VALIDATION), as under a storedemail_password_enabled: false; a save that turnsemail_password_enabledon re-judges them. The live-status banner drops its declared-off, nothing-saved statement (declaredOffLabel/declaredOffTextcopy removed) and the cloud-managed statement is always awarning.Metadata-protocol: none
Skills-docs: none — no skill under
skills/**teaches the auth settings page, these switches or the settings cascade's bottom rung;content/docs/protocol/kernel/config-resolution.mdxstates the declared default in this change.维护者速读
What changes
The seam (service-settings).
SettingsService.registerDeclaredDefault(namespace, key, provider)lets the package that owns a running config state what a key takes while nothing is stored and noOS_*override is in force. One private reader,defaultOf, answers the bottom rung of the cascade from the provider, else the manifestdefault, and every site that read the manifest default now reads it: the cascade walk (get,getMany,getNamespace, soGET /api/settings/:namespaceand the write-predicate change test), the value a cleared key falls back to invalidatePatch, and the type anOS_*value is coerced to. Asked on each use, never recorded (the startup-registry rule).undefined/nullmeans nothing declared; a throwing provider is said once atwarnand the manifest default answers (functional degradation, nothing persisted is lost). A provider that answers a promise is refused the same way (the contract is synchronous; the cascade reads it inline). The answer is not judged against the specifier's type or options: it is the running system's own value. A key or namespace with no provider resolves byte-for-byte as before.What
sourcereads. Kept as'default'. The published enum (ResolvedSettingValueSchema.sourceinpackages/spec) isenv | global | tenant | user | defaultand admits no distinct value, and the seat ruled no spec shape change. The reading for existing consumers:source: 'default'meant "nothing stored, the manifest default"; it now means "nothing stored, the deployment's default" — still nothing stored, and a clear still returns to it. The consumers that branch on it keep their behaviour:bindAuthSettingsapplies only non-defaultsources (isExplicit), so a declared default is never re-applied (the running config already holds it); the restore-on-clear pass (authSettingsFromStore) is unchanged; the console rendersvalues[key].value. ADR-0007 §Resolution rung 4 is amended in this PR (status line + amendment note), per Prime Directive 13. The spec's own account of the rung (settings-manifest.zod.tsfile header and theSpecifierScopecomment,sys-setting.object.tsheader) now reads the same, andcontent/docs/references/system/settings-manifest.mdxis regenerated (check:generated --fix); comments only, no schema moves.The declarations (plugin-auth,
auth-settings-declared-defaults.ts). Re-measured on base0e361201first (reverse-verification run below, before the fix): all three differ.email_password_enabledtrueemailAndPassword.enabled !== falsefalse→ resolved{true, default}whilegetPublicConfig().emailPassword.enabledisfalsesignup_enabledtrue!AuthManager.resolveDisableSignUp(declared.disableSignUp)(forced off under SSO-only / cloud-managed, thenOS_DISABLE_SIGNUP, then the declaration)disableSignUp: true→ resolved{true, default}whiledisableSignUprunstruerequire_email_verificationfalseresolveEmailVerificationRequirement(posture in force, declared)true→ resolved{false, default}while verification runstrueAuthManager.resolveDisableSignUpis the formulagetPublicConfig()already used, extracted so the declaration and the public config cannot disagree. Registered inbindAuthSettingsnext to the sign-in floor; a settings surface without the method is skipped like the surface's other optional methods.The banner (#38094), reduced. With the declaration as the value, the declared-off/nothing-saved case and the managed/nothing-saved case agree with what runs and state nothing. Left: a value stored on that a cloud-managed runtime does not apply (now always
warning), and any other disagreement (warning). ThedeclaredOffLabel/declaredOffTextcopy is removed from all 11 locales.The managed save of
true(#38028). With nothing stored on a managed runtime that declared email and password off, the key now resolvesfalse, so a save oftrueis a change, reaches theemail_password_enabledsave door and is refused400 SETTINGS_VALIDATION(invalid_value,constraint: { cloudManaged: true, declaredEmailPassword: false }). The settings pass's not-applied hold stays for rows stored before the door existed.Read first (by risk):
packages/services/service-settings/src/settings-service.ts—defaultOfand its three call sites (resolveKeyFromRows,validatePatch,effectiveEnvOverride).packages/plugins/plugin-auth/src/auth-settings-declared-defaults.ts— the three formulas.packages/plugins/plugin-auth/src/sign-in-method-floor.test.ts— the managed describe, whose first case changed meaning (save of on with nothing stored: was stored-and-not-applied, now refused).Tests
service-settings/src/settings-declared-default.test.ts(7): declared value read assource: 'default'throughget/getNamespace/ the cascade chain, asked on each read; CONTROL key and namespace with no provider; stored value wins and a clear returns to the declaration;OS_*wins; a write predicate sees the declaration ascurrent(manifest default is a change; re-saving the declaration is not);undefinedand a throwing provider leave the manifest default (said once); unknown namespace / key refused.plugin-auth/src/auth-settings-live-status.test.ts(realAuthPlugin, realSettingsService, realGET /api/settings/:namespace): declared off, nothing stored →{ value: false, source: 'default' }throughSettingsService.getand the route, no banner; CONTROL declared on →true, no banner; stored value wins both ways and a clear returns to the declaration; managed: nothing stored reads off with no banner, a row stored on before boot is not applied and is stated as awarning(en, zh-CN);signup_enableddeclared off / SSO-only / CONTROL;require_email_verificationdeclared on /email_domainposture / CONTROL.settings-declared-default.test.tsadds a promise-answering provider (manifest default, said once), a patch clear that takes the declaration for the visibility map (a required key behind it is not judged; CONTROL without provider refusesSETTINGS_VALIDATION/required), and anOS_*value read as the declaration's type where the manifest declares no default.auth-settings-live-status.test.tsaddssignup_enabledunderOS_DISABLE_SIGNUPand cloud-managed, and the hidden-key accept set: declared off with nothing stored,password_min_length: 2is stored, a later save ofemail_password_enabled: truere-judges and refuses it; CONTROL declared on refuses the same save.plugin-auth/src/sign-in-method-floor.test.ts, managed describe: new first case pins the managed save oftruewith nothing stored refused (envelopeSETTINGS_VALIDATION+ fieldinvalid_value+ constraint, and400+SETTINGS_VALIDATIONthrough the realPUTroute); the two cases that needed a stored on now seed the row before boot; the Google case now also carries theemail_password_enabledrefusal.Acceptance notes
auth.*keys whose deployment declaration can differ from the manifest default (password_min_length,password_max_length,membership_policy,mfa_required, session and lockout windows, rate limits; the rows ofAUTH_SETTING_RESTORE) still read the manifest default with nothing stored, and asignup_enabledstored on under SSO-only or cloud-managed shows on while sign-up is forced off, with no statement (unchanged here). Both are carried by follow-up card Settings: other auth keys still show the manifest default, not the deployment declaration, when nothing is stored #38184.default; the console's default hint reads the cascade chain'sdefaultentry, which the declaration now answers, so hint and value agree.OS_*coercion type follows the declaration (identical for the three boolean keys);SettingsDeclaredDefaulttakes no context (an optional argument can be added later without breaking); thediffersbanner sentence says "the saved setting", inexact only where the seam is missing or a provider throws with nothing stored.@objectstack/specor@objectstack/platform-objects: their change is comments only, both sit in the fixed release group, and no gate asks for one.email_password_enabled: falseis now no change and asks no predicate (before, the sign-in floor judged it as turning off). It stores the value that already runs.Verification
Reverse verification on base
Fix committed;
packages/services/service-settings/src/settings-service.tsrestored from base0e361201withgit restore --source(unstaged), the three test files run, then restored withgit restore --source=HEAD --staged --worktree(git status --porcelainempty):settings-declared-default.test.ts: 7 failed of 7 (registerDeclaredDefault is not a function— the seam does not exist on base).auth-settings-live-status.test.ts+sign-in-method-floor.test.ts: 7 failed, 65 passed. Failures at the declared-value assertions (expected value false, received truefor email and password and sign-up;expected true, received falsefor verification), after each case's running-config assertion passed; the managed save case and the Google case fail because the save oftrueis not refused. Every CONTROL case passed on base.Local runs at final head 35da5d7 (after the rework round and a merge of origin/main)
pnpm --filter '@objectstack/dogfood^...' build), thenpnpm --filter @objectstack/service-settings typecheck && test: Test Files 79 passed (79), Tests 1545 passed (1545);pnpm --filter @objectstack/plugin-auth typecheck && test(tsc, the examples project,check:test-typecheck): Test Files 296 passed (296), Tests 6310 passed, 10 skipped (6320). Lock verdictcommand-exit 0for the chain.35da5d7b(pnpm --filter @objectstack/dogfood testunder the verify lock): Test Files 491 passed, 3 skipped (494); Tests 4148 passed, 68 skipped (4216); lock verdictcommand-exit 0.node scripts/pm/dispatch-gates.mjs --commands, 127):--ranreconciliation 127 derived, 124 run with exit 0, 3 NOT MEASURED (exit 3, prerequisite):node scripts/check-plugin-teardown-shape.mjs --self-test(pinned fixture needs an unshallowed clone),pnpm check:dual-build-cjs-loadsandpnpm --filter @objectstack/spec run check:skill-examples(read built output of packages outside the closure built here).pnpm --filter @objectstack/spec check:generated: 14 of 14 artifacts current after--fixregenerated the settings manifest reference page. Families CI runs are read from this PR's check-runs, not re-run here.Two-minute check:
pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/auth-settings-live-status.test.ts— 11 passed; the first case showsemail_password_enabledread as{ value: false, source: 'default' }with no banner.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK