Repository navigation
fix(plugin-auth): Setup > Authentication says when email and password sign-in runs other than its switch shows - #38094
Conversation
…gn-in as it runs 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
📓 Docs Drift Check21 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 21 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 612c8df7eaabb91d71037b36af9058b5f4bbfb57 && git checkout 612c8df7eaabb91d71037b36af9058b5f4bbfb57
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f72f335393f40e27194c56911e6de46052cb6f4c 022ffdfd80121895dba020055859236842bfc094 && git checkout -B drift-repro f72f335393f40e27194c56911e6de46052cb6f4c && git merge --no-ff 022ffdfd80121895dba020055859236842bfc094
node scripts/docs-audit/affected-docs.mjs --json f72f335393f40e27194c56911e6de46052cb6f4c |
|
repo:objectstack#6 · hotlong · session_01Q4EjjQkY5yXZrN9BEA3rEK 维护者速读
席位核对 — ACCEPT · repo:objectstack#6 · head
|
|
repo:objectstack#6 · hotlong · session_01Q4EjjQkY5yXZrN9BEA3rEK Landing: seat ACCEPT 7232512706 at head |
Fixes #38029
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
With nothing stored,
auth.email_password_enabledresolves to the manifest default (true,source: 'default'), while the running auth config takes the deployment's ownemailAndPassword.enabled: the settings pass applies only stored orOS_*values, and the manifest default never rules (auth-settings-declared.ts). So a deployment that declares email and password off showed the switch on for a sign-in method that is off.plugin-authnow registers a live-status provider for theauthnamespace (the settings service'sregisterLiveStatusseam, the oneplugin-emailuses formail). On each page read it compares the switch (SettingsService.getwith the page's own context) with what runs (getPublicConfig().emailPassword.enabled), after any settings pass a change event started:infobanner, "Email and password sign-in is off on this deployment", saying the switch shows the console default and that a value saved here takes precedence;emailPasswordHeldOffByHost, the same predicate the managed save door and settings pass from the previous change read): "... off on this environment",infowith nothing stored,warningover a stored on that is not applied;warningnaming what runs.The banner reaches the page through
GET /api/settings/authas thelive_statusinfo_bannerat the head ofmanifest.specifiers, in the caller's language (all 11 platform locales, kept in the plugin like the mail statement's copy because it is composed per request).Why a banner and not the switch's value. The live-status
values/ servedlivefield admits option-bearing keys only and serves string option values (SettingsNamespacePayloadSchema.liveinpackages/spec), so a toggle cannot be stated there without a spec contract change; and makingvalues.email_password_enabledresolve to the declaration would change whatsource: 'default'means on a published shape. Both are contract decisions, not taken here (see Acceptance notes). The card's expected outcome allows "or marks the toggle as host-declared", which this does.Unchanged: the resolved
values, every save and the managed save door from the previous change. A stored value still wins where it is applied (pinned).Read first (by risk):
packages/plugins/plugin-auth/src/auth-plugin.ts, end ofbindAuthSettings: the provider registration and therunPasswrapper the provider awaits.packages/plugins/plugin-auth/src/auth-settings-live-status.ts,describeEmailPasswordLiveStatus: which case wins.packages/plugins/plugin-auth/src/auth-settings-live-status.test.ts.Two-minute check:
pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/auth-settings-live-status.test.tsshows 7 passed.Tests
New
auth-settings-live-status.test.ts(realAuthPlugin, realSettingsServicewith the shipped auth manifest, realGET /api/settings/:namespaceroute):SettingsService.getand the HTTPvaluesboth still answer{ value: true, source: 'default' }(the premise), and the page is headed by theinfobanner, in English and in zh-CN;infobanner with nothing stored,warningover a stored on that is not applied;warning; every locale carries every sentence.Premise and reverse verification
The fix was committed first (
ee523615);auth-plugin.tswas then restored from the base815e882b(unstaged,git restore --source) and the new file run: 2 failed, 5 passed. The two failures are cases 1 and 4, each at the banner assertion (expected undefined to match object), after the case-1 assertions thatSettingsService.getand the HTTP route answer{ value: true, source: 'default' }with the runtime off had passed: the premise, measured on the HTTP route the page reads. Restored withgit restore --source=HEAD;git status --porcelainempty afterwards.Acceptance notes
email_password_enabled !== false(password length, complexity, and others) stay visible there; the banner states it. Making the switch show the running value needs either the servedlivefield to admit booleans, or a settings-service seam for a runtime-declared default; both change a published contract and are left for a decision.authkeys whose deployment declaration differs from the manifest default (for examplesignup_enabled,require_email_verification); not reached here, the card names onlyemail_password_enabled.Verification
Local runs
pnpm turbo run build --filter='@objectstack/plugin-auth^...' --concurrency=2: 35 tasks successful.pnpm --filter @objectstack/plugin-auth typecheck: passed (tsc --noEmit, the examples project,check:test-typecheckOK).pnpm --filter @objectstack/plugin-auth test: Test Files 296 passed (296); Tests 6305 passed, 10 skipped (6315); lock verdict command-exit 0.022ffdfd(node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands, 77):--ranreconciliation 77 derived, 74 run with exit 0, 3 NOT MEASURED (exit 3, prerequisite):node scripts/check-plugin-teardown-shape.mjs --self-test(its pinned fixture needs an unshallowed clone),pnpm check:dual-build-cjs-loads(reads built output of packages outside the closure built here),pnpm check:type-check-debt(its closure build did not get a turn on the shared verify lock, queue-timeout behind a sibling run). CI runs all three families' scans in its own jobs; they are read from this PR's check-runs, not re-run here.Human Minimum
packages/specholds no runtime logic.pnpm lintis the run CI owns (Lint & Repo Gates), not repeated locally.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code