docs(sync): close Punkt 5 audit — backend updated_at columns are not sync orphans

Survey of all 17 backend Drizzle schemas (mana-mail/-media/-auth/
-analytics/-research/-events/-subscriptions/-credits + apps/api/
{unlisted,website,traces,presi,todo}):

- 3 columns are actively read by service code:
  - research.providerConfigs.updatedAt — explicit write + DTO field
  - unlisted.snapshots.updatedAt — read in public response
  - website.customDomains.updatedAt — read in DNS-status response
- 14 columns are AUTO-ONLY: Drizzle stamps them via defaultNow() /
  $onUpdate(), no service code reads them.

But the AUTO-ONLY columns are NOT sync-orphans — they're standard
Drizzle audit-timestamp convention, useful for Postgres-level forensics
(`ORDER BY updated_at DESC` to find recently-modified rows during
debugging). F3's plan note ("pure server-internal columns, not touched")
correctly identified them. No cleanup is needed.

Closing the audit item with rationale documented in
docs/plans/sync-field-meta-overhaul.md and DATA_LAYER_AUDIT.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-27 01:47:41 +02:00
parent 81f1056b4a
commit 421a49a2a8
2 changed files with 3 additions and 1 deletions

View file

@ -208,6 +208,7 @@ Sieben Phasen, die vier strukturelle Bugs in der Conflict-Detection abgeräumt h
- **F3-fu (v55 cleanup)** (_pending_) Dexie v55 row-rewrite: löscht den Orphan-`updatedAt`-Wert aus jedem Row in `Object.keys(TABLE_TO_APP)`. v53 hatte ihn bewusst stehengelassen (Comment "next-version upgrade can drop it"); nach F3+F5 liest niemand mehr `row.updatedAt`, also pure waste. Idempotent — rows ohne das Feld sind ein no-op.
- **F4-robust (Endpoint)** (_pending_) Bootstrap-Funktionen idempotent (existence-check) + expliziter Endpoint `POST /api/v1/me/bootstrap-singletons`. Webapp callt ihn auf Boot vor `createUnifiedSync`. Signup-Hooks bleiben als happy-path; Endpoint ist Reconciliation belt-and-suspenders, sodass eine transient mana_sync-Outage beim Signup nicht den User mit `getOrCreateLocalDoc()`-Race auf erstem Write strandet.
- **F4-fu (Fallback-Origin)** (_pending_) `getOrCreateLocalDoc()` in userContextStore + kontextStore in `runAsAsync(SYSTEM_BOOTSTRAP)` gewrappt — Insert stempelt jetzt `origin='system'` statt `origin='user'`, strukturell äquivalent zum Server-Bootstrap. Neue Konstante `SYSTEM_BOOTSTRAP` in `@mana/shared-ai`. Race-Window-Fallback bleibt notwendig (sonst Silent-Loss via `update(missing-id, diff)`), aber ist jetzt nicht mehr semantisch fragwürdig.
- **Backend `updated_at` audit** (_closed_) Survey aller 17 Drizzle-Schemas in services + apps/api: 3 von 17 Spalten werden aktiv gelesen (research/unlisted/website), 14 sind reine `defaultNow()`/`$onUpdate()`-Audit-Zeitstempel ohne Service-Reads. Kein Cleanup nötig — diese Spalten stammen nicht aus dem alten Sync, sie sind Postgres-Level-Forensik via Standard-Drizzle-Convention. F3's "pure server-internal" Klassifikation bestätigt.
Die vier Bug-Wurzeln (siehe ursprüngliche Diagnose 2026-04-26):