Repository navigation
test(ui): the live member's API requests carry the member alone, not the inherited admin cookie - #31871
Merged
Conversation
Inside @playwright/test a request context created without a storageState inherits the config's use.storageState, the global setup's admin cookie. The read-only member spec sent the member's Bearer from such a context, so every premise request named two accounts, and since the one-account rule (#31469) the data route answers it 401. memberRequestContext() builds the member's context from the member's own cookie plus its Bearer, and the member's sign-in starts from an empty state. No assertion in the spec moves. Claude-Session: https://claude.ai/code/session_01ADHkmPpwZNVKwJLQGotdJy Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:server#3 · os-steve · session_01ADHkmQXLfvyB5R53VDm3Ka 席位核对 · ACCEPT · #31871 (Fixes #31827) · 2026-11-09T08:31ZHead-sha:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #31827
Clause-②: no
Metadata-protocol: none
维护者速读
read-only-member-record.spec.ts只换成调用新助手,断言一条未动。@playwright/test里,不指定storageState新建的请求上下文会继承配置里的管理员 cookie,于是成员请求同时带着管理员 cookie 和成员 Bearer。fix(plugin-auth): an auth request is judged and executed as one account #31469 起服务端拒绝这种「两个账号」的请求,数据路由回 401,夜间层因此变红。席位裁定:改夹具,不改产品。ui/e2e/live/下两个测试文件,不发布任何包,不动packages/。回滚即 revert。ui/e2e/live/member.ts的memberRequestContext和模块注释里的 ⛔ 段。OS_TEST_TIERS=nightly pnpm --filter @objectstack/example-showcase exec vitest run test/console-live-specs.live.test.ts,预期28 passed。What changes
ui/e2e/live/member.tsgainsmemberRequestContext(member): a request context carrying the member's own session cookie and its Bearer, with itsstorageStatenamed so the config's administrator cookie is not inherited.storageState({ cookies: [], origins: [] }) instead of the inherited administrator cookie, so the sign-in request names the member only.read-only-member-record.spec.tsbuilds its premise context with the helper. That is its only change: theplaywrightfixture it no longer uses leaves the destructuring, and no assertion moves.@playwright/test,playwright.request.newContext()and the importedrequest.newContext()both start with the config'suse.storageState.No test was skipped, renamed or loosened. No change under
packages/.Why
The nightly live tier went red at
6be71abconread-only-member-record.spec.ts:48, premise step: the member'sGET /api/v1/data/showcase_inquiry/<id>answered 401 where 200 was expected.Step 0 (seat ruling 6735238125):
Bisect. Each commit measured on a fresh backend booted by
ui/e2e/live/ci/start-backend.sh, with the spec's request shape:44a030bf(last green nightly)133f75aec0~1133f75aec0fix(plugin-auth): an auth request is judged and executed as one account #31469ed4b83226bfeat(plugin-auth): a SCIM group push grants the ordinary permission set its group mapping names #3144359630d9357fix(plugin-auth): disabling an OAuth client refuses its already-issued tokens on the next call, and an administrator's API-key suspension holds against the owner #316228c9260f79cfeat(plugin-auth): an SSO sign-in grants the permission set its IdP group is mapped to #31657f127b04e07fix(plugin-auth)!: under invite_only, a self-serve sign-up is admitted only by the invitation it presents #316866be71abc(red nightly)Cause. The member's context was
playwright.request.newContext({ extraHTTPHeaders: { Authorization: 'Bearer <member>' } }). Inside@playwright/testthat context inherits the config'suse.storageState, which is the global setup's administrator cookie. Measured: the context's cookie equals the administrator's. So each premise request carried two accounts' credentials. Before fix(plugin-auth): an auth request is judged and executed as one account #31469 the bearer won. Since fix(plugin-auth): an auth request is judged and executed as one account #31469 the session read refuses such a request withCREDENTIALS_NAME_DIFFERENT_ACCOUNTS, and the data route answers its own anonymous 401. fix(plugin-auth): an auth request is judged and executed as one account #31469's acceptance notes describe exactly that data-route answer, so the product behaves as ruled and the fixture relied on what fix(plugin-auth): an auth request is judged and executed as one account #31469 ruled out.Sweep (owed by the ruling)
Every live spec and helper under
ui/e2e/live/that builds a request context or sends a credential:read-only-member-record.spec.tspremise contextmemberRequestContextmember.tssign-in context (request.newContext())storageStateread-only-member-record.spec.tsmember browser contextstorageStatenamed explicitlyglobal-setup.tssign-in contextusestate exists)inline-edit-polish-2572.spec.tsrequest+ Bearerstate.jsonstudio-customize-journey.spec.tsrequestoverridestorageStatepassed by name (admin), no other credentialstudio-object-designer.spec.tsin-pagefetchrequest.get/post/…(cascading-options, grid-file-upload, list-row-action-cel, master-detail, record-form-direct-url, record-history-display)requestfixture aloneMeasured for the two inherited sites: the imported
request.newContext()andplaywright.request.newContext()each start with 1 cookie under this config; withstorageState: { cookies: [], origins: [] }they start with 0.Verification
All heavy runs went through
scripts/pm/os-verify-lock.sh. Head86082eb9b5, backend closure andpnpm console:buildrebuilt at the head first.OS_TEST_TIERS=nightly pnpm exec vitest run test/console-live-specs.live.test.tsinexamples/app-showcase: Playwright28 passed (1.3m), vitestTest Files 1 passed (1),Tests 1 passed (1).scripts/ablation-replace.mjsdeletes the helper'sstorageStateline inmember.ts(anchor 1 → 0, blobd4e1a39d33f5→dc6c2ff0d686), so the inherited administrator cookie is back. The same run:✘ read-only-member-record.spec.ts:48,Expected: 200,Received: 401,Test Files 1 failed (1). Restored: blob equals HEAD's (d4e1a39d33f5),git diff HEADempty,git status --porcelainempty.3487ccc1: the same nightly run was red, 1 of 28, the same 401.--ranreconciliation;pnpm lintandeslintover the two touched files are reported there too.No changeset: the diff publishes nothing (
ui/e2e/live/only), so this PR carriesskip-changeset.Human Minimum
packages/specholds no runtime logic. (Nopackages/specchange.)pnpm lintpasses.main, one pull request.skip-changeset.)packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmPpwZNVKwJLQGotdJy
Generated by Claude Code