AI Session Handoff — Castle Checkers (Caretaker Portal)
Read this before making any code changes. The FUSE-safe commit pattern is mandatory — deviating from it causes silent corruption.
Critical Rules
| Rule | Why |
|---|---|
Write files to /tmp first — never directly to FUSE path | FUSE mount silently truncates large file writes — both disk and git blob end up identically truncated so verification passes on a corrupted blob |
Use /tmp/cc-git git env — never git -C <FUSE_path> | FUSE git config is unreadable — git commands fail or return empty silently |
Strip null bytes before hashing: raw.rstrip(b'\x00') | Edit/Write tools append null bytes to files on FUSE mounts |
| TypeScript strict: remove ALL unused vars before commit | TS6133 = Cloudflare Pages build failure — not caught locally |
App.tsx at src/App.tsx — NOT src/components/App.tsx | main.tsx imports ./App from src root — wrong path = TS2307 |
| Parent commit = last PUSHED SHA — hardcode it | Unpushed intermediate commit as parent pulls bad trees into push pack — GitHub rejects |
Where Things Live
| Item | Path |
|---|---|
| Project root | E:\Claude_Projects\sonan-trackers\caretaker-portal-Claude\caretaker-portal\ |
| Worker | worker/index.ts |
| Frontend entry | src/main.tsx → src/App.tsx |
| Global state | src/context/AppContext.tsx |
| Admin shell | src/components/AdminApp.tsx |
| API layer | src/api.ts |
| D1 migrations | migrations/0001_init.sql, migrations/0002_settings_seed.sql |
Likely Next Tasks
If picking up from here: complete the Cloudflare Pages deployment (custom domain, env var VITE_API_URL), set JWT_SECRET Worker secret, and run D1 migrations. See the Deployment page for exact commands.
To add email notifications for new service requests: integrate Resend in Worker's POST /api/requests handler. Add RESEND_API_KEY as Worker secret.