Skip to content

Commit b678fe4

Browse files
Claude (Webhook)claude
andcommitted
fix: resolve CI failures — mock better-sqlite3 in tests and stabilize pendingFiles
- Mock better-sqlite3 module in session-manager tests so SessionArchive doesn't attempt to open a real database (directory doesn't exist in CI) - Wrap pendingFiles derivation in useMemo to fix React hook dependency warning Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a654986 commit b678fe4

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
77
<title>Codekin</title>
8-
<script type="module" crossorigin src="/assets/index-DosFG4tA.js"></script>
8+
<script type="module" crossorigin src="/assets/index-IgGZRgC6.js"></script>
99
<link rel="stylesheet" crossorigin href="/assets/index-DPhyCeqL.css">
1010
</head>
1111
<body class="bg-neutral-12 text-neutral-2">

server/session-manager.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ vi.mock('@ai-sdk/openai', () => ({ createOpenAI: () => (model: string) => ({ mod
2222
vi.mock('@ai-sdk/google', () => ({ createGoogleGenerativeAI: () => (model: string) => ({ modelId: model }) }))
2323
vi.mock('@ai-sdk/anthropic', () => ({ createAnthropic: () => (model: string) => ({ modelId: model }) }))
2424

25+
// Mock better-sqlite3 so SessionArchive doesn't try to open a real database file
26+
vi.mock('better-sqlite3', () => {
27+
class MockDatabase {
28+
pragma = vi.fn()
29+
exec = vi.fn()
30+
prepare = vi.fn(() => ({
31+
run: vi.fn(() => ({ changes: 0 })),
32+
get: vi.fn(),
33+
all: vi.fn(() => []),
34+
}))
35+
close = vi.fn()
36+
}
37+
return { default: MockDatabase }
38+
})
39+
2540
// Set API key for naming tests
2641
process.env.GROQ_API_KEY = 'test-key'
2742

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function App() {
6363
const sendInputRef = useRef<(data: string) => void>(() => {})
6464
const [uploadStatus, setUploadStatus] = useState<string | null>(null)
6565
const [sessionPendingFiles, setSessionPendingFiles] = useState<Record<string, File[]>>({})
66-
const pendingFiles = activeSessionId ? (sessionPendingFiles[activeSessionId] ?? []) : []
66+
const pendingFiles = useMemo(() => activeSessionId ? (sessionPendingFiles[activeSessionId] ?? []) : [], [activeSessionId, sessionPendingFiles])
6767

6868
const inputBarRef = useRef<InputBarHandle>(null)
6969
const [sessionInputs, setSessionInputs] = useState<Record<string, string>>({})

0 commit comments

Comments
 (0)