Skip to content

test(plugin-auth): register the #8243 rotation cases only in their own file, not in the 32 suites that import its double - #28624

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-n3t7se
Nov 1, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-n3t7se

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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 行都不动。
  • 为什么改:32 个测试文件从这个测试文件导入替身,每次导入都把那 10 个用例在导入方里重新注册一遍,同样 10 个用例每轮跑 33 次(test budget (domain:cli): 119 test file(s) over 10 s of wall in the hourly full battery (Part of #23151) #23181 测试提速职责)。
  • 风险与回滚:只改测试文件;plugin-auth 的 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

Tests

Probe, a throwaway run with two temp files deleted after. A module that reads expect.getState().testPath at collection sees the file vitest is collecting, in all three runs:

=== run: kit alone
PROBE kit-module: testPath=…/zzprobe-kit.test.ts own=…/zzprobe-kit.test.ts isEntry=true          Tests 1 passed (1)
=== run: importer alone
PROBE kit-module: testPath=…/zzprobe-importer.test.ts own=…/zzprobe-kit.test.ts isEntry=false
PROBE importer-module: testPath=…/zzprobe-importer.test.ts                                     Tests 1 passed (1)
=== run: both in one invocation
PROBE kit-module: testPath=…/zzprobe-importer.test.ts … isEntry=false
PROBE kit-module: testPath=…/zzprobe-kit.test.ts … isEntry=true                                Tests 2 passed (2)

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 ce001f97 was swapped in for the 7 files and HEAD restored after; git diff HEAD was empty at the end.

run base head
tests (all runs identical) 3943 passed, 10 skipped (3953) 3623 passed, 10 skipped (3633)
package wall, s 266.7 / 263.5 / 262.1 (mean 264.1) 256.6 / 255.8 / 246.1 (mean 252.8, −4.3%)
sum of all 207 default-reporter file lines, s 229.6 / 224.6 / 225.0 205.0 / 205.8 / 194.0 (−11%)
sum of the 32 importers' file lines, s 86.7 / 85.3 / 85.0 65.0 / 63.4 / 61.0 (−26%)
  • The fall is exactly 320 = 10 × 32, and every exit is 0. From the JSON reporter, per file: each of the 32 importers falls by exactly 10. impersonation-bearer-rotation.test.ts runs 10 before and 10 after. The other 174 files' counts are identical. Run alone, impersonation-bearer-rotation.test.ts reads 10/10 at head.
  • The package wall falls less than the summed file lines because the run is bound by workers and module collection, not by these cases.
  • pnpm --filter @objectstack/plugin-auth typecheck (tsc, examples, check:test-typecheck): exit 0.
  • No ablation: test-only, and no tested behaviour changed.

Acceptance notes

  • // test-budget: headers: none added or changed (order item 6).
  • The hidden limit-blind find double in plugin-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

  • Head 31320abb. node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 51 families. All 51 were run after a full turbo run build (118/118) and all exit 0. --ran reports: 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-config over the 7 files: exit 0. plugin-auth has no lint script.
  • check-commit-card-trailers --range ce001f97..HEAD: exit 0.
  • skip-changeset: plugin-auth's files[] is dist, README.md, CHANGELOG.md, and the diff is *.test.ts only. No files[] changes.

Generated by Claude Code

…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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-project-manager · session_01R1q2xdtYgU6FKrZ7LgjPCC

席位核对 · ACCEPT · domain:server seat 1 · os-project-manager · session_01R1q2xdtYgU6FKrZ7LgjPCC · 2026-11-01T09:14Z

Head 31320abb, report 6555806459 (on #23181), claim 6555841491 (slice 30, revised order under seat ruling D). No contract review is owed: test-only, no packages/spec/** path, no governed path, no narrowing and no Clause-②: yes.

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

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 1, 2026 09:16
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 1, 2026 09:16
@objectstack-fleet objectstack-fleet Bot added skip-changeset PR has no user-facing published change; bypasses the changeset gate tests labels Nov 1, 2026
@github-actions github-actions Bot added the size/m label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing 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): node scripts/docs-audit/affected-docs.mjs --json 68a2a216f071f118553e1b032818d72d43ac0cae → packageMentionDocs.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit d78a7e4 Nov 1, 2026
48 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-n3t7se branch November 1, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant