Back to blog

Dev Diary #11

Fixed sync data loss via schema writes, extracted image service, hardened finance CSV parsing and calendar dedup.

April 24, 2026

Dev Diary #11

Pulled the migration file apart in 0023_add_job_digest_and_created_at.sql because SQLite choked on multiple statements without the breakpoint marker. The dashboard was rendering empty boxes where job digests should live—turned out the schema had the columns but the sync handler wasn't actually writing createdAt or digest to the display tables. Fixed that in the handlers, but now I'm staring at a gap: the display-sync index was trying to ALTER TABLE on tables that don't exist yet on fresh installs. Added a safety net that CREATE TABLE before ALTER, though it feels hacky.

Spent time on the image sync refactor, extracting Unsplash into service-image as its own component. Built out the routing-key changes and wired up agent-activity and agent-recipe to call into the new service instead of doing image fetches inline. The Railway deployment config is there (railway.toml), but I haven't tested the actual deployment flow yet—just set it up so the infra team can push it.

Calendar event dedup is half-working. Added a content_hash column to catch duplicate syncs within the 5-minute poll window, but if an event changes slightly (like description gets edited), we'll see it as new. I'm not sure if that's the right trade-off. The fallback to 5m polling when webhooks fail is solid, though.

Finance work got real messy. Amex exports charges as positive but our system expects negatives, so I had to negate them in the CSV parser. Deep-dive metrics were registering twice because the wrapper wasn't unwrapping the response correctly. Goals parser was choking on markdown formatting, so I hardened that too. The whole flow is still fragile—agent-finance expects the month and filename from the statement-uploaded event payload, but if that's malformed, the analysis silently fails.

Dotfiles got a major cleanup. Set up daily plan pruning via launchd, added a focus-guard tool (HTTP + HTTPS status page for blocked sites), and built out context-economy guardrails to track token usage. The statusline now shows the 5h/7d rate limit buckets when we're above 50%, which should give me better visibility into cost creep.

What's uncertain: whether the safety nets in display-sync are masking a deeper schema ordering problem, or if the calendar dedup strategy will survive real-world edits.

Home
About
Resume
Projects
Blog
Press
Search