Skip to content

fix: 8-char hex note IDs with a retroactive re-ID migration - #138

Merged
fjbarrett merged 1 commit into
mainfrom
fix/8char-note-ids
Jun 15, 2026
Merged

fix: 8-char hex note IDs with a retroactive re-ID migration#138
fjbarrett merged 1 commit into
mainfrom
fix/8char-note-ids

Conversation

@fjbarrett

Copy link
Copy Markdown
Owner

Summary

  • newId()8 lowercase hex chars (32 bits; parseInt(id, 16) → a single integer, MAC-address style, no separators).
  • Retroactive migration in ready(): re-IDs any note not matching ^[0-9a-f]{8}$ (old 12-char ids, GK-import ids) to a fresh 8-char id, moving its note_versions in the same transaction. Idempotent + resumable; a per-row failure is logged, not fatal.
  • Guest localId() and the Keep-import id are 8 hex as well (import id stays a deterministic hash slice so re-imports still dedupe).

Notes

  • /note/<id> deep links to old ids change; public share links (/p/<token>) are unaffected.

Test plan

  • Deploy → existing notes get 8-char ids; opening them works; version history intact
  • New notes get 8-char ids
  • Second boot: migration is a no-op (all ids already 8 hex)
  • tsc clean, 35 tests pass

newId() now emits 8 lowercase hex chars (32 bits; parseInt(id,16) gives a
single integer, MAC-address style). A boot-time migration re-IDs any note
that predates the convention — old 12-char ids and GK-import ids — to a
fresh 8-char id, moving its note_versions in the same transaction. It's
idempotent (no-op once all ids match ^[0-9a-f]{8}$) and resumable.

Guest localId() and the Google-Keep import id are 8 hex too; the import
id stays a deterministic hash slice so re-imports still dedupe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
keep Ready Ready Preview, Comment Jun 15, 2026 11:28pm

@fjbarrett
fjbarrett merged commit c0de8b3 into main Jun 15, 2026
1 check was pending
@fjbarrett
fjbarrett deleted the fix/8char-note-ids branch June 15, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant