From c1c60a105a82c09c1585980a24730c887c273e65 Mon Sep 17 00:00:00 2001 From: Paperclip Date: Fri, 27 Mar 2026 22:48:20 +0000 Subject: [PATCH 1/4] fix(web): mock /api/auth/get-session in Dev login selector test The "redirects to /login when auth is disabled and no user selected" test fails because useSession() from better-auth/react calls /api/auth/get-session which wasn't mocked, causing sessionLoading to stay true indefinitely. Co-Authored-By: Paperclip --- apps/web/src/__tests__/App.test.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/web/src/__tests__/App.test.tsx b/apps/web/src/__tests__/App.test.tsx index d677733..19473c7 100644 --- a/apps/web/src/__tests__/App.test.tsx +++ b/apps/web/src/__tests__/App.test.tsx @@ -150,6 +150,12 @@ describe("Dev login selector", () => { }), } as Response); } + if (url === "/api/auth/get-session") { + return Promise.resolve({ + ok: true, + json: async () => ({ user: null }), + } as Response); + } return Promise.resolve({ ok: true, json: async () => [] } as Response); }) as unknown as typeof fetch; -- 2.52.0 From 8682b21c71dbd28a443fc77f55e204b0e426075c Mon Sep 17 00:00:00 2001 From: Paperclip Date: Fri, 27 Mar 2026 23:33:35 +0000 Subject: [PATCH 2/4] fix(web): import App.tsx (not App.js) in test to get authDisabled bypass The Dev login selector test was importing the compiled App.js instead of the source App.tsx. App.js has different logic (uses import.meta.env.DEV instead of API-based authDisabled) and doesn't implement the sessionLoading bypass needed for tests to pass. Also applied the rawSession/rawSessionLoading refactor in App.tsx that bypasses useSession result when authDisabled=true. Co-Authored-By: Paperclip --- apps/web/src/App.tsx | 5 ++++- apps/web/src/__tests__/App.test.tsx | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index da93316..8840370 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -134,7 +134,10 @@ function AdminLayout() { export function App() { const location = useLocation(); const [authDisabled, setAuthDisabled] = useState(null); - const { data: session, isPending: sessionLoading } = useSession(); + const { data: rawSession, isPending: rawSessionLoading } = useSession(); + // In dev mode (authDisabled=true), session state is irrelevant - skip useSession result + const session = authDisabled ? null : rawSession; + const sessionLoading = authDisabled ? false : rawSessionLoading; useEffect(() => { fetch("/api/dev/config") diff --git a/apps/web/src/__tests__/App.test.tsx b/apps/web/src/__tests__/App.test.tsx index 19473c7..35fb430 100644 --- a/apps/web/src/__tests__/App.test.tsx +++ b/apps/web/src/__tests__/App.test.tsx @@ -1,7 +1,8 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; import { render, screen, within, waitFor } from "@testing-library/react"; import { MemoryRouter } from "react-router-dom"; -import { App } from "../App.js"; +import { App } from "../App.tsx"; + // Mock fetch to return appropriate responses based on URL beforeEach(() => { -- 2.52.0 From fdd3f332be826a6adfa252430cd33d396e2e7d35 Mon Sep 17 00:00:00 2001 From: Paperclip Date: Fri, 27 Mar 2026 23:49:38 +0000 Subject: [PATCH 3/4] fix(web): use extensionless import for App in test The `.tsx` extension in the import path is not allowed without `allowImportingTsExtensions` (TS5097). Use extensionless `../App` which resolves correctly via moduleResolution: "bundler". Co-Authored-By: Paperclip --- apps/web/src/__tests__/App.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/__tests__/App.test.tsx b/apps/web/src/__tests__/App.test.tsx index 35fb430..ea5aea8 100644 --- a/apps/web/src/__tests__/App.test.tsx +++ b/apps/web/src/__tests__/App.test.tsx @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; import { render, screen, within, waitFor } from "@testing-library/react"; import { MemoryRouter } from "react-router-dom"; -import { App } from "../App.tsx"; +import { App } from "../App"; // Mock fetch to return appropriate responses based on URL -- 2.52.0 From c751e65ef25ca09144637dc64e0e3ca3ab96f688 Mon Sep 17 00:00:00 2001 From: Paperclip Date: Sat, 28 Mar 2026 00:17:40 +0000 Subject: [PATCH 4/4] fix(db): add missing migration journal entries 0012-0017 Co-Authored-By: Paperclip --- packages/db/migrations/meta/_journal.json | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 7a47235..affedd1 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -85,6 +85,48 @@ "when": 1742587200000, "tag": "0011_impersonation_indexes", "breakpoints": true + }, + { + "idx": 12, + "version": "7", + "when": 1774080000000, + "tag": "0012_pet_photo", + "breakpoints": true + }, + { + "idx": 13, + "version": "7", + "when": 1774166400000, + "tag": "0013_appointment_confirmation", + "breakpoints": true + }, + { + "idx": 14, + "version": "7", + "when": 1774252800000, + "tag": "0014_customer_notes", + "breakpoints": true + }, + { + "idx": 15, + "version": "7", + "when": 1774339200000, + "tag": "0015_waitlist", + "breakpoints": true + }, + { + "idx": 16, + "version": "7", + "when": 1774425600000, + "tag": "0016_ical_token", + "breakpoints": true + }, + { + "idx": 17, + "version": "7", + "when": 1774512000000, + "tag": "0017_better_auth_tables", + "breakpoints": true } ] } \ No newline at end of file -- 2.52.0