# proof: voter-cookie (mutation check) date: 2026-11-07T23:53:29Z commit: 3270a434ecacb28c984dcff09519bc8b9adb03f8, with the planted change below (not committed) command: npm run test:forum-pg -- --verbose database: throwaway postgres:17-alpine (PG_VERSION=17.11), podman, bound to 127.0.0.1, removed on exit node: v26.13.0 expected: exit 1 on the voter cookie test only planted change: diff --git a/app/api/forum/vote/route.ts b/app/api/forum/vote/route.ts index 700a3e7..57e731b 100644 --- a/app/api/forum/vote/route.ts +++ b/app/api/forum/vote/route.ts @@ -11,7 +11,7 @@ const COOKIE_OPTIONS = { httpOnly: true, secure: process.env.NODE_ENV === "production", sameSite: "lax", - path: "/api/forum", + path: "/", maxAge: 60 * 60 * 24 * VOTER_COOKIE_DAYS, } as const; output: 127.0.0.1:5432 - accepting connections FAIL __tests__/forum-postgres.integration.test.ts forum on a real Postgres ✓ db/schema.sql applies, and applying it again changes nothing (67 ms) ✓ stores one vote per browser under a hash, and a second vote replaces the first (18 ms) ✕ the voter cookie a real vote sets matches the privacy page: scripts can't read it, forum addresses only, 180 days (5 ms) ✓ the database itself refuses a vote other than agree, disagree or pass (3 ms) ✓ 'Clear my votes' deletes this browser's votes and no one else's (30 ms) ✓ votes flow through the results route into 'where groups agree' (407 ms) ✓ a suggestion can be voted on only once approved, and rejecting it removes its votes (37 ms) ✓ the database refuses a suggestion over 140 characters (2 ms) ● forum on a real Postgres › the voter cookie a real vote sets matches the privacy page: scripts can't read it, forum addresses only, 180 days expect(received).toMatch(expected) Expected pattern: /; Path=\/api\/forum(;|$)/i Received string: "forum_voter=438f1d54-fcf3-4a2f-9c70-11cdb6294cc3; Path=/; Expires=Thu, 06 May 2027 23:53:22 GMT; Max-Age=15552000; HttpOnly; SameSite=lax" 188 | expect(header).toMatch(new RegExp(`^${VOTER_COOKIE}=`)); 189 | expect(header).toMatch(/; HttpOnly/i); > 190 | expect(header).toMatch(/; Path=\/api\/forum(;|$)/i); | ^ 191 | expect(header).toMatch(/; SameSite=lax/i); 192 | expect(header).toMatch(new RegExp(`; Max-Age=${60 * 60 * 24 * VOTER_COOKIE_DAYS}(;|$)`)); 193 | expect(VOTER_COOKIE_DAYS).toBe(180); at Object.toMatch (__tests__/forum-postgres.integration.test.ts:190:20) Test Suites: 1 failed, 1 total Tests: 1 failed, 7 passed, 8 total Snapshots: 0 total Time: 0.846 s, estimated 1 s Ran all test suites matching /__tests__\/forum-postgres.integration.test.ts/i. exit: 1