Skip to content

refactor(app): migrate packages/app/src/utils/id.ts off the legacy 0x1000-shifted 48-bit encoding #271

Description

@LeXwDeX

Tracked from the v1.0.13 release notes (PR #268); discovered during the msgid wrap fix (PR #265).

Symptom

packages/app/src/utils/id.ts still uses the legacy identifier encoding (ts*0x1000 + counter into a 48-bit prefix). The same encoding wrapped on 2026-08-14 19:19:55 +08 in the core packages (PR #265 fixed schema/opencode/core generators to raw-48-bit-ms with a monotonic latch). The app-side copy is internally self-consistent (create+timestamp round-trip), so it degrades only lexicographic ordering assumptions — but every behavior-gating comparison in the server is already time.created-based, so the residual risk is display-only ordering plus generator drift between app and core.

Fix direction

  • Migrate the app-side generator to the shared fixed implementation (@opencode-ai/schema/identifier or a re-export), preserving the app package's public API shape.
  • Check the desktop/e2e surfaces for persisted ids that decode with the old scheme (timestamp() callers) and confirm no live consumer depends on the old arithmetic.
  • Add the wrap-boundary + latch tests mirroring packages/schema/test/identifier.test.ts (7 tests) at the app boundary, or point app tests at the shared suite.

Acceptance

  • No 0x1000 arithmetic remains under packages/app (rg '0x1000' packages/app clean).
  • App ids sort consistently with core ids for the same wall-clock time (spot-check by prefix).
  • Typecheck + app/desktop test gates green; no snapshot churn beyond id-format updates.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions