managarten/packages/shared-ui/src
Till JS 6bb9d77be9 feat(sync): F3 — drop updatedAt as a synced data field
Removes `updatedAt` from the wire protocol and from every Local-prefixed
record type. Replaced by two orthogonal mechanisms — deriveUpdatedAt()
for read-side public-facing values, _updatedAtIndex shadow for indexed
sorts.

Local-side:
- New `_updatedAtIndex` shadow column. Stamped by the Dexie creating /
  updating hook on every write. Stripped from the pending-change payload
  so it never travels to mana-sync. Indexed in Dexie v53 on the 22 tables
  that previously indexed `updatedAt`.
- `deriveUpdatedAt(record)` in sync.ts returns max(__fieldMeta[*].at) so
  the public-facing Task / Note / etc. shape keeps an `updatedAt: string`
  property without holding it as data.
- Type-converters across ~60 module/queries.ts and types.ts files now
  call `deriveUpdatedAt(local)` instead of reading `local.updatedAt`.

Module-store sweep:
- Regex codemod removed `updatedAt: new Date().toISOString()` /
  `: now` / `: now()` / `: nowIso()` stamping from 121 store files
  (~382 call sites total). Single-property update calls
  (`{ updatedAt: now }`) collapsed to `{}`; touch-only patterns
  (writing/drafts, writing/generations) kept the call as a no-op
  because the hook now stamps `_updatedAtIndex` automatically on
  any Dexie modification.
- Local* interfaces stripped of `updatedAt: string` (43 types.ts files).
  Public-facing types (Task, Note, Mission, Agent, …) keep
  `updatedAt: string` as a computed read-side property.
- Companion's chat conversation now sorts on a real
  `lastMessageAt` data field instead of touching `updatedAt`.
- Session-only stores (times/session-alarms, session-countdown-timers)
  stamp `updatedAt: now` directly because they're not in Dexie and
  have no field-meta layer to derive from.

Sync engine:
- applyServerChanges sets `_updatedAtIndex` itself when applying
  server changes (max of server-field times for updates, recordTime
  for inserts) so server-replays land orderable.
- Dropped the legacy `localUpdatedAt` fallback — every record now has
  `__fieldMeta`, the per-field at is the canonical source.
- Soft-delete tombstone path stops stamping `updatedAt: serverTime`,
  uses `_updatedAtIndex` instead.

Server-side:
- mana-ai iteration-writer no longer emits `updatedAt` in
  sync_changes.data; receivers derive it from the field-meta map.
- mana-sync types: no change (the wire format already uses
  `field_meta` / `at` from F1).

Out of scope: backend Drizzle schemas (mana-credits, mana-events, …)
keep their `updated_at` columns. Those are pure server-internal — not
part of the sync_changes / __fieldMeta mechanism F3 cleans up.

Tests + checks:
- 0 svelte-check errors over 7652 files.
- 29/29 sync.test.ts (vitest).
- 61 mana-ai bun tests.
- mana-sync go test ./... cached green.

Plan: docs/plans/sync-field-meta-overhaul.md F3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 23:12:22 +02:00
..
actions feat(shared-ui): add focusTrap action and apply to shared Modal 2026-03-24 10:04:04 +01:00
atoms feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
bottom-stack fix(mana,ui): integrate guest nudge into bottom stack + theme it 2026-04-08 12:13:05 +02:00
charts refactor(theme): migrate shared packages to --color-* token naming 2026-04-15 22:11:42 +02:00
components feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
context-menu fix(mana/web+packages): clear all 270 warnings to zero 2026-04-10 17:34:49 +02:00
dnd feat(sync): F3 — drop updatedAt as a synced data field 2026-04-26 23:12:22 +02:00
help fix(mana/web+packages): clear all 270 warnings to zero 2026-04-10 17:34:49 +02:00
molecules refactor(theme): migrate shared packages to --color-* token naming 2026-04-15 22:11:42 +02:00
navigation feat(pill-nav): show Anmelden pill for guests next to menu icon 2026-04-23 15:36:09 +02:00
onboarding fix: dev startup — Redis eviction policy, mana-media port crash, Svelte warnings 2026-04-10 18:33:41 +02:00
organisms refactor(theme): migrate shared packages to --color-* token naming 2026-04-15 22:11:42 +02:00
pages refactor(theme): migrate shared packages to --color-* token naming 2026-04-15 22:11:42 +02:00
quick-input refactor(shared-ui): extract search-core for highlight + debounce 2026-04-15 01:06:37 +02:00
search-core refactor(arcade, shared-ui): migrate CommandBar to GlobalSpotlight, delete CommandBar 2026-04-15 01:17:55 +02:00
settings refactor(theme): migrate shared packages to --color-* token naming 2026-04-15 22:11:42 +02:00
test feat(shared-ui): add TagChip component and tag component tests 2026-04-02 14:24:19 +02:00
toast feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
index.ts refactor(arcade, shared-ui): migrate CommandBar to GlobalSpotlight, delete CommandBar 2026-04-15 01:17:55 +02:00