Repository navigation
test(plugin-auth): register the #8243 rotation cases only in their own file, not in the 32 suites that import its double - #28624
Merged
Conversation
…n file, not in the 32 suites that import its double Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kvkRpCLsRcpPnABwj
Contributor
Author
|
domain:server#1 · os-project-manager · session_01R1q2xdtYgU6FKrZ7LgjPCC 席位核对 · ACCEPT ·
|
| item | reading |
|---|---|
| Shape | Draft, base main, Part of #23181. impersonation-bearer-rotation.test.ts plus cost prose in six importers, labels tests + skip-changeset. Clause-②: no, Metadata-protocol: none. |
| Diff check (seat) | With whitespace ignored, the shared file changes by 23/6 lines: an isEntry reading (expect.getState().testPath === fileURLToPath(import.meta.url), the precedent in protocol.lock-one-resolution.kit.test.ts) and one if (isEntry) { … } around the three existing describes, whose bodies are untouched. createMemoryEngine, its export, both gate rows, the 32 import lines and the module-scope hooks (console stubs, restoreAllMocks, the scrypt memo) are unchanged, so the importers keep memoizeScrypt. A mismatch would not pass silently: the package runs a bare vitest run with no --passWithNoTests, so a file that registers nothing fails. The importer edits are comment-only. |
| Evidence | CI green on head 31320abb (32 success, 23 skipped, 0 failed; the CI and Lint & Type Check workflow runs both success). Governed check: NOT governed, 404 changed lines (whitespace from the re-indent; 23/6 with whitespace ignored). The report gives the probe (testPath names the collecting file in all three runs), plugin-auth tests 3953 → 3633 (−320 exactly: −10 per importer, the shared file 10/10, the other 174 files unchanged), package wall 264.1 → 252.8 s, 51 of 51 derived gates exit 0, both double gates exit 0 with no row moved. |
| Landing | 「按照 pm-dispatch 规则复核过的都授权」 (Leehom, 2026-10-25T11:35Z): ready and auto-merge through the relay, once every check on this head is green or an expected skip. |
Generated by Claude Code
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kvkRpCLsRcpPnABwj
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 Leehom · project thread
Part of #23181 (slice 30, the seat's ruling D on report
6555141723). The card stays open for later slices.Clause-②: no
Metadata-protocol: none
维护者速读
impersonation-bearer-rotation.test.ts只在自己是 vitest 正在运行的那个文件时才注册它的 10 个 better-auth bearer plugin lets a bearer session silently shadow an impersonation the server just created — /admin/impersonate-user returns 200 and is a no-op for any bearer client #8243 用例(expect.getState().testPath与本模块路径比较);另外 6 个导入它的测试文件里,以「代价已测量」为由解释导入的注释改为现状。共享的createMemoryEngine替身、两个门禁台账、32 处 import 行都不动。files[]只发dist、README、CHANGELOG,不发布任何东西。模块级钩子(console 桩、restoreAllMocks、scrypt 记忆)仍不加守卫,24 个只靠这次导入拿到 scrypt 记忆的文件照旧拿到。回滚即 revert。packages/plugins/plugin-auth/src/impersonation-bearer-rotation.test.ts(isEntry守卫;用git diff -w看,除守卫外只有缩进变化);admin-impersonate-endpoint.test.ts第 32–43 行的注释。pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/impersonation-bearer-rotation.test.ts src/admin-has-permission-endpoint.test.ts→ 前者 10 个用例、后者 3 个(base 上后者是 13 个)。What changes
packages/plugins/plugin-auth/src/impersonation-bearer-rotation.test.ts: the three top-leveldescribe.concurrentblocks (the ten better-auth bearer plugin lets a bearer session silently shadow an impersonation the server just created — /admin/impersonate-user returns 200 and is a no-op for any bearer client #8243 cases) are wrapped inif (isEntry) { … }, whereisEntry = expect.getState().testPath === fileURLToPath(import.meta.url). A comment says why (test budget (domain:cli): 119 test file(s) over 10 s of wall in the hourly full battery (Part of #23151) #23181 slice 30, the 32 importers). The precedent ismetadata-protocol/src/protocol.lock-one-resolution.kit.test.ts.git diff -wshows only the guard, its comment, thefileURLToPathimport and a re-worded test budget (domain:services): 18 test file(s) over 10 s of wall in the hourly full battery (Part of #23151) #23184 comment above it (which said the cases still run in importers). Every case keeps its body and assertions. The export and the double are byte-identical. The module-scope hooks stay unguarded: the console stubs,afterEach(restoreAllMocks), andmemoizeScrypt()withafterAll(restore).git grepover the 32 importers for comments justifying the import by its cost, or saying the bearer-rotation cases run there:admin-impersonate-endpoint.test.ts: the "re-registers … 10 rotation tests also execute" sentence and "Ten duplicated hermetic tests is the cheapest of the four." are replaced by one sentence: the file registers itsdescribes only when it is the one run. The reason to import (one double in both gates' sight) stays.platform-admin-standing.consolidation.test.tsandsession-positions-security-axis.test.ts: "re-registering that file'sdescribes here is cheaper than minting a second engine double" becomes "sharing its double is better than minting a second engine double".admin-impersonate-endpoint,platform-admin-standing.consolidation,session-grants-resolved-once,two-factor-reenrollment-verified-resetandtwo-factor-rotated-token-echo: in the vendor-preload comment, "(and the bearer-rotation cases it imports)" becomes "(and, until test budget (domain:cli): 119 test file(s) over 10 s of wall in the hourly full battery (Part of #23151) #23181 slice 30, the bearer-rotation cases it imported)". The preload lists themselves are untouched.bridge-redispatch-transport.pin.test.tsline 36 andsso-domain-verification-unknown-provider.pin.test.tsline 123 (the import still registersafterEach(restoreAllMocks)in the importer).Tests
Probe, a throwaway run with two temp files deleted after. A module that reads
expect.getState().testPathat collection sees the file vitest is collecting, in all three runs:Each file gets its own module graph (vitest's default
isolate: true; neither plugin-auth's config nor CI turns it off), so the module is evaluated again per file and the reading is per file.Count and wall A/B on one box: the full plugin-auth suite in separate invocations, interleaved base, head, base, head, base, head, in one lock hold. Base
ce001f97was swapped in for the 7 files and HEAD restored after;git diff HEADwas empty at the end.impersonation-bearer-rotation.test.tsruns 10 before and 10 after. The other 174 files' counts are identical. Run alone,impersonation-bearer-rotation.test.tsreads 10/10 at head.pnpm --filter @objectstack/plugin-auth typecheck(tsc, examples,check:test-typecheck): exit 0.Acceptance notes
// test-budget:headers: none added or changed (order item 6).finddouble inplugin-sharing/src/exec-context-seam.testkit.ts, and whether the two double gates should walk*.testkit.ts, are filed by the seat as a finding for triage. They are not in this PR.Verification
31320abb.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 51 families. All 51 were run after a fullturbo run build(118/118) and all exit 0.--ranreports: 51 accounted, 51 run, 0 NOT-MEASURED.check:engine-double-contract: exit 0, 1060 rows held by the RETAINED ledger, as on base.check:objectql-double-limit: exit 0, "baseline key set verified … no files added". Neither ledger file is in the diff.eslint --no-inline-configover the 7 files: exit 0. plugin-auth has no lint script.check-commit-card-trailers --range ce001f97..HEAD: exit 0.skip-changeset: plugin-auth'sfiles[]isdist,README.md,CHANGELOG.md, and the diff is*.test.tsonly. Nofiles[]changes.Generated by Claude Code