Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): drop published usage limits on sign-out or account switch #39672

OpenKitsuneKode(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/39672/headopened View on GitHub

Showing 2 changed files with 170 additions and 14 deletions.

x
0 of 2 viewed, 2 left
146 additions and 0 deletionspackages/provider-core/src/server/managedProvider.test.tsModified
View file
@@ -1030,4 +1030,150 @@
).pipe(Effect.provide(layerAlwaysRunTest)),
+​
+ it.effect.each([
+ {
+ name: "signing out",
+ nextAuth: { status: "unauthenticated" as const },
+ },
+ {
+ name: "switching email",
+ nextAuth: { status: "authenticated" as const, email: "bob@example.com" },
+ },
+ {
+ name: "switching workspace",
+ nextAuth: {
+ status: "authenticated" as const,
+ email: "alice@example.com",
+ workspaceId: "ws-b",
+ },
+ },
+ ])("drops published limits and plan override when enrichment reports $name", ({ nextAuth }) =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const releaseFirst = yield* Deferred.make<void>();
+ const releaseSecond = yield* Deferred.make<void>();
+ const probedLimits = {
+ checkedAt: "2026-04-10T00:00:01.000Z",
+ windows: [{ id: "primary", kind: "session", label: "Session", usedPercent: 40 }],