Repository navigation
test(plugin-auth): keep the absolute-limit switch fixture off the one-hour boundary - #31213
Merged
Merged
Conversation
…-hour boundary The switch judgment reads its own clock after the fixture is written, so a session made exactly 60 minutes old against a one-hour absolute limit is over as soon as one millisecond passes, and the "not over yet" assertion went red on main. The fixture is now 59 minutes old; the 61-minute "over" leg is unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mS6HNaJTYsygvmxuM
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mS6HNaJTYsygvmxuM
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): |
This was referenced Nov 7, 2026
Contributor
Author
|
domain:server#6 · os-project-manager · session_01FEkQ5p3T5YWhLjurajudnQ 席位核对 · ACCEPT · 2026-11-07T18:42Z · head
|
This was referenced Nov 7, 2026
Merged
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
Fixes #31175
Clause-②: no
Metadata-protocol: none
维护者速读
packages/plugins/plugin-auth/src/organization-access-policy.test.ts(L398 夹具与 L421 注释)。pnpm --filter @objectstack/plugin-auth exec vitest run src/organization-access-policy.test.ts,预期 19/19 通过。What changes
packages/plugins/plugin-auth/src/organization-access-policy.test.ts, in thedeployment()fixture of the "a switch of the active organization is judged against the target's limits" block: thes1session row is created 59 minutes ago instead of exactly 60. The "not over yet" comment now says why the fixture must sit clearly inside the limit. The "over" leg (created_at61 minutes ago, expectendedwithrevoke_reason: absolute_max) is unchanged, so the test still proves the absolute limit is judged at the switch, on both sides of it.last_activity_at(30 minutes ago, against a 10-minute idle limit) and sets no absolute limit, so 59 vs 60 does not change what it reads.No product file is touched;
organization-access-policy.tsandauth-manager.tsare as onmain.Why
AuthManager.judgeSessionSwitch(auth-manager.tsL6352–6355) takes its ownDate.now()after the fixture is written and ends the session whennow - created_at > absoluteHours * 3_600_000. A row madeDate.now() - 60 * MINagainst a one-hour limit is over as soon as one millisecond passes between the fixture and the judgment. The product comparison is right; the fixture sat on the boundary. Main went red on it inTest Core (7/8)(run 42384924042); locally the base fixture is red on every run (the memory engine's insert and read take well over a millisecond).Tests
Acceptance: a 5-second fake-clock advance between fixture and judgment; base fixture red, new fixture green
Each leg runs
pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/organization-access-policy.test.ts -t 'the absolute limit is judged too'underos-verify-lock, with the mutation written byscripts/ablation-replace.mjs(anchor must hit, blob verified, restored to the HEAD blob). The test imports./auth-managerfromsrc/, so there is nodist/hop and no rebuild per leg. The delay isvi.useFakeTimers({ toFake: ['Date'] }); vi.setSystemTime(Date.now() + 5_000);inserted on the line of the "not over yet" assertion; it was removed afterwards and is not in the diff.Tests 1 passed, exit 0AssertionError: expected 'ended' to be 'admitted', exit 1Tests 1 passed, exit 0AssertionError: expected 'ended' to be 'admitted', exit 1Restore proof after the last leg:
git diff HEADempty, blob on disk086c2c08= HEAD blob086c2c08.A first attempt at legs 1 and 2 was a no-op: the delay replacement still contained the anchor line, so
ablation-replacerefused it ("anchor count moved 1 -> 1") before running anything. It was redone with a replacement that rewrites the anchor line itself; the table above is the second run.plugin-auth suite and typecheck at head 228d061
pnpm --filter @objectstack/plugin-auth test:Test Files 234 passed (234),Tests 4168 passed | 10 skipped (4178),VERDICT command-exit 0.pnpm --filter @objectstack/plugin-auth typecheck(tsc, examples,check:test-typecheck):check:test-typecheck: OK,VERDICT command-exit 0. The first run answered exit 2 onexamples/basic-usage.tsbecause plugin-auth's owndist/was not built yet in the fresh worktree; afterpnpm --filter @objectstack/plugin-auth buildit is green.eslint --no-inline-config packages/plugins/plugin-auth: exit 0 (plugin-auth has nolintscript, so a filteredpnpm lintwould match nothing).Acceptance notes
minutesAgohelper): the four concurrent-cap cases use ages 50/40/1, 5/30, 5/30 and 30/20/1 minutes. They only order sessions by age against count caps (max_concurrent_sessions_per_user,maxConcurrentSessions); no time limit is judged, so nothing sits on a boundary. The other same-file clock fixture, L291hourAgo(60 minutes) against Alpha's 5-minute idle limit, is far over. No other same-file fix.plugin-auth/src/**/*.test.ts, everyDate.now() - Nfixture read against the limit it meets: none equals its limit. Closest reads:auth-manager.test.tsL4997 (created 60 minutes ago, but the case judges a 15-minute idle limit with no absolute limit),session-of-record.test.tsL313/L332 (12 h and 2 h against an 8 h cap),auth-manager.mcp-oauth.test.tsL359/L546 (consent timestamps, no limit judged). Nothing out of scope to file.Verification
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, 52 commands) run at head, reconciled with--ran: 51 exit 0, 1 NOT MEASURED (pnpm check:dual-build-cjs-loads, exit 3 PREREQUISITE NOT MET: it needs every package'sdist/and the worktree built only plugin-auth's closure).node scripts/check-plugin-teardown-shape.mjs --self-testfirst answered exit 3 on the shallow clone and is exit 0 aftergit fetch --depth=1 origin 621a4876.--ran: "52 derived famil(ies) accounted for — 51 run, 1 NOT-MEASURED", exit 0. The 16--self-testfamilies are checker health only, not a verdict on this diff.skip-changeset: plugin-authfiles[]isdist,README.md,CHANGELOG.md. After a build, the new comment text and the test file name have 0 hits there; positive controljudgeSessionSwitchhas 4 hits indist.Generated by Claude Code