Skip to content

Commit ad97d99

Browse files
authored
refactor(billing): drop the seat 410 stop-gap; PR 2 ships in the same release
The readable-copy branch only served the window where the seat-era plans page was live without PR 2's replacement. PR 1 and PR 2 ship as one release, so that window is zero: the typed 410 error, the classify branch, and their tests go, leaving the PR with no seat-API changes at all (auto-provisioning already fails soft on any create error). Generated-By: PostHog Code Task-Id: 1039ea23-9930-44e2-9888-b05cf8b129ec
1 parent 1a5691e commit ad97d99

3 files changed

Lines changed: 0 additions & 52 deletions

File tree

packages/api-client/src/posthog-client.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,6 @@ export class SeatPaymentFailedError extends Error {
133133
}
134134
}
135135

136-
/** Seat creation/upgrades/reactivation return 410 Gone: seats are retired. */
137-
export class SeatProductRetiredError extends Error {
138-
constructor() {
139-
super("PostHog Code seats have been retired");
140-
this.name = "SeatProductRetiredError";
141-
}
142-
}
143-
144136
export class SandboxCustomImagesDisabledError extends Error {
145137
constructor(message?: string) {
146138
super(message ?? "Custom sandbox images are not enabled");
@@ -4597,9 +4589,6 @@ export class PostHogAPIClient {
45974589
const parsed = this.parseFetcherError(error);
45984590

45994591
if (parsed) {
4600-
if (parsed.status === 410) {
4601-
throw new SeatProductRetiredError();
4602-
}
46034592
if (
46044593
parsed.status === 400 &&
46054594
typeof parsed.body.redirect_url === "string"

packages/core/src/billing/seatErrors.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ export function classifySeatError(error: unknown): ClassifiedSeatError {
88
return { error: "An unexpected error occurred", redirectUrl: null };
99
}
1010

11-
// Seats are retired (410 Gone); the seat-era UI that can hit this goes
12-
// away at cutover, so readable copy is the only handling.
13-
if (error.name === "SeatProductRetiredError") {
14-
return {
15-
error:
16-
"PostHog Code seat plans have been retired — usage is now billed to your organization.",
17-
redirectUrl: null,
18-
};
19-
}
20-
2111
if (error.name === "SeatSubscriptionRequiredError") {
2212
const redirectUrl =
2313
"redirectUrl" in error && typeof error.redirectUrl === "string"

packages/core/src/billing/seatService.test.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ class SeatPaymentFailedError extends Error {
6262
}
6363
}
6464

65-
class SeatProductRetiredError extends Error {
66-
constructor() {
67-
super("PostHog Code seats have been retired");
68-
this.name = "SeatProductRetiredError";
69-
}
70-
}
71-
7265
beforeEach(() => {
7366
vi.clearAllMocks();
7467
});
@@ -285,27 +278,3 @@ describe("error classification", () => {
285278
expect(result.error).toBe("Card declined");
286279
});
287280
});
288-
289-
// The seat API 410s creation/upgrades/reactivation once Code seats are
290-
// retired in favor of usage-based billing (reads keep working).
291-
describe("seat product retired (410 Gone)", () => {
292-
it("treats a retired auto-provision as seatless instead of erroring", async () => {
293-
const client = makeClient({
294-
createSeat: vi.fn().mockRejectedValue(new SeatProductRetiredError()),
295-
});
296-
const result = await new SeatService(client, logger).fetchSeat({
297-
autoProvision: true,
298-
});
299-
expect(result.seat).toBeNull();
300-
expect(result.error).toBeNull();
301-
});
302-
303-
it("surfaces retirement as a clear error on an explicit upgrade", async () => {
304-
const client = makeClient({
305-
createSeat: vi.fn().mockRejectedValue(new SeatProductRetiredError()),
306-
});
307-
const result = await new SeatService(client, logger).upgradeToPro();
308-
expect(result.error).toContain("retired");
309-
expect(result.redirectUrl).toBeNull();
310-
});
311-
});

0 commit comments

Comments
 (0)