-
Notifications
You must be signed in to change notification settings - Fork 9
feat(api): implement subscription management portal endpoints #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ahmednahima0-beep
wants to merge
12
commits into
test
Choose a base branch
from
feat/subscriptions-portal-post
base: test
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0a9b6ab
feat(api): implement subscription management portal endpoints
ahmednahima0-beep 765789e
Merge branch 'test' into feat/subscriptions-portal-post
ahmednahima0-beep 0bba531
Remove outdated tests for subscription portal and validation request
ahmednahima0-beep a63bd0c
Remove obsolete test files for subscription portal outcomes and route…
ahmednahima0-beep f583a6d
Refactor subscription portal validation and schema
ahmednahima0-beep fcd6416
Merge branch 'test' into feat/subscriptions-portal-post
ahmednahima0-beep ef8441a
Refactor subscription portal validation to use new body validation fu…
ahmednahima0-beep 4e60175
Merge branch 'feat/subscriptions-portal-post' of https://github.com/r…
ahmednahima0-beep a04ef32
refactor(supabase): rename selectStripeBillingCustomerByAccountId to …
sweetmantech 58eed67
fix(supabase): type provider param as billing_provider enum
sweetmantech 9db6cea
Merge remote-tracking branch 'origin/test' into feat/subscriptions-po…
sweetmantech 9e75112
refactor(subscriptions): replace selectBillingCustomers with getActiv…
ahmednahima0-beep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
app/api/subscriptions/portal/__tests__/route.options.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import "./routeTestMocks"; | ||
| import { describe, it, expect } from "vitest"; | ||
| import { getCorsHeaders } from "@/lib/networking/getCorsHeaders"; | ||
|
|
||
| const { OPTIONS } = await import("../route"); | ||
|
|
||
| describe("OPTIONS /api/subscriptions/portal", () => { | ||
| it("returns 200 with CORS headers", async () => { | ||
| const res = await OPTIONS(); | ||
| expect(res.status).toBe(200); | ||
| expect(getCorsHeaders).toHaveBeenCalled(); | ||
| expect(res.headers.get("Access-Control-Allow-Origin")).toBe("*"); | ||
| }); | ||
| }); |
58 changes: 58 additions & 0 deletions
58
app/api/subscriptions/portal/__tests__/route.post.outcomes.early.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import "./routeTestMocks"; | ||
| import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { validateCreateSubscriptionPortalBody } from "@/lib/stripe/validateCreateSubscriptionPortalBody"; | ||
| import { createBillingPortalSession } from "@/lib/stripe/createBillingPortalSession"; | ||
| import { getActiveSubscriptionDetails } from "@/lib/stripe/getActiveSubscriptionDetails"; | ||
|
|
||
| const { POST } = await import("../route"); | ||
|
|
||
| const ACCOUNT = "123e4567-e89b-12d3-a456-426614174001"; | ||
|
|
||
| describe("POST /api/subscriptions/portal (handler outcomes — validation & no subscription)", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockReset(); | ||
| vi.spyOn(console, "error").mockImplementation(() => undefined); | ||
| }); | ||
|
|
||
| afterEach(() => vi.mocked(console.error).mockRestore()); | ||
|
|
||
| it("returns validation response unchanged", async () => { | ||
| const err = NextResponse.json({ error: "bad" }, { status: 400 }); | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockResolvedValue(err); | ||
| const req = new NextRequest("http://localhost/api/subscriptions/portal", { | ||
| method: "POST", | ||
| body: "{}", | ||
| }); | ||
| expect(await POST(req)).toBe(err); | ||
| expect(getActiveSubscriptionDetails).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("returns 400 when no active subscription", async () => { | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockResolvedValue({ | ||
| accountId: ACCOUNT, | ||
| returnUrl: "https://chat.recoupable.com/billing", | ||
| }); | ||
| vi.mocked(getActiveSubscriptionDetails).mockResolvedValue(null); | ||
| const res = await POST( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { method: "POST", body: "{}" }), | ||
| ); | ||
| expect(res.status).toBe(400); | ||
| await expect(res.json()).resolves.toEqual({ error: "No active subscription found" }); | ||
| expect(createBillingPortalSession).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("returns 500 when subscription lookup fails", async () => { | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockResolvedValue({ | ||
| accountId: ACCOUNT, | ||
| returnUrl: "https://chat.recoupable.com/billing", | ||
| }); | ||
| vi.mocked(getActiveSubscriptionDetails).mockRejectedValue(new Error("stripe down")); | ||
| const res = await POST( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { method: "POST", body: "{}" }), | ||
| ); | ||
| expect(res.status).toBe(500); | ||
| await expect(res.json()).resolves.toEqual({ error: "Internal server error" }); | ||
| }); | ||
| }); |
53 changes: 53 additions & 0 deletions
53
app/api/subscriptions/portal/__tests__/route.post.outcomes.portal.errors.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import "./routeTestMocks"; | ||
| import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; | ||
| import { NextRequest } from "next/server"; | ||
| import { validateCreateSubscriptionPortalBody } from "@/lib/stripe/validateCreateSubscriptionPortalBody"; | ||
| import { createBillingPortalSession } from "@/lib/stripe/createBillingPortalSession"; | ||
| import { getActiveSubscriptionDetails } from "@/lib/stripe/getActiveSubscriptionDetails"; | ||
|
|
||
| const { POST } = await import("../route"); | ||
|
|
||
| const ACCOUNT = "123e4567-e89b-12d3-a456-426614174001"; | ||
|
|
||
| function mockValidated() { | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockResolvedValue({ | ||
| accountId: ACCOUNT, | ||
| returnUrl: "https://chat.recoupable.com/billing", | ||
| }); | ||
| vi.mocked(getActiveSubscriptionDetails).mockResolvedValue({ | ||
| customer: "cus_test_123", | ||
| } as Awaited<ReturnType<typeof getActiveSubscriptionDetails>>); | ||
| } | ||
|
|
||
| describe("POST /api/subscriptions/portal (portal session errors)", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockReset(); | ||
| vi.spyOn(console, "error").mockImplementation(() => undefined); | ||
| }); | ||
|
|
||
| afterEach(() => vi.mocked(console.error).mockRestore()); | ||
|
|
||
| it("returns 400 when session.url is null", async () => { | ||
| mockValidated(); | ||
| vi.mocked(createBillingPortalSession).mockResolvedValue({ | ||
| id: "bps_test_abc", | ||
| url: null, | ||
| } as Awaited<ReturnType<typeof createBillingPortalSession>>); | ||
| const res = await POST( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { method: "POST", body: "{}" }), | ||
| ); | ||
| expect(res.status).toBe(400); | ||
| await expect(res.json()).resolves.toEqual({ error: "Billing portal URL missing" }); | ||
| }); | ||
|
|
||
| it("returns 500 when createBillingPortalSession throws", async () => { | ||
| mockValidated(); | ||
| vi.mocked(createBillingPortalSession).mockRejectedValue(new Error("Stripe down")); | ||
| const res = await POST( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { method: "POST", body: "{}" }), | ||
| ); | ||
| expect(res.status).toBe(500); | ||
| await expect(res.json()).resolves.toEqual({ error: "Internal server error" }); | ||
| }); | ||
| }); | ||
42 changes: 42 additions & 0 deletions
42
app/api/subscriptions/portal/__tests__/route.post.outcomes.portal.success.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import "./routeTestMocks"; | ||
| import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; | ||
| import { NextRequest } from "next/server"; | ||
| import { validateCreateSubscriptionPortalBody } from "@/lib/stripe/validateCreateSubscriptionPortalBody"; | ||
| import { createBillingPortalSession } from "@/lib/stripe/createBillingPortalSession"; | ||
| import { getActiveSubscriptionDetails } from "@/lib/stripe/getActiveSubscriptionDetails"; | ||
|
|
||
| const { POST } = await import("../route"); | ||
|
|
||
| const ACCOUNT = "123e4567-e89b-12d3-a456-426614174001"; | ||
|
|
||
| describe("POST /api/subscriptions/portal (200)", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockReset(); | ||
| vi.spyOn(console, "error").mockImplementation(() => undefined); | ||
| }); | ||
|
|
||
| afterEach(() => vi.mocked(console.error).mockRestore()); | ||
|
|
||
| it("returns id and url when portal session is created", async () => { | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockResolvedValue({ | ||
| accountId: ACCOUNT, | ||
| returnUrl: "https://chat.recoupable.com/billing", | ||
| }); | ||
| vi.mocked(getActiveSubscriptionDetails).mockResolvedValue({ | ||
| customer: "cus_test_123", | ||
| } as Awaited<ReturnType<typeof getActiveSubscriptionDetails>>); | ||
| vi.mocked(createBillingPortalSession).mockResolvedValue({ | ||
| id: "bps_test_abc", | ||
| url: "https://billing.example.com/session/abc", | ||
| } as Awaited<ReturnType<typeof createBillingPortalSession>>); | ||
| const res = await POST( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { method: "POST", body: "{}" }), | ||
| ); | ||
| expect(res.status).toBe(200); | ||
| await expect(res.json()).resolves.toEqual({ | ||
| id: "bps_test_abc", | ||
| url: "https://billing.example.com/session/abc", | ||
| }); | ||
| }); | ||
| }); |
84 changes: 84 additions & 0 deletions
84
app/api/subscriptions/portal/__tests__/route.post.validation.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import "./routeTestMocks"; | ||
| import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { validateCreateSubscriptionPortalBody } from "@/lib/stripe/validateCreateSubscriptionPortalBody"; | ||
| import { createBillingPortalSession } from "@/lib/stripe/createBillingPortalSession"; | ||
| import { validateAuthContext } from "@/lib/auth/validateAuthContext"; | ||
|
|
||
| const { POST } = await import("../route"); | ||
|
|
||
| async function loadRealValidate() { | ||
| const mod = await vi.importActual< | ||
| typeof import("@/lib/stripe/validateCreateSubscriptionPortalBody") | ||
| >("@/lib/stripe/validateCreateSubscriptionPortalBody"); | ||
| return mod.validateCreateSubscriptionPortalBody; | ||
| } | ||
|
|
||
| describe("POST /api/subscriptions/portal (validation)", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockReset(); | ||
| vi.spyOn(console, "error").mockImplementation(() => undefined); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| vi.mocked(console.error).mockRestore(); | ||
| }); | ||
|
|
||
| it("returns 400 when body is invalid JSON", async () => { | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockImplementationOnce( | ||
| await loadRealValidate(), | ||
| ); | ||
| const res = await POST( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { | ||
| method: "POST", | ||
| headers: { "content-type": "application/json" }, | ||
| body: "not-json", | ||
| }), | ||
| ); | ||
| expect(res.status).toBe(400); | ||
| await expect(res.json()).resolves.toEqual({ error: "Invalid JSON body" }); | ||
| expect(createBillingPortalSession).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("returns 400 when returnUrl is missing", async () => { | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockImplementationOnce( | ||
| await loadRealValidate(), | ||
| ); | ||
| const res = await POST( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { | ||
| method: "POST", | ||
| headers: { "content-type": "application/json", "x-api-key": "k" }, | ||
| body: JSON.stringify({}), | ||
| }), | ||
| ); | ||
| expect(res.status).toBe(400); | ||
| const body = await res.json(); | ||
| expect(body).toEqual({ error: expect.stringMatching(/returnUrl|Invalid input/i) }); | ||
| expect(createBillingPortalSession).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("returns 401 when not authenticated", async () => { | ||
| vi.mocked(validateAuthContext).mockResolvedValueOnce( | ||
| NextResponse.json( | ||
| { status: "error", error: "Exactly one of x-api-key or Authorization must be provided" }, | ||
| { status: 401 }, | ||
| ), | ||
| ); | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockImplementationOnce( | ||
| await loadRealValidate(), | ||
| ); | ||
| const res = await POST( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { | ||
| method: "POST", | ||
| headers: { "content-type": "application/json" }, | ||
| body: JSON.stringify({ returnUrl: "https://chat.recoupable.com/billing" }), | ||
| }), | ||
| ); | ||
| expect(res.status).toBe(401); | ||
| await expect(res.json()).resolves.toEqual({ | ||
| error: "Exactly one of x-api-key or Authorization must be provided", | ||
| }); | ||
| expect(createBillingPortalSession).not.toHaveBeenCalled(); | ||
| }); | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { vi } from "vitest"; | ||
|
|
||
| vi.mock("@/lib/auth/validateAuthContext", () => ({ | ||
| validateAuthContext: vi.fn(), | ||
| })); | ||
|
|
||
| vi.mock("@/lib/networking/getCorsHeaders", () => ({ | ||
| getCorsHeaders: vi.fn(() => ({ "Access-Control-Allow-Origin": "*" })), | ||
| })); | ||
|
|
||
| vi.mock("@/lib/stripe/validateCreateSubscriptionPortalBody", () => ({ | ||
| validateCreateSubscriptionPortalBody: vi.fn(), | ||
| })); | ||
|
|
||
| vi.mock("@/lib/stripe/getActiveSubscriptionDetails", () => ({ | ||
| getActiveSubscriptionDetails: vi.fn(), | ||
| })); | ||
|
|
||
| vi.mock("@/lib/stripe/createBillingPortalSession", () => ({ | ||
| createBillingPortalSession: vi.fn(), | ||
| })); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { getCorsHeaders } from "@/lib/networking/getCorsHeaders"; | ||
| import { createSubscriptionPortalHandler } from "@/lib/stripe/createSubscriptionPortalHandler"; | ||
|
|
||
| /** | ||
| * OPTIONS handler for CORS preflight requests. | ||
| * | ||
| * @returns A NextResponse with CORS headers. | ||
| */ | ||
| export async function OPTIONS() { | ||
| return new NextResponse(null, { | ||
| status: 200, | ||
| headers: getCorsHeaders(), | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * POST /api/subscriptions/portal: creates a subscription management (billing portal) session. | ||
| * | ||
| * @param request - The incoming HTTP request. | ||
| * @returns A NextResponse with portal session `id` and `url`, or an error body. | ||
| */ | ||
| export async function POST(request: NextRequest) { | ||
| return createSubscriptionPortalHandler(request); | ||
| } | ||
|
|
||
| export const dynamic = "force-dynamic"; | ||
| export const fetchCache = "force-no-store"; | ||
| export const revalidate = 0; |
83 changes: 83 additions & 0 deletions
83
lib/stripe/__tests__/createSubscriptionPortalHandler.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { createSubscriptionPortalHandler } from "@/lib/stripe/createSubscriptionPortalHandler"; | ||
| import { validateCreateSubscriptionPortalBody } from "@/lib/stripe/validateCreateSubscriptionPortalBody"; | ||
| import { createBillingPortalSession } from "@/lib/stripe/createBillingPortalSession"; | ||
| import { getActiveSubscriptionDetails } from "@/lib/stripe/getActiveSubscriptionDetails"; | ||
|
|
||
| vi.mock("@/lib/networking/getCorsHeaders", () => ({ | ||
| getCorsHeaders: vi.fn(() => ({ "Access-Control-Allow-Origin": "*" })), | ||
| })); | ||
|
|
||
| vi.mock("@/lib/stripe/validateCreateSubscriptionPortalBody", () => ({ | ||
| validateCreateSubscriptionPortalBody: vi.fn(), | ||
| })); | ||
|
|
||
| vi.mock("@/lib/stripe/getActiveSubscriptionDetails", () => ({ | ||
| getActiveSubscriptionDetails: vi.fn(), | ||
| })); | ||
|
|
||
| vi.mock("@/lib/stripe/createBillingPortalSession", () => ({ | ||
| createBillingPortalSession: vi.fn(), | ||
| })); | ||
|
|
||
| const ACCOUNT = "123e4567-e89b-12d3-a456-426614174000"; | ||
|
|
||
| describe("createSubscriptionPortalHandler", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| vi.spyOn(console, "error").mockImplementation(() => undefined); | ||
| }); | ||
| afterEach(() => vi.mocked(console.error).mockRestore()); | ||
|
|
||
| it("returns validation response unchanged", async () => { | ||
| const err = NextResponse.json({ error: "bad" }, { status: 400 }); | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockResolvedValue(err); | ||
| const req = new NextRequest("http://localhost/api/subscriptions/portal", { | ||
| method: "POST", | ||
| body: "{}", | ||
| }); | ||
| expect(await createSubscriptionPortalHandler(req)).toBe(err); | ||
| expect(getActiveSubscriptionDetails).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("returns 200 with id and url", async () => { | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockResolvedValue({ | ||
| accountId: ACCOUNT, | ||
| returnUrl: "https://chat.recoupable.com/billing", | ||
| }); | ||
| vi.mocked(getActiveSubscriptionDetails).mockResolvedValue({ | ||
| customer: "cus_test_123", | ||
| } as Awaited<ReturnType<typeof getActiveSubscriptionDetails>>); | ||
| vi.mocked(createBillingPortalSession).mockResolvedValue({ | ||
| id: "bps_test_abc", | ||
| url: "https://billing.example.com/session/abc", | ||
| } as Awaited<ReturnType<typeof createBillingPortalSession>>); | ||
|
|
||
| const res = await createSubscriptionPortalHandler( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { method: "POST", body: "{}" }), | ||
| ); | ||
| expect(res.status).toBe(200); | ||
| await expect(res.json()).resolves.toEqual({ | ||
| id: "bps_test_abc", | ||
| url: "https://billing.example.com/session/abc", | ||
| }); | ||
| }); | ||
|
|
||
| it("returns 500 when createBillingPortalSession throws", async () => { | ||
| vi.mocked(validateCreateSubscriptionPortalBody).mockResolvedValue({ | ||
| accountId: ACCOUNT, | ||
| returnUrl: "https://chat.recoupable.com/billing", | ||
| }); | ||
| vi.mocked(getActiveSubscriptionDetails).mockResolvedValue({ | ||
| customer: "cus_test_123", | ||
| } as Awaited<ReturnType<typeof getActiveSubscriptionDetails>>); | ||
| vi.mocked(createBillingPortalSession).mockRejectedValue(new Error("Stripe down")); | ||
|
|
||
| const res = await createSubscriptionPortalHandler( | ||
| new NextRequest("http://localhost/api/subscriptions/portal", { method: "POST", body: "{}" }), | ||
| ); | ||
| expect(res.status).toBe(500); | ||
| await expect(res.json()).resolves.toEqual({ error: "Internal server error" }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Custom agent: Enforce Clear Code Style and Maintainability Practices
Test file exceeds the repository's 100-line limit.
Prompt for AI agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!