Public: anyone can read this; the crew can change it.

Production answers every page again: a database made before the Profile line gets its missing column, and a test fails when a migration is inserted anywhere but the end #148

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Databases made before #138 now get their missing `profile.line` column, so production pages should stop returning 500. I haven't booted the app against an old database or checked production `/`. `bun test` on `src/migrations.test.ts`, `src/db.test.ts` and `src/profile.test.ts` passes. I did not run the whole suite or `bun x tsc --noEmit`: the repository has no `tsconfig.json`, so `tsc` has nothing…

shipped production is serving it deploy d2eada7

opened this

Databases made before #138 now get their missing profile.line column, so production pages should stop returning 500. I haven't booted the app against an old database or checked production /. bun test on src/migrations.test.ts, src/db.test.ts and src/profile.test.ts passes. I did not run the whole suite or bun x tsc --noEmit: the repository has no tsconfig.json, so tsc has nothing to check. The repository has no scripts/gate.ts, and docs/VISION.md doesn't exist.

What changed

  • The fix: src/db.ts gets one new migration at the very end: ALTER TABLE profile ADD COLUMN line …. No earlier entry is touched, so production's recorded version still lines up with the current positions. On a database that already has the column, migrate() skips the error as a duplicate. #142's commission-rate column already sits at the end, so #142 will need to append after this entry.
  • Append-only rule: The comment above migrations now says the list is append-only.
  • Pinned list: src/migrations.pin.json holds a SHA-256 for each migration by position. The first test in src/migrations.test.ts fails if an entry is edited, removed, moved or inserted before the tail. A later pull adds its own hash at the end of that file.
  • Pre-#138 test: The second test builds a database from the list as it stood before #138, with a saved profile row. It then runs migrate and agentOf and expects the column to exist and the agent to read back. With the src/db.ts change stashed, both tests fail.

Not done

  • Pre-#138 list: The test rebuilds it by filtering the profile-line and commission-rate entries out of today's list, rather than keeping a frozen copy of the old SQL. It reproduces the same version skew.
  • Old-build boot: I didn't boot d1c375c and then HEAD as the issue describes.

To try it

  • Run bun test src/migrations.test.ts.
  • After the merge, check that / on production returns 200.

🤖 Generated with Claude Code

Closes #146

commented

Databases made before #138 now get their missing profile.line column, so production pages should stop returning 500. I haven't booted the app against an old database or checked production /. bun test on src/migrations.test.ts, src/db.test.ts and src/profile.test.ts passes. I did not run the whole suite or bun x tsc --noEmit: the repository has no tsconfig.json, so tsc has nothing to check. The repository has no scripts/gate.ts, and docs/VISION.md doesn't exist.

What changed

  • The fix: src/db.ts gets one new migration at the very end: ALTER TABLE profile ADD COLUMN line …. No earlier entry is touched, so production's recorded version still lines up with the current positions. On a database that already has the column, migrate() skips the error as a duplicate. #142's commission-rate column already sits at the end, so #142 will need to append after this entry.
  • Append-only rule: The comment above migrations now says the list is append-only.
  • Pinned list: src/migrations.pin.json holds a SHA-256 for each migration by position. The first test in src/migrations.test.ts fails if an entry is edited, removed, moved or inserted before the tail. A later pull adds its own hash at the end of that file.
  • Pre-#138 test: The second test builds a database from the list as it stood before #138, with a saved profile row. It then runs migrate and agentOf and expects the column to exist and the agent to read back. With the src/db.ts change stashed, both tests fail.

Not done

  • Pre-#138 list: The test rebuilds it by filtering the profile-line and commission-rate entries out of today's list, rather than keeping a frozen copy of the old SQL. It reproduces the same version skew.
  • Old-build boot: I didn't boot d1c375c and then HEAD as the issue describes.

To try it

  • Run bun test src/migrations.test.ts.
  • After the merge, check that / on production returns 200.

🤖 Generated with Claude Code

commented

The preview failure is fixed. The design lint read "#138" in my new migration comment as a raw hex colour, so the test "the app spells out no colour but in its tokens" failed. I reworded the comment in src/db.ts and pushed. src/design.test.ts and src/migrations.test.ts now pass (7 tests); I didn't re-run the full suite here, so the forge's check on this push is the real confirmation.

Comments aren't hashed, so src/migrations.pin.json is unchanged and still pins every migration by position.

What changed (whole pull)

  • The fix: src/db.ts gets one new migration at the end, ALTER TABLE profile ADD COLUMN line …. No earlier entry is touched. A database that already has the column skips it as a duplicate. The comment above migrations now says the list is append-only.
  • Pin and tests: src/migrations.pin.json holds a SHA-256 per position, and src/migrations.test.ts fails if an entry is edited, removed, moved or inserted before the tail. A second test builds a database from the list as it stood before the Profile line, with a saved profile row, then runs migrate and agentOf. It fails on main today.

Not done

  • The pre-Profile-line list is rebuilt by filtering today's list, not kept as a frozen copy of the old SQL.
  • I didn't boot d1c375c and then HEAD against the same directory.
  • There is no tsconfig.json, so tsc --noEmit has nothing to check.
  • Production / returning 200 after the merge is unchecked.

To try it

  • Run bun test src/migrations.test.ts.
  • #142 (commission rate) must append after this entry and add its hash to the pin file.

🤖 Generated with Claude Code

Approved

Clean. One migration appended at the tail; duplicate-column tolerance in migrate() covers databases that already have the column. The pin file hashes every entry by position and the test fails on edit, removal, move or mid-list insert. The pre-Profile-line test reproduces the version skew (the filtered list is shorter, so migrate runs the last two entries) and reads the agent. Preview / answers 200. Production / after merge cannot be verified from here.

commented

Left #146 open: 2 unticked items remain (A test fails when an existing migration is edited, removed or moved, or a new one is inserted anywhere but the end. For example, the test pins each existing entry by index (a checksum per position kept in the repository), so a later pull can only add at the tail. The comment above migrations says the list is append-only.; Production / answers 200 after the merge.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs