docs(ai): mark Step 8 (mana-sync actor field) done; document sync_changes.actor

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-14 23:37:55 +02:00
parent 5922abbbd8
commit 5c53c6d02e
2 changed files with 13 additions and 2 deletions

View file

@ -1781,7 +1781,14 @@ Code:
- Filter: Mission (per query-string) + Modul (dropdown), Deep-Link ins
Modul pro Event
- [x] Schritt 7a — System-Actor-Wrapping für Projections (streaks-Tracker)
- [ ] Schritt 8 — mana-sync Go + Postgres-Migration für `actor`-Feld
- [x] Schritt 8 — mana-sync Go + Postgres-Migration für `actor`-Feld
- `sync_changes.actor JSONB` Column (idempotent `ADD COLUMN IF NOT EXISTS`)
- `Change.Actor json.RawMessage` Wire-Shape, opaque Server-seitig
- `RecordChange` + alle drei SELECT-Pfade (GetChangesSince / GetAll /
StreamAllUserChanges) lesen/schreiben Actor
- Webapp-Parität: `SyncChange.actor?` + Push-Payload + `applyServerChanges`
stempelt `__lastActor` + `__fieldActors` aus eingehenden Changes
→ **cross-device Attribution geschlossen**
- [ ] Schritt 9 — Server-side `mana-ai` Bun-Service (offline-of-tab Runs)
### 20.5a Symmetrische Registries: Resolver vs. Indexer

View file

@ -172,10 +172,14 @@ sync_changes (
data JSONB,
field_timestamps JSONB DEFAULT '{}',
client_id TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT now()
created_at TIMESTAMPTZ DEFAULT now(),
schema_version INT NOT NULL DEFAULT 1,
actor JSONB -- AI Workbench attribution: { kind: user|ai|system, ... }
)
```
**`actor` column (2026-04-14)**: Opaque JSON blob the webapp stamps on every change to distinguish user writes from autonomous AI writes and derived subsystem writes. Server does NOT parse the shape — just persists + re-emits. Pre-actor clients omit the field; the column is nullable. See `apps/mana/apps/web/src/lib/data/events/actor.ts` for the discriminated union + `COMPANION_BRAIN_ARCHITECTURE.md §20` for the full pipeline.
Indexes: `(user_id, app_id, created_at)`, `(table_name, record_id, created_at)`, `(user_id, app_id, table_name, created_at)`
## Configuration