Build Log · July 2, 2026

The bug wasn't where the fix started

Fixed four real bugs in Known's note-suggestion-to-Known-Card review pipeline, seeded realistic demo data into dev and production, and burned most of the session chasing a UTF-16-encoded env file before finding the actual root cause.

  • Known
  • Bug Fix
  • Seed Data
  • Deploy
real bugs fixed in the note-suggestion → Known Card pipeline
4

real bugs fixed in the note-suggestion → Known Card pipeline

realistic demo entries seeded (dev + prod)
20

realistic demo entries seeded (dev + prod)

wrong theories tried before the actual root cause (UTF-16 file encoding)
3

wrong theories tried before the actual root cause (UTF-16 file encoding)

product deploy shipped to known.forgekits.build
1

product deploy shipped to known.forgekits.build

Timeline

  1. Start

    Charge: bug fix + functionality updates session

    Zeb flagged a screenshot — 'Review & add' on a note suggestion was landing in the wrong Known Card section

  2. ~20m

    Root cause found: hardcoded category

    accept/route.ts always wrote category: 'what_hurts' regardless of the keyword — nothing ever asked which section it belonged in

  3. ~45m

    Second bug found live: approving didn't add the comment

    onKnownCard was never flipped true on approval — entries existed but never counted as on-card

  4. ~1h

    Third bug found live: Known Card text still not showing

    persistCard was snapshotting every section's text on every save, freezing empty sections as permanent overrides that masked new entries forever

  5. ~1h20m

    Fourth ask: no way to enrich existing entries from the card

    KnownCard.tsx had zero links back to the enrich screen — added per-entry 'Edit guidance' links

  6. ~1h40m

    Charge: build realistic demo seed data

    Built Rick — a father with dementia and Type 2 diabetes — 20 entries, 7 handoff notes, all 4 review states represented

  7. ~2h

    Dev seed silently wrote to the wrong database

    seed.ts only loaded .env.local; dev server actually used .env.development.local — fixed precedence, cleaned up, reseeded correctly

  8. ~2h20m

    Charge: seed the same demo to production

    Began a long detour — dotenv silently failed to load DATABASE_URL from a pulled Vercel env file, tried BOM theory, override theory, all wrong

  9. ~3h

    User called it out directly — stopped, cleaned up, restarted the diagnosis honestly

    "none of that makes sense. what is the root cause for why we can't insert rows into production" — correctly rejected a confident-sounding wrong answer

  10. ~3h15m

    Actual root cause found: UTF-16-encoded env file

    The file Zeb edited in-IDE was saved as UTF-16 — every parser read null bytes between characters. Fixed the reader to detect and handle it.

  11. ~3h30m

    Prod seed succeeds, temp credentials file deleted

    20 entries + 7 notes seeded into org_3FwtSlSbKfvctoFmXCNPnpoPPto

  12. ~3h45m

    Committed and deployed products/known to production

    Local build verified clean before deploy; known.forgekits.build live with today's fixes

What shipped

  • Known: fixed accept/route.ts hardcoding category: 'what_hurts' on every accepted note suggestion — now defaults to a neutral placeholder and requires an explicit section choice in the enrich review screen

  • Known: fixed approving an enrichment never setting portraitEntries.onKnownCard — approved guidance now actually appears on the Known Card; rejecting sets it back false

  • Known: fixed KnownCard.tsx's persistCard permanently freezing empty sections as blank overrides — now only persists sections with real text, and buildSections falls through to computed defaults when an override is empty

  • Known: added per-entry 'Edit guidance' links directly on the Known Card so existing entries can be enriched without navigating through the Book/Portrait page

  • Known: accepting a note suggestion now marks the keyword as dismissed too, preventing the same suggestion from resurfacing after it becomes a real entry

  • Known: enrich review screen renders concatenated source notes as a list instead of one run-on paragraph

  • Known: fixed env file precedence in drizzle.config.ts and the seed script — .env.development.local now correctly wins over .env.local, matching Next.js's own resolution order

  • Known: built realistic demo seed data (Rick, a father with dementia and Type 2 diabetes) — 20 memory entries across all 10 categories, 7 handoff notes (3 mention 'appetite' to trigger the note-suggestion nudge live), all 4 enrichment review states represented

  • Known: added a separate, explicit-args production seed script (lib/db/seed-prod.ts) that requires --env-file and --org with no silent fallback, prints a dry-run target summary before writing, and reads DATABASE_URL directly off disk (bypassing dotenv) with UTF-16 file detection

  • Known: home page 'Other portraits' row now links to Portrait and Known Card, not just 'Share something'

  • Known: deployed products/known to production — known.forgekits.build

“none of that makes sense. try again. what is the root cause for why we cant insert rows into production database?”
— Zeb, correctly rejecting an unconfirmed explanation and resetting the diagnosis onto the actual, unanswered question
The bug wasn't where the fix started — July 2, 2026 · ForgeKit