mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 22:01:09 +02:00
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>
|
||
|---|---|---|
| .. | ||
| architecture | ||
| central-services | ||
| decisions | ||
| future | ||
| modules | ||
| observability | ||
| optimizable | ||
| plans | ||
| postmortems | ||
| reports | ||
| test-examples | ||
| ANALYTICS.md | ||
| APP_GAP_ANALYSIS.md | ||
| APP_ONBOARDING.md | ||
| ARCHITECTURE_MIGRATION_REPORT.md | ||
| CAPACITY_PLANNING.md | ||
| CARDS_POSTGRES_MIGRATION.md | ||
| CLOUDFLARE_DOMAINS.md | ||
| CLOUDFLARE_FALLBACK.md | ||
| CLUSTER_HARDWARE_ANALYSE.md | ||
| complexity-hotspots.md | ||
| complexity-map.html | ||
| CONTEXT_INTELLIGENCE_REPORT.md | ||
| DATABASE_MIGRATIONS.md | ||
| DEPLOYMENT.md | ||
| DEVELOPMENT_SCRIPTS.md | ||
| DEVLOG_GUIDELINES.md | ||
| DISCORD_NOTIFICATIONS_SETUP.md | ||
| DOCKER_GUIDE.md | ||
| ENVIRONMENT_VARIABLES.md | ||
| ERROR_TRACKING.md | ||
| EXPO_SDK_UPGRADE.md | ||
| EXTERNAL_SERVICES.md | ||
| EXTERNAL_SSD_OPPORTUNITIES.md | ||
| FIX_COLIMA_MOUNTS.md | ||
| GIT_WORKFLOW.md | ||
| I18N.md | ||
| LOCAL_DEVELOPMENT.md | ||
| LOCAL_LLM_MODELS.md | ||
| LOCAL_STT_MODELS.md | ||
| MAC_MINI_SERVER.md | ||
| MAIL_SERVER.md | ||
| MANA_BOX_HARDWARE.md | ||
| MANA_EARNING_SYSTEM.md | ||
| MANA_VALUES.md | ||
| MICROSERVICES_API_OVERVIEW.md | ||
| MOBILE_DESKTOP_APP_STRATEGY.md | ||
| module-coupling.md | ||
| module-health.md | ||
| MODULE_REGISTRY.md | ||
| MONETIZATION_REPORT.md | ||
| MONITORING.md | ||
| OBSERVABILITY_GAPS.md | ||
| OLLAMA_MODELS.md | ||
| PLAN_TAURI_V2.md | ||
| PORT_SCHEMA.md | ||
| POSTGRES_BACKUP.md | ||
| PRE_LAUNCH_CLEANUP.md | ||
| PROD_READINESS_SCORE.md | ||
| PROJECT_OVERVIEW.md | ||
| PWA_GUIDE.md | ||
| RECOMMENDED_SERVICES.md | ||
| REFACTORING_AUDIT_2026_04.md | ||
| SEPA_ACTIVATION_CHECKLIST.md | ||
| SETUP_TEMPLATES.md | ||
| SHARED_PACKAGES_ROADMAP.md | ||
| SYNC_BILLING_PLAN.md | ||
| TECH_STACK_INDEPENDENCE.md | ||
| TECHNOLOGY_AUDIT_2026_03.md | ||
| TESTING_DEPLOYMENT_CHECKLIST.md | ||
| URL_SCHEMA.md | ||
| USER_SETTINGS.md | ||
| VERSIONING.md | ||
| WHO_MODULE.md | ||
| WINDOWS_GPU_SERVER_SETUP.md | ||