Files
SubMiner/backlog/tasks/task-288 - Stabilize-immersion-tracker-CI-timestamp-handling-under-libsql-Bun.md

2.2 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies
id title status assignee created_date updated_date labels dependencies
TASK-288 Stabilize immersion-tracker CI timestamp handling under libsql/Bun Done
2026-04-11 21:34 2026-04-11 21:43
bug
ci
immersion-tracker

Description

bun run test:fast is currently failing because large millisecond timestamps are not handled safely through the libsql/Bun path. Fix timestamp parsing/storage so lifetime/library and session-event queries return correct wall-clock values in CI and runtime.

Acceptance Criteria

  • #1 Large wall-clock timestamps round-trip correctly through immersion-tracker lifetime/library queries under the repo's Bun/libsql runtime.
  • #2 Session-event timestamps round-trip correctly for real wall-clock values used by runtime event inserts.
  • #3 Targeted immersion-tracker regression coverage passes, and the previously failing test:fast lane no longer fails on these timestamp assertions.

Implementation Notes

Root cause split in two places: Bun/libsql corrupts large millisecond timestamp strings when coerced through Number(...), and imm_session_events.ts_ms being INTEGER let runtime event inserts/readbacks return -2147483648 on CI/runtime.

Fix shipped by parsing timestamp strings without the broken Number(largeString) path, migrating imm_session_events.ts_ms to TEXT, ordering/retention queries via CAST(ts_ms AS REAL), and avoiding Number(currentMs) when reusing already-normalized timestamp strings.

Added regression coverage for both real runtime event inserts and schema migration/repair of previously truncated session-event rows.

Final Summary

Fixed immersion-tracker timestamp handling under Bun/libsql so large wall-clock millisecond values survive runtime writes, query reads, and schema migration. bun run test:fast, bun run typecheck, bun run test:env, bun run build, bun run test:smoke:dist, and bun run changelog:lint all pass after the patch.