mana-swift-event-sync/CLAUDE.md
Till JS 397021a4fb mana statt »e.V.«: Schweizer Verein (kein Store-Release, nur Quelltext-Korrektur)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 20:32:28 +02:00

1.8 KiB
Raw Permalink Blame History

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-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:

  1. 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.
  2. 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.
  3. Identität in der Engine. attributedToUserId/actor werden in makeEnvelope gestempelt — anonym (anon:<id>) oder echt (JWT-sub). Apps rufen kein currentUserId() mehr.
  4. Anonyme Events bleiben lokal. Push/Pull/WS sind aus, bis signIn(realUserId) re-taggt + drained. Server akzeptiert nur JWT-validierte Pushes.
  5. Keine 3rd-Party-Dependencies (Compliance). Nur Foundation, SwiftData, CryptoKit, OSLog + ManaCore.
  6. Public API ist Sendable/Swift-6-Concurrency-sauber.

Konventionen

  • 4-Space-Indent, 120-col (.swiftformat/.swiftlint.yml aus mana-swift-core)
  • DE als Primary-Locale, Doc-Comments (///) auf jedem public-Symbol
  • CHANGELOG.md pflicht, Semver strikt, Git-Tag pro Sinn-Abschnitt

Lokal

swift build
swift test