Skip to content

fix(plugin-auth,app-shell)!: while mail is live, accepting an invitation needs a verified address - #34666

Merged
os-zhuang merged 5 commits into
mainfrom
claude/issue-34272-accept-invitation-verified
Nov 17, 2026
Merged

os-zhuang merged 5 commits into
mainfrom
claude/issue-34272-accept-invitation-verified

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34272

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no page under skills/ teaches accepting an invitation or /organization/accept-invitation; the rule is stated in the changeset and the self-hosting docs.

Governed / Tier H. A narrowing of an auth route (BREAKING). This PR stays draft until GOVERNED_APPROVERS approve; the seat lands it through Tier H. The area thread does not flip it ready.

维护者速读

  • 改了什么:邮件服务可投递(isConfigured() === true)时,POST /organization/accept-invitation 拒收邮箱未验证的会话:403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION(better-auth 自己的码与句子),什么都不写,邀请仍是 pending。控制台接受页把这个拒绝转到 /verify-email-prompt(发验证邮件),验证链接带回接受页。
  • 为什么改:规则是邮件可投递时,接受邀请需要已验证的邮箱,因为未验证的地址不能证明持有受邀邮箱。
  • 范围(席位收窄后):只动 accept;get-invitation、list-user-invitations、reject-invitation 不变(不写成员);一步接受门不变(凭证模式先验证再接受,会话模式本来就答 verify_email);没有可投递邮件的部署完全不变(那里什么都无法验证地址,拒收等于死路,也是 requireEmailVerificationOnInvitation: false 的原因,该声明保留)。
  • 风险与回滚:BREAKING 只落在「邮件可投递 + 未验证地址的人去接受」这一种人身上,修法是先验证邮箱。回滚即还原本 PR:接线只有 auth-manager-organization-plugin.ts 里一个 beforeAcceptInvitation 钩子 + 两处宿主成员透传。
  • 先看:packages/plugins/plugin-auth/src/invitation-accept-verified-email.ts(规则与为何选 vendor 钩子);auth-manager-organization-plugin.ts 的 beforeAcceptInvitation;ui/.../AcceptInvitationPage.tsx 的 handleAccept。
  • 两分钟验证:pnpm --filter @objectstack/plugin-auth exec vitest run src/invitation-accept-verified-email.test.ts,预期 14 个用例全绿。
  • 需要你做的:作为受管(Tier H)收窄,按 GOVERNED_APPROVERS 批准;其余席位落地。

What changes

Rule. While the deployment's mail transport is live, an invitation is accepted only by a session whose address is verified. Without a live transport nothing changes.

  • packages/plugins/plugin-auth/src/invitation-accept-verified-email.ts (new): refuseUnverifiedAcceptWhileMailIsLive(user, { isEmailDeliveryLive, verificationRequired? }), a no-op for a verified user (it does not even ask whether mail is live) and while mail is not live; otherwise it throws APIError.from('FORBIDDEN', …) with the vendor's own $ERROR_CODES entry (a local fallback is pinned equal to the vendor's). The verified test is the vendor's own (!user.emailVerified).
  • auth-manager-organization-plugin.ts: the rule is asked from better-auth's organizationHooks.beforeAcceptInvitation, which the vendor fires inside the accept endpoint after its not-found / expiry / status, recipient and membership-limit checks and before the invitation row or the membership is written, handing it the session.user its own session middleware resolved (cookie and bearer alike). The requireEmailVerificationOnInvitation: false comment now says why it stays false and where the live-mail rule lives.
  • auth-manager.ts, auth-manager-plugin-list.ts: isEmailDeliveryLive passed through the two typed hosts to the organization plugin.
  • ui/packages/app-shell/.../AcceptInvitationPage.tsx: on that code, navigate to /verify-email-prompt?email=<account email>&redirect=<this page> instead of a toast. orgErrorMessage.ts exports the code and isAcceptNeedsVerifiedEmail(err) (read by code only).
  • content/docs/deployment/self-hosting.mdx: one paragraph under the invite_only sign-up paragraph.
  • packages/runtime/src/dispatcher-error-vocabulary.ts: one foreign-vocabulary row classifying the vendor code, beside the sibling row for EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION (check:dispatcher-error-vocabulary).
  • .changeset/34272-accept-invitation-verified-email.md: @objectstack/plugin-auth, @object-ui/app-shell and @objectstack/runtime patch (Metadata-protocol: none takes patch; the BREAKING banner stays); BREAKING, Who moves, adr-0087: not-required (no-migration-prescription).

No spec, schema, stored row, route or exported signature of a published entry changes. No new error code is minted (the vendor's), so nothing reaches the error-code ledger.

Why the vendor hook and not the global before-hook

The seat's correction named "a plugin-auth before-hook". beforeAcceptInvitation is that, at the vendor's own seam: the global hooks.before runs before bearer() turns a bearer credential into a session (so it would need a second session read and a user read), and it would answer ahead of the vendor's recipient check, telling a non-recipient about someone else's address. The vendor hook gets the exact user object the vendor's own verification check reads, after the recipient check, before any write.

Why not turn the vendor option on where mail is live

requireEmailVerificationOnInvitation governs accept, reject and get-invitation together (crud-invites.mjs:270/382/505, better-auth 1.7.12) and is read from options at boot. The narrowing the seat ruled is accept only, asked per request.

Tests

src/invitation-accept-verified-email.test.ts — real AuthManager + real better-auth pipeline over the memory engine (the list-user-invitations-verification.test.ts shape); the email service's isConfigured() is swapped between requests; every fixture account is asserted unverified.

  1. the local fallback equals the vendor's $ERROR_CODES entry;
  2. PREMISE: with the option false and no live mail, the vendor lets an unverified invitee accept;
  3. mail live: unverified invitee → 403 with the vendor's code, no membership, invitation still pending;
  4. mail live: a bearer-token session is refused alike;
  5. mail live: once the address is verified, the same invitation is accepted;
  6. ORDER PIN: a non-recipient still gets YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION;
  7. ONLY ACCEPT: the same unverified invitee still gets, lists and rejects (200);
  8. mail live: the one-step door still accepts with the mail's proof (it verifies first);
  9. no email service: unverified invitee accepts (unchanged);
  10. log transport (isConfigured() false): unverified invitee accepts (unchanged);
  11. read per request: live → 403, log → 200, live again → 403;
    12–14. the function: verified passes without asking; unverified passes while not live; unverified / unknown user refused while live, with the entry the caller hands in.

ui/.../__tests__/acceptInvitationVerifiedEmail-34272.test.tsx — the real createAuthClient over a stubbed fetch answering the server's 403 body: the page navigates to /verify-email-prompt with the account's email and redirect=/accept-invitation/inv-1, no toast, no org switch; CONTROL: YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION still toasts and does not navigate there.

Ablation. The hook body made a no-op on disk: tests 3, 4, 5 and 11 red (4 of 14), then restored. The page's routing branch disabled: the UI routing test red (1 of 2), then restored.

Verification

Final head 8e828209b5ce1d69a9c3513e319dce15eaa58101. Measured at b2d54a28 (final-head comment 6940567054); 8e828209 changes prose only (the changeset, the module's header comment and the self-hosting paragraph, after L1 6940626667), and the 41 derived gates over docs, changesets and ADR text plus plugin-auth typecheck and the module's 14 pins re-ran green on it.

  • Derived gates. node scripts/pm/dispatch-gates.mjs --commands derived 111 families; all 111 ran, each with its exit code captured, and all ended exit 0. --ran reconciliation: 111 accounted, 111 run, 0 NOT-MEASURED. Four first-run reds were fixed or were prerequisites: check:adr-0087-registration (the changeset's FROM → TO label read as a migration prescription; reworded to prose), check:dispatcher-error-vocabulary (the vendor code needed its classification row, added), and spec check:docs / spec check:skill-examples (stale packages/spec build; green after pnpm --filter @objectstack/spec build).
  • Package suites. pnpm --filter @objectstack/plugin-auth test exit 0; pnpm --filter @objectstack/plugin-auth typecheck exit 0; ui: vitest run packages/app-shell/src/console/organizations/ exit 0; pnpm --filter @object-ui/app-shell type-check exit 0 (after building its workspace dependencies, whose stale dist predated feat(auth): an invitation is accepted in one step with the proof its mail carries #34333).
  • Ablation. As above: 4 of 14 server pins and 1 of 2 UI pins red with the change removed, restored after.
  • Dogfood battery (narrowing): pnpm --filter @objectstack/dogfood test under scripts/pm/os-verify-lock.sh, no OS_TEST_SHARD, at b2d54a28 (the code at 8e828209 is the same; only prose moved): Test Files 478 passed | 3 skipped (481), Tests 4055 passed | 68 skipped (4123), VERDICT command-exit 0.
  • merge-tree at the head: clean against origin/main fecd2e95d4, which now holds fix(auth): a TOTP code is accepted once #34617 (the other plugin-auth change in flight at opening).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (No spec change.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English. (The 维护者速读 section is the maintainer's requested summary.)
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmSYe73LCZ6WxGFvcko

…ion needs a verified address

While the email service is live, POST /organization/accept-invitation
refuses a session whose address is unverified with better-auth's own
403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION
and writes nothing. The check runs on the vendor's beforeAcceptInvitation
hook, after its recipient and expiry checks, on the session user the
vendor resolved; it asks isEmailDeliveryLive per request. Without live
mail nothing changes. get, list and reject are unchanged; the one-step
door verifies before it accepts. The Console's accept page sends that
refusal to /verify-email-prompt for the account's address.

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no page under skills/ teaches accepting an invitation; the rule is stated in the changeset and the self-hosting docs.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSYe73LCZ6WxGFvcko
…ispatcher vocabulary

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSYe73LCZ6WxGFvcko
@objectstack-fleet objectstack-fleet Bot added the domain:server Domain lane — seat card indexed by label:pm:seat label Nov 17, 2026
@github-actions github-actions Bot added size/l 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 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

8 anchor(s) derived from 2 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
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 43 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json fecd2e95d466b1ccc88a3ce59dc7a3c92416159e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 63e32c7e24bd6ac45409395555b48487064f06eb — the merge of head 8e828209b5ce1d69a9c3513e319dce15eaa58101 into base fecd2e95d466b1ccc88a3ce59dc7a3c92416159e, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 63e32c7e24bd6ac45409395555b48487064f06eb && git checkout 63e32c7e24bd6ac45409395555b48487064f06eb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin fecd2e95d466b1ccc88a3ce59dc7a3c92416159e 8e828209b5ce1d69a9c3513e319dce15eaa58101 && git checkout -B drift-repro fecd2e95d466b1ccc88a3ce59dc7a3c92416159e && git merge --no-ff 8e828209b5ce1d69a9c3513e319dce15eaa58101

node scripts/docs-audit/affected-docs.mjs --json fecd2e95d466b1ccc88a3ce59dc7a3c92416159e

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmSYe73LCZ6WxGFvcko

Final head for review · 2026-11-17T06:24Z

Head-sha: b2d54a28284f43bba26f0c77f6f9fc72ea6ef2ba

  • CI on this head: every check suite completed with no failure (Test Core 8/8, Test UI 16/16, Type Check, Lint & Repo Gates, Check Changeset, Build Docs, Live E2E UI all success).
  • dispatch-gates --ran: 111 derived, 111 run, 0 NOT-MEASURED, every one exit 0 (/mnt/project-files/objectstack-seat2/34272-gates-ran.txt in the project). The first run read 4 reds: two fixed in the diff (check:adr-0087-registration, check:dispatcher-error-vocabulary), two prerequisites (stale packages/spec build) green after pnpm --filter @objectstack/spec build; @object-ui/app-shell type-check green after building its workspace deps.
  • dogfood_battery: pnpm --filter @objectstack/dogfood test under scripts/pm/os-verify-lock.sh, no OS_TEST_SHARD, on this exact head: Test Files 478 passed | 3 skipped (481), Tests 4055 passed | 68 skipped (4123), VERDICT command-exit 0.
  • Package suites: @objectstack/plugin-auth test + typecheck exit 0; ui packages/app-shell/src/console/organizations/ exit 0.
  • Ablation: hook made a no-op → 4 of 14 server pins red; accept-page routing disabled → 1 of 2 UI pins red; both restored.
  • git merge-tree at this head: clean against origin/main fecd2e95d4 (which now holds fix(auth): a TOTP code is accepted once #34617).
  • Clause-②: no (narrowing) · Metadata-protocol: none · Skills-docs: none · changeset @objectstack/plugin-auth, @object-ui/app-shell, @objectstack/runtime patch (BREAKING banner, adr-0087: not-required (no-migration-prescription)).
  • Tier H: a narrowing of an auth route (the seat's premise correction). check-governed-merges reads no governed path, but the seat routes it through Tier H; this PR stays draft and the area thread does not mark it ready.

Changes since the opening head (3bf177b): the changeset grade minor → patch (Check Changeset: Metadata-protocol: none takes patch; the BREAKING banner and ADR-0087 disposition stay), and the tracker id removed from the vocabulary row's prose string (check:doc-authoring).

L1 is requested at this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmTPcB6fZEwhd2hNQwC

席位核对

L1 verdict: REWORK · PR #34666 · card #34272 (Fixes) · first review · L1-c2 of seat repo:objectstack#2 · read 2026-11-17T06:28Z

Head-sha: b2d54a28284f43bba26f0c77f6f9fc72ea6ef2ba (the head of final-head comment 6940567054)

Read from GitHub and the diff at this head (merge base 31096af83d), not from the report. 11 files, +742/−6.

Checked and holding

  • Shape. The PR is a draft against main and opens with Fixes #34272; the seat-narrowed card (accept only) is done in full. The changeset is patch on the three touched published packages and carries the Clause-②: no (narrowing), Metadata-protocol: none and Skills-docs: lines. git grep of skills/ finds no page on accepting an invitation, so Skills-docs: none stands. The adr-0087: not-required disposition fits, since no key, value or stored row moves.
  • Seam. beforeAcceptInvitation receives the vendor-resolved user. The rule is a no-op for a verified user and while isEmailDeliveryLive() is false, which is read per request (test 11). It throws APIError.from('FORBIDDEN', $ERROR_CODES entry ?? local fallback), and the fallback is pinned equal to the vendor's (test 1). isEmailDeliveryLive is threaded through both typed hosts. requireEmailVerificationOnInvitation stays false, and its comment now says why.
  • Pins. The 403 cases assert status and the vendor code (tests 3 and 4), and assert that nothing is written (the membership is absent and the invitation still pending). Order is pinned: a non-recipient still gets YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION (test 6). Only accept moves: get, list and reject stay 200 (test 7). The one-step door is unchanged (test 8). Without a live transport nothing changes (tests 9 and 10). The UI pin asserts navigation to /verify-email-prompt with email and redirect=/accept-invitation/inv-1 and no toast, and its CONTROL keeps the toast. The ablations (server 4/14, UI 1/2) are lane-reported, and I did not re-run them.
  • Vocabulary row. dispatcher-error-vocabulary.ts classifies the vendor code as foreign-vocabulary, beside its EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION sibling.
  • Gates. 65 check-runs on this head: 53 success, 11 skipped, 0 failed. Check Changeset is re-running after the 06:25Z body edit (its earlier run success). Lint & Repo Gates, TypeScript Type Check, Test UI (16/16) and Type Check UI are all success. Lane readings: 111/111 derived gates exit 0, and the ! battery VERDICT 0 (4055 passed).

R1 (REWORK) · public text says more than the rule. Three places go past the hardening rule into what an unverified account could do on a mail-live deployment:

  • the second sentence of the changeset's **BREAKING** paragraph;
  • the second sentence of the first paragraph under ## The rule in invitation-accept-verified-email.ts;
  • the PR body's 速读「为什么改」line.

.claude/skills/pm-dispatch/references/security-findings.md §2 and §6 keep a fix PR's changeset, code comments and body to the rule. Restate each as the rule only: while mail is live, accepting needs a verified address, because an unverified address is not proof of the mailbox, as the self-hosting paragraph already words it. The changeset is release text, so this edit moves the head.

R2 (REWORK) · "the invitation mail's own link is not affected" holds only for a signed-out visitor. The changeset's Who moves ("An invitee who opens the invitation mail's own link is not affected: that link verifies the address as it accepts") and the self-hosting paragraph ("Opening the invitation's link from the invitation mail itself needs no separate step") say this. AcceptInvitationPage offers the one-step form, which redeems the proof, only to a visitor who is not signed in (!isAuthenticated && proof, and the comment at the proof state). A visitor already signed in to an unverified account who opens the same mail link reads the invitation and accepts through handleAccept, which calls the vendor accept route. That route now answers this PR's 403, and the page sends the visitor to /verify-email-prompt. That is the exact population the BREAKING note names. Either:

  • narrow both sentences to the signed-out visitor and say that a signed-in unverified session opening the link is sent to verify; or
  • have the page redeem the proof for a signed-in session too, and pin it.

The first is prose only. The second is a new behaviour, which needs the seat's word before it goes in this PR.

L2 owed: yes. The (narrowing) declaration owes CONTRACT_REVIEW_TIER over the diff outside the prose face, through this account's review seat, on the head after R1 and R2.

Landing tier: check-governed-merges.mjs --pr 34666 reports NOT governed, +742/−6 = 748 lines ≤ 3000. The PR declares a narrowing, so under the seat's 04:14Z order it lands Tier H via the seat. It stays draft, as the body says.

…ence to a signed-out visitor

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSYe73LCZ6WxGFvcko
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmSYe73LCZ6WxGFvcko

Final head for review · 2026-11-17T07:14Z

Head-sha: 8e828209b5ce1d69a9c3513e319dce15eaa58101

Delta from b2d54a28 (L1 6940626667, REWORK): prose only, three files.

  • R1: the changeset's BREAKING paragraph, the module header's ## The rule and the body's 速读 line now state the rule alone: while mail is live, accepting an invitation needs a verified address, because an unverified address is not proof of the invited mailbox.

  • R2: the changeset's Who moves and the self-hosting paragraph now say the mail link needs no separate step for a visitor who is not signed in (the one-step form), and that a visitor already signed in to an unverified account who opens that link is sent to verify. Option 1 of R2 (prose); no behaviour moved.

  • CI on this head: every check suite completed with no failure.

  • dogfood_battery on this exact head: pnpm --filter @objectstack/dogfood test under scripts/pm/os-verify-lock.sh, no OS_TEST_SHARD: Test Files 478 passed | 3 skipped (481), Tests 4055 passed | 68 skipped (4123), VERDICT command-exit 0.

  • Gates on this head: the 41 derived families over docs, changesets and ADR text, plugin-auth typecheck, and the module's 14 pins, all exit 0. The full 111-family run is at b2d54a28 (6940567054); no code moved since.

  • git merge-tree at this head: clean against origin/main a34eb0716a.

  • Clause-②: no (narrowing) · Metadata-protocol: none · Skills-docs: none. Tier H via the seat; stays draft.

L1 delta and L2 are requested at this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 8e82820 · 2026-11-17T07:15Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmTPcB6fZEwhd2hNQwC

席位核对

L1 verdict: ACCEPT (delta) · PR #34666 · card #34272 (Fixes) · delta over L1-c2 REWORK 6940626667 (at b2d54a28) · L1-c2 of seat repo:objectstack#2 · read 2026-11-17T07:15Z

Head-sha: 8e828209b5ce1d69a9c3513e319dce15eaa58101 (the head of final-head comment 6941422848)

Read from GitHub and the commit at this head, not from the report. The first-parent delta is one fast-forward commit, 8e828209: 3 files, +9/−10, all prose. The changeset, self-hosting.mdx and one module docblock change. No code, test or pin moves.

R1: closed.

  • The changeset's **BREAKING** paragraph now carries the rule only: "while mail is live, accepting an invitation needs a verified address, because an unverified address is not proof of the invited mailbox".
  • The ## The rule paragraph of invitation-accept-verified-email.ts says the same.
  • The body's 速读「为什么改」line states the rule.
  • git grep over the PR's files at this head and a read of the body find nothing past the rule.

R2: closed.

  • The changeset's Who moves now limits "not affected" to a visitor who is not signed in, whom the page offers the one-step form.
  • It also says that a signed-in visitor with an unverified address who opens the same link "accepts through /organization/accept-invitation, so is refused as above and sent to verify".
  • self-hosting.mdx says the same. Both match AcceptInvitationPage: the one-step form only for !isAuthenticated && proof, handleAccept otherwise, and the new branch to /verify-email-prompt.

Gates: 65 check-runs on this head, all completed: 53 success, 11 skipped, 1 cancelled. The cancelled one is the first PR-body guards run (06:35:19Z), which the run after the body edit superseded; that run (133867161003) is success. Both Check Changeset runs are success. The lane reports at this head: the ! battery 4055 passed, the 14 server pins and the affected gates green.

L2 owed: yes. The (narrowing) declaration owes CONTRACT_REVIEW_TIER on this head (the lane reports it sent), through this account's review seat.

Landing tier: NOT governed, +741/−6 = 747 lines ≤ 3000. A narrowing is declared, so it lands Tier H via the seat (04:14Z order). It stays draft.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8e828209b5ce1d69a9c3513e319dce15eaa58101
Local-runs: none
Scope: packages/plugins/plugin-auth/src/invitation-accept-verified-email.ts, packages/plugins/plugin-auth/src/invitation-accept-verified-email.test.ts, packages/plugins/plugin-auth/src/auth-manager-organization-plugin.ts, packages/plugins/plugin-auth/src/auth-manager-plugin-list.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/runtime/src/dispatcher-error-vocabulary.ts, ui/packages/app-shell/src/console/organizations/manage/AcceptInvitationPage.tsx, ui/packages/app-shell/src/console/organizations/orgErrorMessage.ts, ui/packages/app-shell/src/console/organizations/tests/acceptInvitationVerifiedEmail-34272.test.tsx + read, not reviewed: packages/plugins/plugin-auth/src/invitation-mailbox-proof.ts, packages/plugins/plugin-auth/src/visitor-verification-resend.ts, packages/plugins/plugin-auth/src/auth-manager-before-hook.ts, packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts, packages/plugins/plugin-auth/src/adopt-membership.ts, packages/plugins/plugin-auth/src/auth-route-ledger.ts, packages/spec/src/contracts/email-service.ts, packages/platform-objects/src/identity/sys-invitation.object.ts, ui/packages/app-shell/src/console/auth/invitationSignUpJoin.ts, ui/apps/console/src/App.tsx, ui/apps/console/src/pages/auth/VerifyEmailPromptPage.tsx, ui/apps/console/src/pages/auth/handoffRedirect.ts, docs/adr/0138-guest-model-anonymous-principal-doors-grants-and-organization.md, AGENTS.md; prose faces read to judge the narrowing, not reviewed: .changeset/34272-accept-invitation-verified-email.md, content/docs/deployment/self-hosting.mdx

Inputs read: card #34272 body and its three comments (triage regrade, premise correction 6937749254, claim), PR #34666 body and file list, the net diff against main at this head, and the 65 check-runs on this head. Every check-run that ran concluded success (Test Core and its 8 shards, Test UI and its shards, Type Check UI, TypeScript Type Check, Lint and Repo Gates, Check Changeset, Dogfood Regression Gate, Governed Surface Queue Guard, Build Docs among them); the rest are skipped opt-in or matrix placeholders, and one PR-body guard run was cancelled and superseded by a successful run of the same guard. The vendor package is not installed in this tree, so the vendor's in-endpoint order is judged from the PR's own pins, which Test Core ran green, and from the platform files on main that cite the same vendor file, not from the vendor source.

① Derived judgments

  • Accept-set, the one door that moves. POST /api/v1/auth/organization/accept-invitation: a session that is the invitation's recipient, whose address is not verified, on a deployment whose email service answers isConfigured() === true, was accepted (200, membership written) and is now refused 403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION, with nothing written and the invitation still pending. Cookie and bearer sessions alike. Right: it is the card's rule as the seat's premise correction narrowed it, and pins 3, 4, 5 and 11 hold it.
  • Nobody else moves at that door. A verified session, a non-recipient (still the vendor's recipient refusal, pin 6), an unknown or expired invitation, and every caller on a deployment whose mail is not live answer as before. A cloud-managed environment still answers its 409 first, from the global before-hook. Right.
  • Callers of the narrowed door, by name, since the refusal reaches each of them: (a) the Console accept page, routed to verification by this PR; (b) the register-from-invitation join (invitationSignUpJoin.ts), whose automatic accept for a just-created unverified session is now refused where mail is live, answers refused and falls through to the accept page, which then routes as (a); (c) the sys_invitation.accept_invitation action of the invitations inbox, which targets the same route and now shows the refusal; (d) any API client. All four are refused by one rule at one seam; none is admitted by another route.
  • Other doors that can make the invitee a member, read for consistency. The one-step door (accept-invitation-one-step): proof mode marks the address verified, opens a new session and then accepts through the vendor route, so the new hook sees a verified user (pin 8); session mode already answers verify_email for an unverified session on every deployment. It is the only in-process caller of the vendor accept. add-member is an administrator's act on another person, not an acceptance, and is outside the rule. Reject, get and list write no membership and are unchanged (pin 7). I found no door that accepts an invitation for an unverified session while mail is live.
  • One asymmetry, existing on main and not introduced here: with no live mail, the vendor door accepts an unverified recipient while the one-step door's session mode answers verify_email. The PR's "unchanged" list is accurate about it; it is the declared no-mail posture, not a hidden inconsistency.
  • Liveness switch. isEmailDeliveryLive() is read on every request and never cached, so a transport swapped at runtime is honoured on the next request (pin 11). It answers true only for a wired service whose isConfigured() returns true; no service, the log transport, a service that does not implement the optional member, and a member that throws all read as not live, and acceptance stays open there. That is the same reading every other auth flow on main takes of this fact, and the changeset states the exact condition. Right.
  • Public surface. No route, schema, stored row or exported signature of a published entry changes. @object-ui/app-shell gains two internal exports in orgErrorMessage.ts (not on the package index). @objectstack/runtime gains one classification row in UNREGISTERED_CODE_SITES: declaration data for a repo gate, verdict foreign-vocabulary, beside the sibling vendor row; nothing the dispatcher runs changes and nothing is registered in the ledger. The status and code are the vendor's own for this refusal, leave on the vendor's wire as the vendor's flat body, and match how the sibling vendor codes are classified. Right, and the changeset declares it.
  • Console mapping. Only the exact code EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION, read by code alone, routes to /verify-email-prompt with the account's address and the router path as redirect; every other refusal of the door still takes the toast (control pin). No other door this page calls can answer that code while the vendor option stays false, so nothing else lands on the prompt. The prompt route is public and does not bounce a signed-in session, a signed-in resend for one's own address is served, and verificationCallbackURL returns a root-relative path to the accept page. Right.

② Semver level

Clause-②: no (narrowing)

  • patch on @objectstack/plugin-auth, @object-ui/app-shell and @objectstack/runtime, with the BREAKING banner kept. Right under AGENTS.md: Metadata-protocol: none takes patch, and a non-protocol breaking change ships patch with its banner and ADR-0087 disposition. Nothing a metadata author can write changes. Check Changeset is green on this head.
  • Both declaration lines are in the PR body and the changeset body, and agree.
  • adr-0087: not-required (no-migration-prescription) is honest. No stored state breaks on upgrade: a pending invitation held by an unverified account stays pending and is accepted by the same request once the address is verified; no key, value or row is rewritten. The one-line fix (verify, then accept) is in the body.

③ Boundary flags

  • Dev flag, "the vendor hook rather than the global before-hook the seat's correction named": answered. The vendor hook is a plugin-auth hook at the accept seam; it keeps the vendor's recipient and expiry refusals first, so the refusal speaks only to the invitee about their own address, and it reads the user the endpoint itself resolved. Pin 6 holds the order. Accepted.
  • Dev flag, "why not turn the vendor option on where mail is live": answered by the premise correction on the card. The option governs reading and declining too and is read at boot; the ruled narrowing is accept only, per request. Accepted.
  • Premise correction 6937749254 (accept door only; only where mail is live; get, reject and list unchanged; still BREAKING through the governed tier): the diff implements each clause and widens none.
  • open_questions: none raised by the PR.
  • File surface: the claim named auth-manager-before-hook.ts; the diff instead touches the two typed hosts (auth-manager.ts, auth-manager-plugin-list.ts) to pass isEmailDeliveryLive through, and packages/runtime/src/dispatcher-error-vocabulary.ts for the gate's row. Each is a one-line pass-through or a declaration row the gate demands, and the PR body explains them. Accepted.
  • SQL push-down: not applicable. The diff adds no query, no id materialisation and no in-app join; the hook reads one boolean off the user the vendor already resolved.

④ Design judgment

The narrowing makes a published rule real; it takes no declared capability away. On main, ADR-0138 as amended for #34257 states that an invitation link proves nothing about the invited mailbox and that an invitation-link sign-up still owes the verification mail, and the one-step door already refuses an unverified session. The vendor accept route was the one door where an account could join on an address it never proved. No spec key, config field or document on main promises that an unverified address may accept; the only statement was the code comment explaining why the vendor option is off where nothing can verify an address, and that reason is preserved exactly: where mail is not live, nothing changes.

isEmailDeliveryLive() is the right switch. The refusal is only fair where the person can act on it, and that fact is the transport's own deliverability answer, the same one sign-up, invite outcome and the public config already read. It follows the transport at runtime. The direction on an unknown answer is open, which matches the rule's own condition ("while mail is live") and avoids a dead end on a deployment that cannot mail; the changeset states the condition as the member answering true.

Tried to break it: the hook is the single key of its name in the options object; the one-step door's accept passes through it with a verified user; session reads are not cookie-cached, so a just-verified address is seen on the next request and a refusal cannot outlive the verification; the refusal precedes both writes; the recovery path (prompt screen, signed-in resend, callback to the accept page) is complete in the Console host.

No must-fix, no should-fix.

  • N1 (nit) — the invitations inbox action sys_invitation.accept_invitation calls the same door and neither routes the refusal to verification nor names the verified-address condition in its ai.description; the person there reads the vendor's sentence and reaches verification through the accept page or the invitation mail. Follow-up card, not this head.
  • N2 (nit) — the vendor's sentence says "accepting or rejecting"; on this platform declining needs no verification. The Console accept page reads the code, so only raw-message surfaces (N1, API clients) show it. Accepted deviation: the vendor's envelope was chosen on purpose.
  • N3 (nit) — the prompt screen's standing copy says a link was sent, while on this arrival the mail is sent when the person presses the button. The same holds for the sign-in arrival on main. Follow-up card.
  • N4 (nit) — the changeset's "Unchanged" parenthesis names two not-live shapes (no service, the log transport); a service that does not implement isConfigured is a third, covered by the stated condition but not listed. Prose face, optional.
  • N5 (nit) — @object-ui/app-shell's accept page now navigates to /verify-email-prompt, a route the Console host declares; a host embedding the page without that route owes it. Worth one clause in the changeset or a follow-up.

Implemented-by: claude/issue-34272-accept-invitation-verified
Reviewed-by: session_01ADHkmP44onN8RMzsPMqjRq

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA

Seat record · 2026-11-17T07:23Z · Head-sha: 8e82820

维护者速读

  • 改了什么:邮件服务可投递(isConfigured() === true)时,POST /organization/accept-invitation 拒收邮箱未验证的会话:403 EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION(better-auth 自己的码和句子),不写任何东西,邀请仍是 pending。控制台接受页把这个拒绝转到 /verify-email-prompt,验证链接带回接受页。
  • 为什么改:邮件可投递时,接受邀请需要已验证的邮箱,因为未验证的地址不能证明持有受邀邮箱(auth: the vendor accept-invitation route admits a session whose email is unverified; require a verified address there too (narrowing, after #34257) #34272,席位前提更正 6937749254 把范围收到只动 accept)。
  • 风险与回滚:收窄(Clause-②: no (narrowing)),只落在「邮件可投递 + 地址未验证的人去接受」这一种情况,解法是先验证邮箱;get-invitation、list-user-invitations、reject-invitation、一步接受门不变,没有可投递邮件的部署完全不变。回滚即撤回本 PR。
  • 先看:packages/plugins/plugin-auth/src/invitation-accept-verified-email.ts(规则和为什么选 vendor 钩子)、auth-manager-organization-plugin.ts 的 beforeAcceptInvitation、ui/.../AcceptInvitationPage.tsx 的 handleAccept。
  • 两分钟验证:pnpm --filter @objectstack/plugin-auth exec vitest run src/invitation-accept-verified-email.test.ts,预期 14 个用例全绿。
  • 需要你做的:用 os-zhuang 审读并批准这个收窄。契约复审 PASS 6941568501,钉在 Head-sha 8e828209b5ce1d69a9c3513e319dce15eaa58101。批准在案后由席位翻 ready,经合并队列落地。是否另建安全公告,按席位 06:30 在项目里报你的那条由你定,不挡本 PR。

席位意见:同意合并。规则只在邮件可投递时生效,被拒的人有明确出路(先验证邮箱),失败方向是拒收而不是放行。

席位核对

  1. 形态:11 个文件,+741/−6,Fixes #34272;Clause-②: no (narrowing),Metadata-protocol: none,Skills-docs: none(skills/** 没有页面讲接受邀请)。收窄 ⇒ Tier H。
  2. 前提实测:卡线程在本 head 上跑了修复前后对照;dogfood 全电池在本 head 上 4055 绿。
  3. 门禁 check-runs:head 8e828209 上 65 条,53 绿、11 跳、1 条 PR 正文检查被取消(同名检查随后一次已绿,06:36Z)、0 红。check-governed-merges NOT governed,747 行。
  4. 接受的偏差:L1-c2 delta ACCEPT 6941448252(首审 REWORK 6940626667 的 R1、R2 已改);契约复审 PASS 6941568501,N2(沿用 vendor 句子)、N4(changeset 括号少列一种形态)接受。
  5. 范围外去向:复审 N1、N3、N5(收件箱动作、提示页文案、嵌入宿主需声明路由)合成一张跟进卡,已敲分诊。
  6. 落地条款:os-zhuang 授权批准在案后,席位翻 ready,经合并队列落地;Fixes #34272 合并即关卡。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 17, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 17, 2026 09:17
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 44054298746 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (2/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/object-designer-field-reorder.dogfood.test.ts > dogfood: an object designer field reorder publishes and reads back in the new order (#21790) > the des
      ↳ 失败原因: @objectstack/dogfood:test: Error: Test timed out in 5000ms.
    @objectstack/dogfood:test:  FAIL   isolated  test/object-designer-field-reorder.dogfood.test.ts > dogfood: an object designer field reorder publishes and reads back in the new order (#21790) > the des
      ↳ 失败原因: @objectstack/dogfood:test: Error: Test timed out in 5000ms.
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • test/object-designer-field-reorder.dogfood.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 16 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@os-zhuang
os-zhuang added this pull request to the merge queue Nov 17, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA

Queue note · 2026-11-17T09:48Z

This PR was removed from the merge queue at 09:39Z (CI_FAILURE). The only failing file is test/object-designer-field-reorder.dogfood.test.ts: its two cases timed out at 5000 ms. This PR does not touch that surface, so the failure is a flake, not a defect in this diff. The flake goes to its own card.

@os-zhuang: there is no approving review on record, so the seat does not re-queue it. Please put it back in the merge queue. The head is unchanged and the seat record above still pins it.

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 domain:server Domain lane — seat card indexed by label:pm:seat security size/l 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.

auth: the vendor accept-invitation route admits a session whose email is unverified; require a verified address there too (narrowing, after #34257)

3 participants