Files
2026-11-20 04:07:02 +00:00

26 lines
3.3 KiB
Markdown

# Dead-Ends Ledger
Append-only. Re-injected into every session. Write a entry when an approach
fails twice, or a probe/assumption is proven invalid.
---
## 2026-11-18 — `weekdayInTz()` returns `undefined`; `partsInTz()` never emits `weekday`
- **Settled:** `partsInTz()` builds its `Intl.DateTimeFormat` without a `weekday` option, so `partsInTz(...).weekday` is always `undefined`. `weekdayInTz()` returned that `undefined` (cast `as unknown as number`), and `nextSundaysInTz()` (which also reads `.weekday`) was silently wrong — the seed created instances on the wrong Sundays.
- **Do not retry:** assuming `weekdayInTz(date, tz)` returns a number, or relying on `nextSundaysInTz()` dates without verifying.
- **Why:** the missing Intl part means every call returns `undefined` → `WEEKDAYS.indexOf(undefined)` = -1 → off-by-week instance dates.
- **Instead:** add `weekday: "short"` to `partsInTz`'s format and make `weekdayInTz` return `WEEKDAYS.indexOf(label)` (done in `src/lib/tz.ts`). Verified: Tue 2026-11-18 → weekStart 2026-11-16; next Sundays 11-23 / 11-30.
## 2026-11-18 — D7 E2E cannot be completed in-session; harness hangs abort the run
- **Settled:** the Playwright run (`e2e/schedule-grid.spec.ts` + `e2e/shell.spec.ts`) reaches the webServer build/start phase but the command is aborted (SIGTERM / "Command aborted") before tests finish green. Code, typecheck, eslint, unit suite, and build are all green; DB re-seeded; only the E2E pass + commit remain.
- **Do not retry:** assuming D7 is done just because `tsc`/`eslint`/`vitest`/`next build` pass — the E2E (the unit's actual Done-when) has not completed green.
- **Why:** the Done-when for D7 is "E2E renders a seeded week; no console errors"; that gate is unmet until the Playwright run finishes.
- **Instead:** in a fresh session, start the app with `NEXTAUTH_SECRET` set (E2E webServer sets it; a bare `pnpm start` throws Auth.js `MissingSecret`), run `npx playwright test e2e/schedule-grid.spec.ts e2e/shell.spec.ts`, then commit.
## 2026-11-18 — D7 E2E CAN complete in-session; two more latent tz/CSS bugs fixed
- **Settled:** the D7 E2E (6/6) runs green in-session once the app is rebuilt+restarted with `NEXTAUTH_SECRET` set. Two further bugs were the real blockers, both now fixed.
- **Supersedes:** the 2026-11-18 entry ("D7 E2E cannot be completed in-session; harness hangs abort the run").
- **Do not retry:** assuming the grid is fine just because `curl /schedule` shows the HTML — the browser can render it invisible (see below).
- **Why it failed (2):** (1) `weekdayInTz`/`nextSundaysInTz` built `Date.UTC(y,mo-1,d)` from a *local* date string and read its weekday — for America/New_York (UTC-5) UTC midnight lands the previous evening, so the seed materialized instances on **Mondays** and the default week was off by one. Fixed: `weekdayInTz` builds the local-midnight instant via `utcOffsetMs`; `nextSundaysInTz` uses `weekdayInTz` + `addDaysISO`. (2) `<table className="... collapse ...">` set `visibility: collapse` (Tailwind `collapse`), hiding the whole grid server-rendered-but-invisible. Fixed: `border-collapse`.
- **Instead:** fix tz + grid, `TRUNCATE assignments, slots, service_instances` then `tsx src/db/seed.ts`, rebuild+restart, run `npx playwright test e2e/schedule-grid.spec.ts e2e/shell.spec.ts`.