Extrahiert die zuvor zweimal von Hand gebaute Plumbing aus pageta-native + nutriphi-native in ein Paket ManaEventSync (Counterpart zu @mana/event-sync): - Core: EventEnvelope (+clientId/payloadHash), JSONValue, ULID, JWTSubject, EventSyncError - EventStorage (SwiftData): parametrierbar (Store/App-Group/additionalModels/In-Memory), Outbox, Claim-Reattribute, Anonymous-Retention-Prune - Transport: SyncHTTPClient (+X-Schema-Hash/422), optionaler SyncWSClient - Crypto: CryptoProvider/NoOp/MasterKey (AES-GCM enc:1:), VaultClient — opt-in - EventSyncEngine: besitzt die Identität (makeEnvelope anon/echt), emit offline, signIn(realUserId) re-taggt idempotent + drained, Retention 10k/90d 18 Tests grün. Plan: mana/docs/playbooks/MANA_SWIFT_EVENT_SYNC.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.8 KiB
1.8 KiB
CLAUDE.md — mana-swift-event-sync
Guidance für Claude Code in diesem Repo.
Übergeordneter Plan:
../mana/docs/playbooks/MANA_SWIFT_EVENT_SYNC.md(Phasen E-4.0–E-4.6). Plattform-SOT:../mana/docs/MANA_SWIFT.md.
Was dieses Repo ist
ManaEventSync — geteilte Event-Sourcing-Sync-Library für alle nativen
mana-e.V.-Apps. Nativer Counterpart zu @mana/event-sync (TS). Spiegelt
dessen Wire-Format + Anonymous-Mode/Claim. Konsumiert ManaCore
(AuthClient) aus ../mana-swift-core.
Architektonische Invarianten
Nicht ohne explizite Diskussion antasten:
- Nur Plattform-Plumbing, keine App-Domäne. Payload-Typen, State-Projektionen, Reducer und Repository-API leben in der App, nicht hier. Diese Lib weiß nichts über Articles, Meals, Decks.
- Wire-Parität zu
@mana/event-sync+mana-sync. Envelope-Felder,enc:1:-Crypto,X-Schema-Hash, Endpoints, Idempotency,attributedToUserId == JWT.sub-Grenze. Bei Drift gewinnt der Server. - Identität in der Engine.
attributedToUserId/actorwerden inmakeEnvelopegestempelt — anonym (anon:<id>) oder echt (JWT-sub). Apps rufen keincurrentUserId()mehr. - Anonyme Events bleiben lokal. Push/Pull/WS sind aus, bis
signIn(realUserId)re-taggt + drained. Server akzeptiert nur JWT-validierte Pushes. - Keine 3rd-Party-Dependencies (Compliance). Nur Foundation,
SwiftData, CryptoKit, OSLog +
ManaCore. - Public API ist
Sendable/Swift-6-Concurrency-sauber.
Konventionen
- 4-Space-Indent, 120-col (
.swiftformat/.swiftlint.ymlaus mana-swift-core) - DE als Primary-Locale, Doc-Comments (
///) auf jedempublic-Symbol - CHANGELOG.md pflicht, Semver strikt, Git-Tag pro Sinn-Abschnitt
Lokal
swift build
swift test