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

Looks write and read through a theme key, so a release that drops the "dark:" prefix can roll safely #16807

Merged opened this

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

Merged

Looks now upsert and read through the theme key, so a later release can drop the dark: prefix without breaking an older one mid-roll. Migration: 20261130130000-look-theme-key.ts adds a unique index on (appid, env, commitoid, page, kind, theme) and leaves the old key alone.

Notes

opened this

Looks now upsert and read through the theme key, so a later release can drop the dark: prefix without breaking an older one mid-roll.

  • Migration: 20261130130000-look-theme-key.ts adds a unique index on (app_id, env, commit_oid, page, kind, theme) and leaves the old key alone. I also added its pin file under src/core/migration-pins/.
  • Write: recordLook now uses ON CONFLICT (app_id, env, commit_oid, page, kind, theme). It still writes the dark: prefix, so the old key is never violated.
  • Read: getLook matches on the theme column and accepts the page either as dark:/p or as plain /p, preferring the prefixed form. The three list functions already filtered on the theme column and decoded either form, so they needed no change. Rows filed either way read back as page /p, theme dark.
  • Tests: test/look-theme-key.test.ts covers both items from the issue.
    • A row inserted by hand as /p with theme dark reads back through getLook and the lists, and getLook returns nothing for that page in light.
    • A retake of a dark look replaces it, and the light look stays.
  • Test runs: the new tests, test/schema-additive.test.ts (unchanged), test/schema-migrations.test.ts, test/looks-pairs.test.ts and test/look-narrow.test.ts pass. tsc and gate --fix are clean.
  • One failure in test/looks.test.ts: "a real capture through the grant door, with /usr/bin/chromium" fails. It fails the same way with my change stashed. The sandbox's Chromium doesn't run, so I haven't verified it here.

I did not change the dark: write, rebuild the old key, or drop the prefix. Those are the later steps of #16263. I reused the existing stored and unstoredDark helpers and added no new function, so similar.ts had nothing to flag. There's no page, action, API route or tool change, so the commit line says No door:.

To try it, run bun test test/look-theme-key.test.ts.

Closes #16796

commented

Looks now upsert and read through the theme key, so a later release can drop the dark: prefix without breaking an older one mid-roll.

  • Migration: 20261130130000-look-theme-key.ts adds a unique index on (app_id, env, commit_oid, page, kind, theme) and leaves the old key alone. I also added its pin file under src/core/migration-pins/.
  • Write: recordLook now uses ON CONFLICT (app_id, env, commit_oid, page, kind, theme). It still writes the dark: prefix, so the old key is never violated.
  • Read: getLook matches on the theme column and accepts the page either as dark:/p or as plain /p, preferring the prefixed form. The three list functions already filtered on the theme column and decoded either form, so they needed no change. Rows filed either way read back as page /p, theme dark.
  • Tests: test/look-theme-key.test.ts covers both items from the issue.
    • A row inserted by hand as /p with theme dark reads back through getLook and the lists, and getLook returns nothing for that page in light.
    • A retake of a dark look replaces it, and the light look stays.
  • Test runs: the new tests, test/schema-additive.test.ts (unchanged), test/schema-migrations.test.ts, test/looks-pairs.test.ts and test/look-narrow.test.ts pass. tsc and gate --fix are clean.
  • One failure in test/looks.test.ts: "a real capture through the grant door, with /usr/bin/chromium" fails. It fails the same way with my change stashed. The sandbox's Chromium doesn't run, so I haven't verified it here.

I did not change the dark: write, rebuild the old key, or drop the prefix. Those are the later steps of #16263. I reused the existing stored and unstoredDark helpers and added no new function, so similar.ts had nothing to flag. There's no page, action, API route or tool change, so the commit line says No door:.

To try it, run bun test test/look-theme-key.test.ts.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs