Skip to content

Commit 8c3cca5

Browse files
ndbroadbentclaude
andcommitted
Fix: Use deterministic date format in classifier prompt
toLocaleString() produces different output between Node and Bun: - Node: "Jan 1, 2000, 1:00 PM" - Bun: "Jan 1, 2000 at 1:00 PM" This caused different prompt signatures between local (Bun) and CI (Node), breaking fixture cache lookups. Also: Don't load .env in CI for vitest to ensure tests use fixture cache only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e142bf7 commit 8c3cca5

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

src/classifier/prompt.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,31 @@ function formatCandidateWithContext(
123123

124124
/**
125125
* Format timestamp for display in prompt.
126+
* Uses deterministic format to avoid locale differences between environments.
126127
*/
127128
function formatTimestamp(date: Date): string {
128-
return date.toLocaleString('en-US', {
129-
month: 'short',
130-
day: 'numeric',
131-
year: 'numeric',
132-
hour: 'numeric',
133-
minute: '2-digit',
134-
hour12: true
135-
})
129+
const months = [
130+
'Jan',
131+
'Feb',
132+
'Mar',
133+
'Apr',
134+
'May',
135+
'Jun',
136+
'Jul',
137+
'Aug',
138+
'Sep',
139+
'Oct',
140+
'Nov',
141+
'Dec'
142+
]
143+
const month = months[date.getMonth()]
144+
const day = date.getDate()
145+
const year = date.getFullYear()
146+
const hours = date.getHours()
147+
const minutes = date.getMinutes().toString().padStart(2, '0')
148+
const ampm = hours >= 12 ? 'PM' : 'AM'
149+
const hour12 = hours % 12 || 12
150+
return `${month} ${day}, ${year}, ${hour12}:${minutes} ${ampm}`
136151
}
137152

138153
/**

vitest.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export default defineConfig(({ mode }) => ({
1818
},
1919
],
2020
test: {
21-
env: loadEnv(mode, process.cwd(), ""),
21+
// Don't load .env in CI - tests must use fixture cache only
22+
env: process.env.CI === "true" ? {} : loadEnv(mode, process.cwd(), ""),
2223
globals: true,
2324
include: ["src/**/*.test.ts", "tests/**/*.test.ts"],
2425
exclude: ["src/cli/e2e/**/*.test.ts", "node_modules/**"],

0 commit comments

Comments
 (0)