Skip to content

fix(auth)!: createAuthClient().updateUser declares a void result, matching better-auth's receipt - #37433

Closed
objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/issue-36987-auth-updateuser-type
Closed

objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/issue-36987-auth-updateuser-type

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #36987

Clause-②: no (narrowing)
Metadata-protocol: none

BREAKING (published typing, shipped as patch): AuthClient.updateUser in @object-ui/auth now resolves Promise<void> instead of Promise<AuthUser>. Callers that read the result, and hosts that implement AuthClient and pass it as AuthProviderOptions.client with an updateUser that returns a user, no longer type-check; read the session instead / return nothing. Runtime behaviour that ever worked is unchanged (the server always answered { status: true }).

维护者速读

  • 用户无感:只改了认证包对外声明的返回类型,界面和资料保存的表现都不变。
  • 为什么做:认证包对外说"改资料后会交回用户",实际服务器只回一个"成功"回执,对外的说明和实际对不上。
  • 出错会怎样:只影响直接调用这个接口的外部代码,它们改读会话即可;改动可直接撤回。
  • 要你做什么:裁定 ADR-0087 处置类别(门禁没有适合「具体类型收窄」的类别),之后批准合并(申报收窄,Tier H)。

What changes

Arm (a): the declaration now says what the call returns. AuthClient.updateUser in @object-ui/auth was declared as a Promise of AuthUser. It is now a Promise of void, and createAuthClient().updateUser resolves with nothing instead of handing on better-auth's answer.

  • FROM (data: Partial of AuthUser) => Promise of AuthUser TO (data: Partial of AuthUser) => Promise of void.
  • Premise measured on origin/main (da7c559): better-auth 1.7.12 dist/api/routes/update-user.mjs ends /update-user with ctx.json({ status: true }) (line 75). plugin-auth passes the route through unchanged (auth-route-ledger.ts, disposition sdk). The client cast that receipt to AuthUser and returned it.
  • Why (a) and not (b), where (b) means returning a real user with one more session read:
    • Census of every updateUser reader under ui/ and apps/: the only in-repo caller of the client method is AuthProvider.updateUser. It awaits the call and ignores the result (since fix(auth, console): saving your profile keeps the page on screen and shows its confirmation #36984), and builds the session user itself. AuthContext.updateUser and useAuth().updateUser already resolve with nothing. ProfilePage calls useAuth().updateUser and never reads a result. No reader needs the user.
    • With (b), every profile write would cost one more round trip to fetch a user that nobody reads. updateUser would also be the only write on AuthClient that returns the entity. changePassword, setInitialPassword, verifyTotp and the other writes all resolve with nothing.
    • @objectstack/client already types the same route as a status receipt (AuthStatusReceipt, pinned in return-type-precision.test.ts). (a) brings the two published clients into agreement about what the server answers.
  • A refusal still rejects, as before. The no data guard stays.
  • Changeset: @object-ui/auth patch with Clause-②: no (narrowing), a **BREAKING** banner and the FROM → TO line (AGENTS.md step 3: a non-protocol breaking change ships patch with its banner). The ADR-0087 disposition marker is pending a maintainer ruling: no category the gate admits fits a concrete-to-concrete narrowing of a published TS member.

Read first (by risk):

  1. ui/packages/auth/src/createAuthClient.ts, the updateUser hunk: the runtime change (returns nothing).
  2. ui/packages/auth/src/types.ts, the AuthClient.updateUser declaration: the published typing.
  3. .changeset/36987-auth-updateuser-returns-void.md: the FROM → TO wording for external callers.

Tests

  • New ui/packages/auth/src/__tests__/updateUser-return-36987.test.ts has two pins. The type pin checks that ReturnType of AuthClient['updateUser'] and of createAuthClient()'s updateUser both equal a Promise of void (held by tsc -p tsconfig.test.json, the package's type-check). The runtime pin checks that { status: true } from the wire resolves to undefined.
  • The existing createAuthClient.test.ts case used to stub /update-user with a { user } body the server never sends and assert result.name. It now stubs the real receipt and asserts that the call resolves with undefined.
Package tests, type-check and build (eb995f6)
  • Closure build under the verify lock: pnpm --workspace-concurrency=2 --filter '@object-ui/auth^...' build, VERDICT command-exit 0.
  • pnpm --filter @object-ui/auth type-check && pnpm --filter @object-ui/auth test && pnpm --filter @object-ui/auth build, VERDICT command-exit 0. Tests: Test Files 51 passed (51), Tests 525 passed (525).
Reverse validation and ablation (one-off, no test file kept)
  • Type leg: scripts/ablation-replace.mjs restored the old declaration in types.ts (anchor 1 → 0, blob 2d83741e → 5b271b75). tsc -p tsconfig.test.json then exited 2 with TS2344 on both type pins (lines 22 and 24) and TS2322 on the client implementation. After restore, git diff HEAD was empty and the blob matched HEAD (2d83741e).
  • Runtime leg: return data as never; was put back into updateUser (anchor 1 → 0, blob b9de0b71 → 344fbc7c). vitest went red on both runtime pins: Tests 2 failed | 42 passed (44), AssertionError: expected { status: true } to be undefined. It was restored (blob == HEAD b9de0b71, git diff HEAD empty). The first runtime attempt was a no-op, because its replacement contained the anchor (count 1 → 1). The tool refused that attempt and restored the file, and the leg was rerun with a different anchor.
  • Both tests import from source, so no dist/ was in the path.

Acceptance notes

  • AuthProvider.test.tsx (line 32) and LoginForm.test.tsx (line 33) mock clients still resolve updateUser with a user object. Nothing reads that value, so no test depends on it, and both files are outside this card's file surface. Noted, not filed.

Verification

Derived gate families (eb995f6)
  • node scripts/pm/dispatch-gates.mjs --commands derived 39 families. 38 ran locally, each exit 0.
  • NOT MEASURED: pnpm --dir ui exec vitest run scripts/, reason: the ui scripts suite needs the whole ui tree built. The @objectstack/formula entry did not resolve, and the forks-pool date-zone pins ran 0 cases (28 failures, none in a file this diff touches). This family is owned by CI.
  • dispatch-gates --ran: 39 derived famil(ies) accounted for — 38 run, 1 NOT-MEASURED.
  • check:commit-card-trailers --range clean, and overlap-check --branch=HEAD VERDICT clean exit 0.

Two-minute check: pnpm --filter @object-ui/auth exec vitest run --root ../.. packages/auth/src/__tests__/updateUser-return-36987.test.ts should show 2 passing tests. pnpm --filter @object-ui/auth type-check should exit 0.


Generated by Claude Code

…hing better-auth's receipt

better-auth's /update-user answers { status: true }, never the user; the
published AuthClient typed it Promise<AuthUser> and the client cast the
receipt to that type. Declare and return nothing, like AuthContext.updateUser.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6Ca6EBDpTBZk8v46Jjv
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head eb995f6 · 2026-11-26T04:53Z

The seat runs the at-tier contract review of this head through an isolated sub-agent; L1 is the seat's own.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: TIER_DEFAULT
Head-sha: eb995f649393a5bf1e5d1cc59fae2a542cac6839
Local-runs: none

PR #37433 (card #36987), arm (a). Read: the card body and its four comments (triage 7133626897, unlock 7134748439, claim 7181949701, dev report 7182978148), the PR body, the five-file net diff against origin/main, the 51 check-runs on this head, and source on main and on the head. Nothing was built or run. No check-run on the head failed; the ones not success are skipped by their selectors.

The code is right and the declaration is not. The verdict is FAIL on M1 alone.

① Derived judgments

  • AuthClient.updateUser: Promise of AuthUser → Promise of void (ui/packages/auth/src/types.ts). Right as a type. The runtime answer on main is better-auth's receipt, and createAuthClient.ts:1110-1120 cast it to AuthUser. void matches the sibling surfaces: AuthContext.ts:105 already declares Promise of void for updateUser, and the neighbouring writes on AuthClient (setInitialPassword, changePassword and the rest) resolve with nothing.
  • createAuthClient().updateUser resolves with undefined instead of the receipt (createAuthClient.ts). Right. It is a runtime change for a JavaScript caller that read .status; the changeset says so. A refusal still rejects and the no data guard is kept.
  • void against AuthStatusReceipt, for parity with @objectstack/client. void is the better type here. packages/client/src/index.ts:5669 types the same route as AuthStatusReceipt, but that SDK publishes the wire, one method per route. AuthClient is the app-facing client that already turns a refusal into a throw, and the literal { status: true } never carries false (index.ts:1519-1527), so the receipt tells a caller nothing the resolved promise does not. Typing it as the receipt would also publish a vendor wire shape on a second package. The two packages now agree on the fact (the server does not echo the user), which is the parity that matters.
  • Census of callers, whole repo on main. Confirmed. The only non-test call of the client method is ui/packages/auth/src/AuthProvider.tsx:549, which awaits and discards the result. ui/apps/console/src/pages/system/ProfilePage.tsx:121,136,148 call useAuth().updateUser, already void, and read nothing. useAuth.ts:47 is the out-of-provider stub. No hit under examples/, skills/, or any ui/** markdown; ui/packages/auth/README.md shows no updateUser result. content/docs/frontend/data-source.mdx:121,150 is a different, user-defined updateUser(id, data) on a data-source example and is not this interface. The remaining hits are plugin-auth server-side writers and @objectstack/client.
  • Accept set, missed by the PR's census: AuthClient is also an INPUT type. AuthProviderOptions.client?: AuthClient (types.ts:788) accepts a host-built client. A host implementation whose updateUser is annotated to return Promise of AuthUser was accepted on main and is refused on the head, because Promise of AuthUser does not assign to Promise of void. That reading is from the type rules, not measured (read-only). It is a published accept-set narrowing in the strict sense, and it reaches a host whose own client did return a real user, so it is not only "code that was already wrong". See M1 and S1.
  • Pins. Sufficient. The type leg is held by tsc -p tsconfig.test.json, which is the second half of the package's type-check script (package.json:34); Type Check UI is success on the head. The runtime leg and the rewritten createAuthClient.test.ts case stub the real receipt.

② Semver level

Level: patch is right. Direction and breaking carriers: wrong.

  • Level. AGENTS.md, Post-Task Checklist step 3: the level follows the Metadata-protocol kind alone, none takes patch, and "a non-protocol change, widening or breaking, ships patch and keeps its BREAKING banner and ADR-0087 disposition". No metadata an author writes moves here, so Metadata-protocol: none and patch both hold.
  • Clause-②: no is true as a value: nothing widens. The arm is what is missing. scripts/pm/clause2-line.mjs (the arm's docblock, [finding] An accept-set narrowing owes a **BREAKING** banner in core but not in platform-objects — and the ADR-0087 classifier reads the banner #16421) says a diff that narrows a published accept set answers no truthfully and is a breaking change, and no (narrowing) exists so that fact is not carried by prose the author may not type. This changeset is exactly that shape: its body says "The published typing narrows" and "TypeScript code that reads a field off the result no longer compiles", and declares no arm, no **BREAKING** banner and no !. So breakingDeclaration in scripts/check-adr-0087-registration.mjs reads it as non-breaking, asks for no disposition, and every gate is green. The green Check Changeset and Governed Surface Queue Guard runs judged the declaration as written; they do not judge whether it is true.
  • "Pulling back to the true contract" does not cover it. The rule in execution-duties.md is 「拉回已声明契约不触它」: restoring behaviour to the DECLARED contract is not Clause ②. Here the declared contract is the thing that moves; the runtime is what stays. The same file's quoted-evidence exemption (「删已发布契约文本本就否定的误拒本身是 no;该 no 须引那段文本」) is about removing a false refusal, a widening question, and says nothing that turns a narrowing into a non-break. Line 108 states the applicable rule: a card narrowing a published accept set is Clause-②: no, stays in lane, and owes a contract-tier L2 review before it queues.
  • Precedent on main, three for three:

M1 (must-fix) — The PR body and the changeset declare Clause-②: no on a published typing narrowing that stops consumer TypeScript compiling (result readers, and host AuthClient implementations passed as AuthProviderOptions.client). It must read Clause-②: no (narrowing) on both carriers, with Metadata-protocol: none and patch kept; the changeset summary and PR title take fix(auth)!:; the changeset body takes a **BREAKING** banner and exactly one ADR-0087 disposition marker. The card's own acceptance ("Narrowing the declared return changes the published typings, so the changeset says so") is met in prose only, which is the carrier #16421 measured as the one that fails.

Consequences of M1 that the lane must carry, none of them this record's to waive:

  • The declared narrowing moves the PR to the narrowing face: CONTRACT_REVIEW_TIER, scope every non-prose path, with ④. This TIER_DEFAULT record cannot be the PASS of record for the corrected head; a full review is owed there.
  • The queue guard's declared-narrowing leg reads the arm as Tier H, so the PR waits for the maintainer's approval instead of queuing.
  • The dev report's dogfood_battery: n/a — no ! and no (narrowing) arm rests on the wrong declaration and must be answered again.
  • Disposition category: escalated, not decided here. type-surface-only needs a base-side any/unknown/unannotated symbol (predicate 4) and the base is a concrete AuthUser; runtime-export-retired needs a member gone at HEAD and the member stays; no-migration-prescription and runtime-interface-only are both refused by a body that carries a FROM → TO prescription, which this body does and must. If the gate admits none, that is a gap in the closed vocabulary for "a concrete published return type changed", and it goes to the maintainer as a ruling request. ⛔ It is not solved by leaving the breaking carriers off.

③ Boundary flags

  • open_questions: empty. Nothing to answer.
  • Dev flag, not filed: the mock clients at AuthProvider.test.tsx:32 and LoginForm.test.tsx:33 still resolve updateUser with a user object. Agreed, no card. The mocks are untyped vi.fn(), Type Check UI is green, nothing reads the value, and AuthProvider.test.tsx:671 already carries the truthful receipt for the one test that is about this call. See N1.
  • Dev deviation, NOT MEASURED locally: pnpm --dir ui exec vitest run scripts/. Accepted: Test UI and its shards are success on the head, and the diff touches no file that suite reads.
  • Dev deviation, co-author trailer amended before push: no published commit carries it; nothing owed.
  • SQL push-down (AGENTS.md, Prime Directive 5): not applicable. The diff is a client typing, one return statement and tests; it adds no query, no id materialisation and no in-app join.
  • Security: none. No auth decision, session handling or request moves; security_findings: none holds.
  • PR author is objectstack-fleet[bot]; no off-relay write to name.

S1 (should-fix) — The changeset's migration text names only callers that read the result. It omits the host that implements AuthClient and passes it as AuthProviderOptions.client (types.ts:788): an updateUser annotated to return the user no longer assigns. Add that FROM → TO line (return nothing, or annotate Promise of void) when the body is rewritten for M1. Reasoned from the type rules, not measured.

N1 (nit) — AuthProvider.test.tsx:32 and LoginForm.test.tsx:33 model an answer the server never sends. No card; change them to resolve with nothing the next time either file is touched.

N2 (nit) — The no data guard in createAuthClient.ts now protects a value nobody receives and no test pins it. Keeping it is harmless (an empty 2xx is still an anomaly); a one-line comment saying why it stays would stop the next reader deleting it.

Implemented-by: claude/issue-36987-auth-updateuser-type
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: eb995f649393a5bf1e5d1cc59fae2a542cac6839
REWORK — L1, seat repo:objectstack#5: contract record 7183053079 reads FAIL on the declaration (M1). The code holds.

  1. Shape: open draft against main, 5 files (+74/−12), @object-ui/auth patch, Clause-②: no, Metadata-protocol: none. l1-face is CLEAN: 38 success, 13 expected skip, 0 failed.
  2. Premise: arm (a) is right. void is a better published type than AuthStatusReceipt for the app-facing client, which already throws on refusal and whose sibling writes are void. The census holds repo-wide: the only non-test caller, AuthProvider.tsx:549, discards the result. The type and runtime pins hold.
  3. Owed in this PR:
    • M1. This is a published typing narrowing that stops consumer TypeScript compiling. Declare Clause-②: no (narrowing) in both the PR body and the changeset, retitle fix(auth)!:, add a **BREAKING** banner and add one ADR-0087 disposition marker. patch and Metadata-protocol: none stay (AGENTS.md step 3). Precedent: @objectstack/client b1b978c (client SDK auth.* family: bind the 14 return res.json() methods (auth 7 · sessions 3 · twoFactor 3 · accounts.unlink 1) to their better-auth wire shapes — #12104 family card 2 of 3 #14313, same route, ! + banner + type-surface-only), .changeset/36410-… and .changeset/36331-…. On the disposition category, the record reads none as a clean fit (type-surface-only expects a base-side any/unknown). Try the gate. If it admits none, tell the seat, and the seat takes it to the maintainer; that does not drop the breaking carriers.
    • S1. The migration text covers only callers that read the result. Add hosts that implement AuthClient themselves and pass it as AuthProviderOptions.client (types.ts:788): an updateUser returning a user no longer assigns to it.
    • dogfood_battery. Re-answer it on the new head; n/a rested on the old declaration.
  4. Accepted deviations: nits N1 (the test mocks at AuthProvider.test.tsx:32 and LoginForm.test.tsx:33 return a user the server never sends; fix them on the next touch) and N2 (the no data guard in createAuthClient.ts needs a one-line comment on why it stays).
  5. Out of scope and where it went: none.
  6. Landing terms: after M1 the PR is on the narrowing face. That means CONTRACT_REVIEW_TIER with ④, and Tier H through the declared-narrowing leg. Owed: an at-tier PASS on the new head, an ACCEPT with the maintainer brief, then the seat's hand-off to the approver.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Maintainer ruling recorded · 2026-11-26T05:39Z

Who: Bill (os-bill). Where: seat 5's thread, decision card. Words: 「新增第八类」, answering 「已发布 TS 类型从具体类型收窄,ADR-0087 用哪个处置类别?」. ADR-0087 gains an 8th disposition category, runtime-member-retyped, built on #37447 (Tier H, under #36987). This PR stays draft, keeps !, the BREAKING banner and Clause-②: no (narrowing), and carries one runtime-member-retyped marker once #37447 merges. ⛔ Do not rewrite the member as a method signature to pass the gate. After that: a delta contract review on the narrowing face at CONTRACT_REVIEW_TIER, the dogfood battery on the final head, then ACCEPT and hand-off to the approver.

This was referenced Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Superseded by #38431. Seat 3 took #36987 after seat 5 released it (7192939331), under claim 7247768905. #38431 carries this PR's 4 commits cherry-picked onto current main in order, and adds the runtime-member-retyped marker (FROM and TO on one line) and the N1 test-double fix. Closing this draft so the card has one PR. The commits stay reachable on this branch.

Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… session's language (objectstack-ai#37965)

Fixes objectstack-ai#34171

Clause-②: yes (widening) — `@object-ui/auth` `ForgotPasswordFormProps`
gains the optional `errorMessages`; `@object-ui/i18n` gains
`auth.login.errors.managedPasswordSignIn` and
`auth.login.errors.managedPasswordReset` in every locale
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:托管环境里有人用密码登录、找回、重置或设置密码时,页面不再显示英文的“请求失败
409”,而是用当前语言说明本环境通过身份提供方登录,并指向那个登录按钮;自建部署的登录不变,只有单点登录专用模式下找回或设置密码被拒时也改为同一句本地化说明。
- 为什么做:属于托管环境登录体验收尾,替托管环境的用户解决“中文页面冒出看不懂的英文报错”。
- 出错会怎样:最坏是这几个页面在托管环境回到原来的英文状态行,其他报错照旧显示服务端原文;改动可直接撤回。
- 要你做什么:无。

## What changes

On `origin/main`, a cloud-managed runtime refuses the password doors
with 409 `RESOURCE_CONFLICT`, and the code never reached the pages. The
hosted relay (`auth-proxy-plugin.ts`, every password door) and
plugin-auth's set-initial-password route (`cloudManagedRefusal`) answer
in the ADR-0112 envelope, `{ success: false, error: { code, message }
}`. better-fetch spreads that body, so its code and message arrive
nested under `error.error`, and `toAuthError` read only the top level.
plugin-auth's reset doors throw better-auth's `APIError` from the before
hook, a flat body with the code. There the code was dropped by the call
site: `forgotPassword` and `resetPassword` threw a bare `new
Error(message)`. So sign-in, forgot, reset and set-password showed the
server's English sentence or `Auth request failed with status 409`,
whatever the language, and no host map could localize a code that never
arrived. The fix is on the producer side of the client boundary first,
then the localized copy.

- `ui/packages/auth/src/createAuthClient.ts`, the `toAuthError` hunk:
`code`, `message`, `details` and `userMessage` are read from the flat
body first and from the envelope's `error` only when the flat body has
none. A better-auth refusal answers exactly as before. The same file
already reads both shapes in `acceptInvitationOneStep` (`body.code ??
body.error.code`). `forgotPassword`, `resetPassword` and
`setInitialPassword` now throw through `toAuthError`, so they keep the
code and status. Their message fallbacks are unchanged. The `updateUser`
hunk and `types.ts` (open PR objectstack-ai#37433) are untouched, and the two PRs
merge in either order.
- `ui/packages/auth`: `ForgotPasswordForm` gains `errorMessages`, the
same code-to-text map `LoginForm` takes. The lookup `LoginForm` used is
moved, unchanged, to `refusal-text.ts` and shared.
- `ui/packages/app-shell`: `signInRefusalMessages` maps
`RESOURCE_CONFLICT` to `auth.login.errors.managedPasswordSignIn`, which
says the deployment signs you in through its identity provider and
points at the button above. The new exported
`passwordDoorRefusalMessages` maps it to
`auth.login.errors.managedPasswordReset` for the forgot, reset and
set-password doors. Three plugin-auth producers answer that code there,
and the map's comment names them: `cloud-managed.ts`, and two that a
self-hosted deployment answers too. `sso-only-local-password.ts` refuses
an account the identity provider provisions while SSO-only mode is on,
and `pending-sso-marker.ts` refuses a pending SSO person. The sentence
(you sign in through the identity provider, and no password is set or
reset here) is true for all three readers, so the mapping stands for
them. It is kept separate on purpose, because the sign-in map's
two-factor sentences (`INVALID_CODE`, and so on) would be wrong on a
reset door. The package's forgot-password page passes it.
- `ui/apps/console`: the forgot-password page passes the map, and the
reset-password and set-password pages map the toast's description
through it.
- `ui/packages/i18n`: two keys in every locale (the key-parity test
requires all eleven). The zh-Hant entries come from `gen:zh-hant`.

Read first (by risk):
1. `ui/packages/auth/src/createAuthClient.ts`, the `toAuthError` hunk:
the read order (flat first, envelope second) is what keeps every
better-auth refusal unchanged.
2. `ui/packages/auth/src/createAuthClient.ts`, the `setInitialPassword`
hunk: it now throws through `toAuthError` with its old status-line
fallback, so it also carries `code` and `status`.
3. `ui/packages/app-shell/src/console/auth/signInRefusalMessages.ts`:
the two maps and why they are separate.

## Tests

- New
`ui/packages/auth/src/__tests__/managedRefusalEnvelope-34171.test.ts`.
It drives the real client over a mocked `fetch`. Each of the four doors
rejects with code `RESOURCE_CONFLICT`, status 409 and the envelope's
message, and `details` and `userMessage` survive. Three controls: the
flat better-auth body answers as before, the flat body wins when both
name a code, and an empty body keeps the status line with no code.
-
`ui/packages/app-shell/src/console/auth/__tests__/loginRefusalCodes-11058.test.tsx`,
new top-level describe. It renders the published login page over a real
client in zh. The envelope 409 shows the zh `managedPasswordSignIn`, and
neither the server sentence nor the status line appears. CONTROL:
another code in the envelope shows its own server message.
- New
`ui/packages/app-shell/src/console/auth/__tests__/passwordDoorRefusal-34171.test.tsx`.
The forgot-password page, end to end in zh, shows the localized reset
sentence. CONTROL: an unmapped refusal keeps its message. A map-shape
pin checks that the reset map carries no sign-in sentence.
-
`ui/packages/auth/src/__tests__/forgot-password-success-message.test.tsx`,
new describe: `ForgotPasswordForm` maps by code. Two controls: an
unmapped code, and no map at all.
- New
`ui/apps/console/src/pages/auth/__tests__/passwordDoorRefusal-34171.test.tsx`:
the reset-password and set-password pages show the localized sentence.
CONTROL: another code keeps its server message. A further describe pins
the self-hosted SSO-only refusal (plugin-auth's own
`SSO_ONLY_REFUSAL_MESSAGES` text) on both pages: it shows the same
mapped sentence.

Reverse validation (one-off, no test file kept):
`scripts/ablation-replace.mjs` replaced the envelope read with an empty
object (anchor 1 to 0, blob d782162 to f40658a6). The envelope pins and
the app-shell end-to-end pins went red: `Tests 8 failed | 18 passed
(26)`. Restored: blob equals HEAD (d782162) and `git diff HEAD` is
empty. These tests import from source, so no `dist/` was in the path.

## Acceptance notes

- On the sign-in door only a cloud-managed runtime answers
`RESOURCE_CONFLICT`, so a self-hosted sign-in is unchanged. On the reset
and set-password doors, a self-hosted deployment in SSO-only mode, or a
pending SSO person, now sees the localized sentence in place of
plugin-auth's English one. That is deliberate (contract review
7219466980, S2): the sentence is true for that reader.
- The phone reset doors (`postPhoneNumberEndpoint`) still read only the
flat body. The hosted relay notes that the phone-number plugin is not
mounted on a hosted runtime, so no managed refusal reaches them. Left as
is.
- The set-password page's copy is the reset sentence ("no password is
set or reset here"), which fits a signed-in person who came in through
single sign-on.
- The claim was revised in 7218058235 to cover `createAuthClient.ts`
(`toAuthError` hunk), app-shell, i18n and the console pages. Routing
`forgotPassword`, `resetPassword` and `setInitialPassword` through
`toAuthError` is three call-site lines outside that hunk. They are
needed for the reset doors to carry the code, and they do not touch the
`updateUser` hunk.

## Verification

Two-minute check: `cd ui && pnpm exec vitest run
packages/app-shell/src/console/auth/__tests__/loginRefusalCodes-11058.test.tsx`.
Expect all tests green, including `a cloud-managed password refusal is
localized`.

<details><summary>Rework round (head e28f645)</summary>

- Changes: the declaration is now `Clause-②: yes (widening)` (S1). The
changeset and this body correct the self-hosted claim and the mechanism
sentence (S2, N3). The `passwordDoorRefusalMessages` comment names the
three producers. A new SSO-only pin was added. No runtime code changed.
- `vitest run` of the five touched test files: `Test Files 4 passed`,
`Tests 41 passed`. The console file then failed to load until
`@objectstack/client` was built. After that build, the console file
alone: `Test Files 1 passed (1)`, `Tests 6 passed (6)`, `VERDICT
command-exit 0`.

</details>

<details><summary>Package tests, type-check and build (head
fe59df0)</summary>

- Closure build: `pnpm --workspace-concurrency=2 --filter
'@object-ui/app-shell^...' --filter '@object-ui/console^...' build`,
`VERDICT command-exit 0`.
- `pnpm --workspace-concurrency=2 --filter @object-ui/auth --filter
@object-ui/i18n --filter @object-ui/app-shell --filter
@object-ui/console type-check`, `VERDICT command-exit 0` (auth, i18n and
app-shell include their test tsconfig; console includes `src`).
- `vitest run packages/auth/ packages/i18n/
packages/app-shell/src/console/auth/`: the first run was red only on
`zh-hant-generated` (zh-Hant was hand-written), fixed by regenerating.
Then `packages/i18n/`: `Test Files 107 passed (107)`, `Tests 1867 passed
| 13 skipped`.
- `pnpm --filter @object-ui/console test`: `Test Files 339 passed
(339)`, `Tests 3711 passed (3711)`, `VERDICT command-exit 0`.
- app-shell (2428 test files) was narrowed locally to
`src/console/auth/`. The full suite is CI's.

</details>

<details><summary>Derived gate families (dispatch-gates --commands,
42)</summary>

- 41 of 42 exited 0. `pnpm --dir ui exec vitest run scripts/` was
SIGKILLed for memory on its first run, while the console suite ran
beside it. Rerun alone, it exited 0: `Test Files 172 passed | 2 skipped
(174)`.
- `dispatch-gates --ran`: `42 derived, 42 run, 0 NOT-MEASURED, 0 UNRUN`.

</details>

---

_Generated by [Claude
Code](https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK)_

<!-- signed: repo:objectstack#6 · hotlong ·
session_01Q4EjjQkY5yXZrN9BEA3rEK -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…he session's language (objectstack-ai#38025)

Fixes objectstack-ai#37973

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 个人资料页「设置本地密码 / 修改密码」被托管环境拒绝时,用户看到的提示从服务器英文原句改为当前语言的说明。
- 为什么做:登录、忘记密码、重置密码页面已经本地化了同一种拒绝,个人资料页是漏掉的最后一处。
- 出错会怎样:最坏是又显示回英文原句,不影响密码本身;可直接撤回。
- 要你做什么:无。

## What changes

- **Profile page password card** (`PasswordCard` in the console's
`ProfilePage.tsx`): a rejected set-password or change-password now picks
its text by the refusal's `code` through the existing
`passwordDoorRefusalMessages` map (app-shell), the same lookup the
set-password page makes. A 409 `RESOURCE_CONFLICT` (cloud-managed
runtime, SSO-only account, pending SSO person) draws the localized
sentence; any other code, or none, keeps the server's message. The
lookup is own-key only, so a code that happens to spell an
`Object.prototype` member never picks a function.
- **Auth client** (`@object-ui/auth` `createAuthClient`):
`sendVerificationEmail`, `signOut` and `signInWithProvider` now reject
through `toAuthError`, so the thrown error carries `code` and `status`
from better-auth's flat body or from the ADR-0112 envelope. The
`message` is unchanged.
- No third map: the password-door map is reused as the dispatch asked.
Its sentence is true on this card too (no password is set or reset here
for this person).
- `updateUser` stays as it is: it is fenced by open draft PR objectstack-ai#37433, and
the profile password card does not call it, so this PR closes the card.
That method's switch to `toAuthError` belongs to objectstack-ai#37433's hunk.
- One changeset: `@object-ui/auth` and `@object-ui/console`, patch.

## Tests

-
`apps/console/src/pages/system/__tests__/ProfilePage.passwordRefusal-37973.test.tsx`
(new, 4 cases): renders the real page and the real map. Set-password and
change-password with `RESOURCE_CONFLICT` draw the localized sentence and
read pack key `auth.login.errors.managedPasswordReset`. CONTROL:
`INVALID_PASSWORD` keeps the server's message, and so does a rejection
with no code.
- `packages/auth/src/__tests__/managedRefusalEnvelope-34171.test.ts`: a
new top-level `describe` (6 cases) drives the real client over a mocked
`fetch` for the three methods. An envelope refusal keeps
`RESOURCE_CONFLICT` / 409 / its message. CONTROL: a flat better-auth
refusal keeps its own code and message.

<details><summary>Readings at 2d52a41</summary>

All at head `2d52a41c`, run from `ui/` under the shared verify lock.

- `pnpm exec vitest run packages/auth/
apps/console/src/pages/system/__tests__/
apps/console/src/pages/auth/__tests__/passwordDoorRefusal-34171.test.tsx`:
`Test Files 65 passed (65)`, `Tests 655 passed (655)`, VERDICT
command-exit 0.
- `pnpm --filter @object-ui/auth type-check`: exit 0. `pnpm --filter
@object-ui/console type-check`: exit 0, after building the console's
dependency closure.
- Reverse check (fix commit first, both source files restored from the
merge base with `git restore --source`, test files kept): `Tests 8
failed | 10 passed (18)`. The 8 failures are the 6 new client cases and
the 2 profile `RESOURCE_CONFLICT` cases. The 2 profile CONTROLs pass on
the base, as they should. Restored with `git checkout HEAD`, and `git
diff HEAD` is empty afterwards.
- Derived gate families (`dispatch-gates.mjs --commands`): 37 of 39 exit
0, including `pnpm --dir ui exec vitest run scripts/` (`Tests 5138
passed | 2 skipped`). `check:query-options-erasure` and
`check:type-check-debt` were killed by a 300s local timeout on a shared
box, so they are NOT MEASURED locally and CI runs both.

</details>

## Acceptance notes

- On the profile card the sentence's second half ("Sign in with the
identity provider's button on the sign-in page") is written for a
sign-in page, and this reader is already signed in. It is still true,
and the dispatch said to reuse the map rather than add a third. A
card-specific sentence would mean a new pack key in every locale. Noted
here, not filed.
- On `main` today the cloud-managed refusal closes
`set-initial-password` and leaves `change-password` open (the
`cloud-managed.ts` header says changing a password is
`/change-password`'s, cloud#4471). The change-password mapping covers
any producer that answers that code there, and the change-password test
pins the card's behaviour, not a server door.

## Verification

Read first (by risk):
1. `ui/packages/auth/src/createAuthClient.ts`, the `signOut` hunk: the
rejection now carries `code`/`status`. Its `message` is byte-identical,
and `TokenStorage.clear()` still runs before the throw.
2. `ui/apps/console/src/pages/system/ProfilePage.tsx`, the
`PasswordCard` `catch`.
3. The new profile test.

Two-minute check: from `ui/`, run `pnpm exec vitest run
apps/console/src/pages/system/__tests__/ProfilePage.passwordRefusal-37973.test.tsx`.
Expect `Tests 4 passed (4)`.

---

_Generated by [Claude
Code](https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…d — ADR text (D10) and the registration gate (objectstack-ai#38365)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XHogQ9ogKPxHhiFfT2UQgJi)_

Fixes objectstack-ai#38328
Fixes objectstack-ai#37447

Claims: objectstack-ai#38328 (7240075259) and objectstack-ai#37447 (re-posted 7242295202, naming
this branch).
Clause-②: no
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:用户无感。「元数据协议升级契约」这份架构决定记录新增第八种申报类别(已发布类型上的成员留着、但声明的类型改了),登记检查同一笔学会核验它。
- 为什么做:你在决策卡上选了「新增第八类」,这里把它写成成文规则;此前这类改动没有一个如实可选的申报类别,写破坏性变更说明的开发者只能卡住。
- 出错会怎样:只有写破坏性变更说明的开发者会照这段文字申报,运行中的系统不受影响;文字有误可以直接撤回这一笔。
- 要你做什么:审阅并批准合并(Tier H)。文字与门禁两半已按座位路由裁定并进本
PR(门禁的词表钉要求两边同一笔,任一半单独合并都会报红);objectstack-ai#38366 已并入关闭。

## What changes

Two files, both halves of one decision, combined by the seat's route
ruling (recorded on objectstack-ai#37447 and objectstack-ai#38328: combine, reason = the objectstack-ai#8299
lockstep pin):

- `docs/adr/0087-metadata-protocol-upgrade-contract.md`: +199 −4 (1538
to 1733 lines) — the ADR half (objectstack-ai#38328), described below.
- `scripts/check-adr-0087-registration.mjs`: +922 −93 — the gate half
(objectstack-ai#37447 item 2), cherry-picked from
`claude/issue-37447-runtime-member-retyped` (closed PR objectstack-ai#38366; os-dev
report 7241851254 on objectstack-ai#37447) and then reworked on this branch for L2
record 7242485283 and L2 delta record 7243871018 (os-dev reports
7243462155 and 7244464363 on objectstack-ai#38328): `runtime-member-retyped` in
`CATEGORIES`, `verifyRuntimeMemberRetyped` with
`RUNTIME_MEMBER_RETYPED_PREDICATES` (`present-at-both-type-differs`,
`no-metadata-surface`, `from-operands-named`), D9's predicates 2–3
lifted into shared helpers with no behaviour change, an explicit
`strictNullChecks`, and the self-test batteries RMR (83) and RMR-N (3).
The rework adds reading (b) of predicate 1 (see the table below).
`type-surface-only` and its predicate 4 are unchanged apart from one
hint line in an existing refusal.

The ADR's changeset disposition vocabulary gains its eighth category,
`runtime-member-retyped`, for a member that stays on a published type
while its declared type changes. Five places move together:

1. **Status line.** The 2026-11-28 amendment entry: the card and its
parent, the decision's own words 「新增第八类」, and where the decision is
recorded.
2. **Vocabulary block** (2026-08-13 addendum). The eighth marker line,
`runtime-member-retyped PACKAGE#TYPE.MEMBER`.
3. **The two prose enumerations beside that block.** The list of
categories resting on a checked fact, which the 2026-11-12 amendment
offers a refused narrowing, and the sentence that names each added
category and the addendum that explains it.
4. **A dated note under D8's predicate 4.** The retyped-member class got
a category of its own instead of a limb on predicate 4, which reads
exactly as it did.
5. **A new addendum (2026-11-28) with D10.** Provenance, the dead end
the category closes (measured), the operands, the three predicates by
name, what the category inherits and what it leaves alone, the worked
example, and what it does not decide.

No untouched text is rewritten, and no existing category's wording
changes.

**The category, as written.** It is D9's sibling. The operand is a
member of a type the package's published entry exports (or a member of
an exported value, read on that value's type as D9's reader reads it),
`PACKAGE#TYPE.MEMBER`, or `PACKAGE/SUBPATH#TYPE.MEMBER` behind a literal
subpath key. An export operand and the whole-package operand are refused
by name. Three predicates, checked by name:

| predicate | what it asks |
|---|---|
| `present-at-both-type-differs` | The type is exported at the merge
base and at HEAD, the member is on it at both, and the type the checker
prints for the member (with its optionality, under `strictNullChecks`)
differs. A vanished member, an added member, and a declaration naming a
type the reader cannot resolve are refused. Reading (b), added in the L2
rework: also refused as unprovable, at either revision, a member whose
printed type names a type with no declaration behind it, or carries more
`any` than the member's own declarations write. An `any` the declaration
writes is still compared as written. The refusal covers what leaves a
trace (the member's own declaration, the printed type); a type that
rests on something unresolved without a trace is compared, on three
named roads carried by objectstack-ai#38379. |
| `no-metadata-surface` | D9's predicate 2, asked at both revisions. |
| `from-operands-named` | D9's predicate 3, unchanged. |

It inherits the `no-migration-prescription` refusal as D9 does, it does
not go through D8's text walker, and D8's predicate 4 gains no limb.

**Agreement with the gate half.** The text was first read against the
gate branch for objectstack-ai#37447 at `a2b044f1fb` and `e657c303b2`. The gate in
this PR is no longer that file: the L2 reworks changed it on this branch
(blob `e56281db17` first, `15df493f67` at `e2661365c1`, `bc082d7904` at
`8c1017d6d2` and this head), and the ADR changed with it each time:
predicate 1 corrected and scoped to traces, and "What this does not
decide" gaining the trace-less item and one scoped clause. Category
name, operand forms, the three predicate names and each predicate's
reading agree, and neither half departs from the decision's design.

**The vocabulary pin is green on this head.** The gate pins the
categories the ADR documents to the categories it accepts, both ways;
either half alone was red (`documented but not accepted` / `documented
nowhere`), which is why they are one PR.

**Read first** (by risk)

1. The three predicates under D10, from "An author may claim the
category when". Predicate 1's reading is the part the gate has to
implement word for word.
2. The paragraph "D8's predicate 4 is not weakened" and the 2026-11-28
note under D8. The risk is any wording that could be read as a limb on
predicate 4.
3. The table under "The dead end it closes". Two of its rows record
admissions, not refusals: `already-registered` on any old id, and the
two catch-all categories on a body the detector does not read.

**Two-minute check.** Run `node scripts/check-adr-0087-registration.mjs
--self-test` on this branch: it prints 960 assertions (V3 included) and
exits 0.

## Tests

The gate's suite is its own `--self-test` (no test file names the
script). The L2 rework changes behaviour, so it carries new pins and
ablations:

- New pins: RMR-R12 / R12b (inferred `any` at both revisions, refused as
unprovable, not "the SAME"), RMR-R13 (`any` at one revision, refused),
RMR-R14 (annotation naming a local alias over an unresolved name),
RMR-R15 (a mapped type's member), RMR-G4 (a written `any` is still
compared and its retyping admitted); for the nits RMR-G5, R16, G6, R17.
Round 3 adds RMR-C1 (road b, a named compare on the `keyof` shape, to
turn red when the road is closed), RMR-G7 and G7b (a member of an
exported value; the `any` count over an initialiser), RMR-R17's wording
pin with R17b and R17c (the private-package refusal names a retyping;
D9's sentence unchanged), and one pin each on RMR-R12 and R13 for the
remedy line. RMR goes from 44 to 83 cases, its floor with it; the
self-test from 921 to 960 assertions.
- Ablations at `e2661365c1` (accept-set; the arm did not move after it),
direction written before each run, restored each time (`git diff HEAD`
empty): (A) the new arm off: predicted 14, observed 14 red; (C1) the
`any` rule alone off: 8 / 8; (C2) the name rule alone off: 6 / 6; (D)
the written-`any` allowance zeroed: 1 / 1 (RMR-G4); (B) RMR floor at 73:
refused, fixing the battery at exactly 72. At `8c1017d6d2` (the gate
blob of this head): (N7) the wording handed back to D9's: 2 / 2; (N8a)
the merge-base clause off: 1 / 1; (N8b) the clause always on: 1 / 1; (D)
the written-`any` allowance zeroed: 3 / 3 (RMR-G4, G7, G7b); (B) the
floor at 84: refused, fixing the battery at 83.
- On the real `@objectstack/client`, `ObjectStackClient.connect` was
refused as "the SAME at both revisions" at `31596e5b6e` and is now
refused as unprovable, naming `GetDiscoveryResponse`. On the real
`@object-ui/auth`, `AuthClient.updateUser` is still verified and
`AuthClient.signOut` still "the SAME".
- **What predicate 1 does not refuse, stated and carried.** The refusal
covers what leaves a trace. A type that rests on something unresolved
without one is compared, on three roads, each measured through the
shipping gate: (a) the `any` count is a count, not a position, and the
produced `any` arrives through a local alias or by inference; (b) an
operator such as `keyof` consuming an unresolved type behind a local
alias (pinned by RMR-C1 as a named compare); (c) inference through a
local overloaded function. Predicates 2 and 3 hold on all three. The ADR
and the gate header both state this and name the carrier, objectstack-ai#38379; until
it lands, that item is the contract. Road b was left stated, not closed:
following every local alias would refuse the by-design named compare.

<details>
<summary>The dead end, measured: the worked example under every existing
disposition</summary>

Method: the net diff of PR objectstack-ai#37433 (head `ac218b2489`) applied on
`4cb162bfb9` in a detached comparison worktree, the changeset's marker
and its FROM / TO spelling rewritten per variant, each variant committed
locally and judged by the shipping gate's own `assertInputs` and `scan`.
Nothing from that worktree was pushed.

| variant | marker | how the fix is spelled | outcome |
|---|---|---|---|
| V0 | `type-surface-only`, bare | the PR's own two-line pair | refused,
predicate 4 |
| V1 | `type-surface-only`, dotted member path | two-line pair |
refused, predicate 4 |
| V2 | `no-migration-prescription` | two-line pair | admitted |
| V3 | `runtime-interface-only` | two-line pair | admitted |
| V4 | `runtime-export-retired`, member operand | two-line pair |
refused, predicate 1 |
| V5 | `unpublished` | two-line pair | refused |
| V6 | `registered`, an id not in the diff | two-line pair | refused |
| W1, W3 | the two catch-all categories | one arrowless FROM … TO line |
admitted |
| W2, W4 | the two catch-all categories | an arrow line under no
migration label | admitted |
| W5, W6 | `runtime-export-retired`, member operand | arrowless line,
arrow line | refused, predicate 1 |
| W7 | `already-registered`, a real id older than the merge base |
two-line pair | admitted |
| X1, X2 | the two catch-all categories | a labelled FROM → TO arrow
line | refused by the prescription detector |
| X3 | `type-surface-only`, bare | labelled arrow line | refused,
predicate 4 |

</details>

<details>
<summary>The two halves in one tree: green, and the worked example is
accepted</summary>

Joint tree `e121e0e10c`, a local-only merge of the gate branch at
`a2b044f1fb` with this branch at `819cdf7cd0`. This reading predates the
L2 rework: the ADR and the gate both changed at `e2661365c1`, so the 921
below is that tree's number, not this head's (960). R2 and R6 were
re-measured on this head's gate and still hold.

- `node scripts/check-adr-0087-registration.mjs --self-test` printed `✓
check-adr-0087-registration --self-test: 921 assertions over real temp
git repos (real scan()/assertInputs() path)`, exit 0.
- `node scripts/check-adr-0087-registration.mjs --base origin/main` exit
0.

Each half alone:

- This branch: exit 1, `category documented but not accepted:
runtime-member-retyped`; the self-test reports one failure, `V3`.
- The gate branch at `e657c303b2`: exit 1, `category documented nowhere:
runtime-member-retyped`.

The worked example on the joint tree, same driver:

| variant | marker and how the fix is spelled | outcome |
|---|---|---|
| R1 | `runtime-member-retyped @object-ui/auth#AuthClient.updateUser`,
the PR's own two-line pair | refused by predicate 3: the body carries a
vertical FROM / TO pair, which this category does not read |
| R2 | same marker, one FROM … TO … line with `AuthClient.updateUser` on
the FROM side | accepted; the gate prints the member's declared type at
both revisions |
| R3 | same marker, an arrow line | accepted |
| R4 | an export operand | refused by name |
| R5 | the whole-package operand | refused by name |
| R6 | a member the diff did not retype, `AuthClient.signOut` | refused,
predicate 1: the same type at both revisions |
| R7 | `type-surface-only`, bare | still refused by predicate 4 |

</details>

<details>
<summary>The compiler delivers the break (D10's channel
argument)</summary>

TypeScript 6.0.3 on the worked example's shape. A caller that reads the
result gets `TS2339` (the property does not exist on type void). A host
that passes its own implementation returning a Promise of AuthUser gets
`TS2322` (not assignable to a Promise of void).

</details>

## Acceptance notes

- **Done-when, first bullet.** The ADR names the eighth category with
its three predicates, and every enumeration of the vocabulary carries
it: the marker block and the two prose lists beside it. The status line
carries the amendment entry. Every occurrence of the seventh category's
name was read to find a list that omits the eighth; there is none. The
ADR counts categories by ordinal only (fifth, sixth, seventh, now
eighth), so no count word needed changing.
- **"The two land in either order" does not hold.** This branch alone
fails the vocabulary pin, and the gate half alone fails it in the other
direction. The two agree and are green together, in one merged tree
only.
- **One sentence on the parent card is narrower than it reads.** It says
the two catch-all categories are refused for a body that carries a FROM
→ TO. Measured, that depends on how the pair is spelled: the detector
reads a labelled arrow line and refuses, and it reads neither the
two-line pair PR objectstack-ai#37433 carries nor an arrowless line, so both
categories are admitted there. The ADR records the measured outcomes.
Across the 114 pending changesets, two carry a two-line pair the
detector does not read, and both describe behaviour in prose and
prescribe no rewrite. Noted, not filed.
- **PR objectstack-ai#37433 needs one edit beyond its marker.** Under the new category
its two-line pair is refused by predicate 3 (R1), and one FROM … TO …
line is accepted (R2). The ADR's worked-example paragraph says so; the
edit itself belongs to that PR.
- **The gate half is no longer carried unchanged.** The L2 reworks
changed it on this branch (blob `e56281db17` before, `bc082d7904` at
this head). Its header now follows the ADR's measured table on the two
catch-all categories: refused on a labelled arrow line the detector
reads; admitted on the two-line pair, an arrowless line, and an arrow
line under no migration label (the ADR's row names the first two). It
also corrects the old reason for the unresolved-name refusal: "two
unresolved names print alike" is measured false on TypeScript 6.0.3; the
true reason is that a name is only its spelling, so one spelling can be
two types at two revisions.
- **Ablations of the gate half** were run by its dev on its branch
(report 7241851254 on objectstack-ai#37447): each new refusal reds its own case when
removed. The rework's ablations were run on this branch (see Tests).
- **The private-package refusal names a retyping.** Under this category
it reads "no published entry to retype a member on" (L2 delta N7, L1
item 2); D9's own sentence and its pin REX-R9 are unchanged.
- **Landing pointer for PR objectstack-ai#37433.** Under this category objectstack-ai#37433's
two-line `FROM:`/`TO:` pair is refused by predicate 3 (R1); it lands
only with one `FROM … TO …` line naming `AuthClient.updateUser` before
TO (R2). The seat posts that pointer on objectstack-ai#37433 when this PR lands; the
edit belongs to that PR.

## Verification

Local, head `1f7fcfd66c` (merge base `eef1cbfe4a`, 0 behind main at the
run): the 44 commands of `dispatch-gates --commands` for the two-file
diff, under the shared verify lock (`VERDICT command-exit 0` in two
holds, 976 s and 485 s), each exit captured before any pipe.

- 44 of 44 exit 0, among them `check-adr-0087-registration --base
origin/main`, its `--self-test` (960 assertions), `pnpm
check:changeset-gate-self-tests` (167 + 960 + 456) and `pnpm
check:pm-dispatch-gates` (fast tier, 2385 cases).
- Reconciliation: `dispatch-gates --ran: 44 derived famil(ies) accounted
for - 44 run, 0 NOT-MEASURED`.
- `overlap-check` before the push: `VERDICT clean exit 0`, against
origin/main and 0 PR heads.

NOT MEASURED locally, CI-owned: the slow tier of the dispatch-gates
self-test, the type-check lanes, the governed-merges audit over workflow
variables. No changeset: both files ship in no package.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5oPfjnm2yWHEwkiYrn)_

<!-- signed: repo:objectstack#5 · os-project-manager ·
session_01FEkQ5oPfjnm2yWHEwkiYrn -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ching better-auth's receipt (objectstack-ai#38431)

<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoAoNwrZVJoUEFfvMURpRPKJ)_

Fixes objectstack-ai#36987
Supersedes objectstack-ai#37433

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill or doc page reads AuthClient.updateUser's
result

> **BREAKING** (published typing, shipped as `patch`):
`AuthClient.updateUser` in `@object-ui/auth` now resolves a promise of
`void` instead of a promise of `AuthUser`. Callers that read the result,
and hosts that implement `AuthClient` and pass it as
`AuthProviderOptions.client` with an `updateUser` that returns a user,
no longer type-check; read the session instead / return nothing. Runtime
behaviour that ever worked is unchanged (the server always answered `{
status: true }`).

## 维护者速读

- 用户无感:只改了认证包对外声明的返回类型,界面和资料保存的表现都不变。
- 为什么做:认证包对外说"改资料后会交回用户",实际服务器只回一个"成功"回执,对外的说明和实际对不上。
- 出错会怎样:只影响直接调用这个接口的外部代码,它们改读会话即可;改动可直接撤回。
- 要你做什么:在席位审核通过后批准合并(申报为收窄,需你批准)。

## What changes

This PR carries seat 5's draft objectstack-ai#37433 (4 commits, cherry-picked in order
onto `origin/main` f42bcc1, no conflict) and finishes it on the ruling
recorded on objectstack-ai#37433 (maintainer ruling 7183687803, 「新增第八类」), now that
ADR-0087's eighth category `runtime-member-retyped` has landed (objectstack-ai#38365,
f42bcc1).

Arm (a): the declaration now says what the call returns.
`AuthClient.updateUser` in `@object-ui/auth` was declared as a `Promise`
of `AuthUser`. It is now a `Promise` of `void`, and
`createAuthClient().updateUser` resolves with nothing instead of handing
on better-auth's answer.

- FROM `(data: Partial of AuthUser) => Promise of AuthUser` TO `(data:
Partial of AuthUser) => Promise of void`.
- Premise (measured on objectstack-ai#37433's base da7c559, re-read on f42bcc1):
better-auth's `dist/api/routes/update-user.mjs` ends `/update-user` with
`ctx.json({ status: true })`. `plugin-auth` passes the route through
unchanged (`auth-route-ledger.ts`, disposition `sdk`). The client cast
that receipt to `AuthUser` and returned it.
- Why (a) and not (b), where (b) means returning a real user with one
more session read:
- Census of `updateUser` readers (see Verification; re-run on this
head): the only in-repo caller of the client method is
`AuthProvider.updateUser`, which awaits the call and ignores the result.
`AuthContext.updateUser` and `useAuth().updateUser` already resolve with
nothing. `ProfilePage` calls `useAuth().updateUser` and never reads a
result. No reader needs the user.
- With (b), every profile write would cost one more round trip to fetch
a user that nobody reads. `updateUser` would also be the only write on
`AuthClient` that returns the entity; `changePassword`,
`setInitialPassword`, `verifyTotp` and the other writes all resolve with
nothing.
- `@objectstack/client` already types the same route as a status receipt
(`AuthStatusReceipt`). (a) brings the two published clients into
agreement about what the server answers.
- A refusal still rejects, as before. The `no data` guard stays, with a
one-line comment on why (N2).
- Changeset `.changeset/36987-auth-updateuser-returns-void.md`:
`@object-ui/auth` patch, `fix(auth)!:`, `Clause-②: no (narrowing)`,
`Metadata-protocol: none`, a `**BREAKING**` banner, the migration lines
for result readers and for host `AuthClient` implementations (S1), and
exactly one ADR-0087 marker, `not-required (runtime-member-retyped
@object-ui/auth#AuthClient.updateUser)`. Its FROM and TO are written on
ONE line, which the category's from-operands-named predicate reads. The
member is not rewritten as a method signature (ruling 7183687803).
- N1: the client doubles in `AuthProvider.test.tsx` and
`LoginForm.test.tsx` now resolve `updateUser` with nothing, as the
server does, instead of a user.

Read first (by risk):
1. `ui/packages/auth/src/types.ts`, the `AuthClient.updateUser`
declaration: the published typing that narrows.
2. `ui/packages/auth/src/createAuthClient.ts`, the `updateUser` hunk:
the runtime change (returns nothing).
3. `.changeset/36987-auth-updateuser-returns-void.md`: the disposition
marker and the one-line FROM ... TO that external callers read.

## Tests

- New `ui/packages/auth/src/__tests__/updateUser-return-36987.test.ts`
has two pins. The type pin checks that `ReturnType` of
`AuthClient['updateUser']` and of `createAuthClient()`'s `updateUser`
both equal a `Promise` of `void` (held by `tsc -p tsconfig.test.json`,
the package's `type-check`). The runtime pin checks that `{ status: true
}` from the wire resolves to `undefined`.
- The existing `createAuthClient.test.ts` case used to stub
`/update-user` with a `{ user }` body the server never sends and assert
`result.name`. It now stubs the real receipt and asserts that the call
resolves with `undefined`.

<details><summary>Package tests, type-check and build
(830cdac)</summary>

- Closure build under the verify lock: `pnpm --workspace-concurrency=2
--filter '@object-ui/auth^...' build`, `VERDICT command-exit 0`.
- `pnpm --filter @object-ui/auth type-check && pnpm --filter
@object-ui/auth test && pnpm --filter @object-ui/auth build`, `VERDICT
command-exit 0`. Tests: `Test Files 52 passed (52)`, `Tests 557 passed
(557)`.

</details>

<details><summary>Ablation: the old declaration plus the old cast
(one-off, no file kept)</summary>

- One ablation, three mutations through `scripts/ablation-replace.mjs`,
all landed by its own counts: `types.ts` back to the `AuthUser` promise
(anchor 1 to 0, blob 2d83741 to 5b271b75); in `createAuthClient.ts` the
`void` return annotation removed (anchor 1 to 0, blob e6af426 to
e9aafd14) and `return data as unknown as AuthUser;` put back (anchor 1
to 0, blob e9aafd14 to 0e7700bb).
- Type leg: `tsc -p tsconfig.test.json` exited 2, TS2344 on both type
pins (`updateUser-return-36987.test.ts` lines 22 and 24).
- Runtime leg: vitest on the pin and `createAuthClient.test.ts` went
red: `Tests 2 failed | 42 passed (44)`, `AssertionError: expected {
status: true } to be undefined`.
- Restore: `git checkout HEAD --` on both paths; `git diff HEAD` empty,
blobs equal HEAD (2d83741, e6af426).
- The first attempt was a no-op: the third mutation's replacement
contained its anchor (count 1 to 1). The tool refused it and restored;
the run was repeated with a different anchor. Both pins import from
source, so no `dist/` is on the path.

</details>

## Acceptance notes

- The ProfilePage test doubles added since objectstack-ai#37433's base
(`ProfilePage.passwordRefusal-37973.test.tsx` among them) stub
`useAuth().updateUser` as resolving nothing, which is the context
surface that was already void. They neither read the client method's
result nor implement `AuthClient`. Noted, nothing owed.

## Verification

<details><summary>ADR-0087 disposition (830cdac)</summary>

- `node scripts/check-adr-0087-registration.mjs --base origin/main`:
exit 0, `verified: @object-ui/auth#AuthClient.updateUser (updateUser:
(data: Partial of AuthUser) => Promise of AuthUser -> updateUser: (data:
Partial of AuthUser) => Promise of void,
ui/packages/auth/src/types.ts)`, tags
`[BREAKING+bang+clause-②-narrowing]`.
- Two earlier attempts on the way were refused on predicate 3
(from-operands-named): a FROM side spelled as a whole signature in one
code span, then a second code span between FROM and TO. The FROM side
now names `AuthClient.updateUser` alone and the signatures sit outside
it.

</details>

<details><summary>updateUser census on this head (ui/, apps/, examples/,
skills/, content/)</summary>

- 48 hits by `git grep -n updateUser` (CHANGELOGs excluded). Against
objectstack-ai#37433's base da7c559 the only new file is
`ProfilePage.passwordRefusal-37973.test.tsx`, a `useAuth()` double whose
`updateUser` resolves nothing (the context surface, already void).
- Client-method callers: `ui/packages/auth/src/AuthProvider.tsx:549`
only, awaiting and discarding. No code outside `ui/packages/auth`
implements `AuthClient.updateUser`.
`content/docs/frontend/data-source.mdx:121,150` is an unrelated
user-defined data-source method. Nothing under `examples/` or `skills/`.

</details>

<details><summary>Derived gate families (830cdac)</summary>

- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 39 families; each was run and its
exit recorded.
- 38 exited 0 on the first pass, including `pnpm --dir ui exec vitest
run scripts/` (`Test Files 172 passed | 2 skipped (174)`, `Tests 5159
passed | 2 skipped (5161)`).
- `pnpm check:type-check-debt` exited 3 (PREREQUISITE NOT MET: its
closure build lost the lock turn to the dogfood run). Rerun under the
lock, appended: exit 0, `0 ledger entr(ies) re-measured ... none above
its recorded number`.
- `dispatch-gates --ran`: `39 derived famil(ies) accounted for — 38 run,
1 NOT-MEASURED` (the first-pass exit 3; the appended rerun is green).
- Also run: `pnpm check:changeset-fixed` (roster under `.changeset/`)
exit 0; `dispatch-gates --tier`: no path-derived mandate.
- `overlap-check --branch=HEAD --exclude-pr=37433` before the first
push: `VERDICT clean exit 0` (objectstack-ai#37433 is the superseded draft and
overlaps by construction).

</details>

<details><summary>Dogfood battery (830cdac)</summary>

- Owed: the title carries `!` and the declaration a `(narrowing)` arm.
Closure `pnpm --filter '@objectstack/dogfood^...' build` then `pnpm
--filter @objectstack/dogfood test`, both under the lock, no shard and
no path.
- `VERDICT command-exit 0`, `Test Files 495 passed | 3 skipped (498)`,
`Tests 4183 passed | 68 skipped (4251)`. No failures.

</details>

Two-minute check: `pnpm --filter @object-ui/auth exec vitest run --root
../.. packages/auth/src/__tests__/updateUser-return-36987.test.ts`
should show 2 passing tests, and `node
scripts/check-adr-0087-registration.mjs --base origin/main` should print
a `verified:` line for `@object-ui/auth#AuthClient.updateUser`.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM)_

<!-- signed: repo:objectstack#3 · os-tesla ·
session_01L9qibyUSf2nKJWW6qBemSU -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@object-ui/auth: createAuthClient().updateUser declares Promise<AuthUser> but returns better-auth's { status: true }

2 participants