mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-05 11:15:01 +03:00
Remove eight duplicated or defensive code paths across affine-store, affine-client, affine-mobile, and the web, iOS, and Android hosts: - Remove explicit create recovery journals in store and client, and require WorkspaceDb::from_root_update_v1 to receive initial db$* tables at construction time instead of returning DbTableNotResolved. - Consolidate auth protocol parsing, url::Url canonicalization, legacy_storage_endpoint_key (unbracketed IPv6 for 0.27.5 storage keys), chrono RFC3339 UTC Z normalization, Bearer checks, and permanent error codes into affine_store::auth while keeping iOS and Android 0.27.5 storage formats. - Replace the duplicated legacy storage engine in affine-ios-host with affine-legacy-import, preserve malformed affine-local-workspace raw strings in one place, propagate iOS write-back serialization errors, delegate Android sentinel evaluation and probe filtering to Rust via a single JNI entry, and remove hardcoded Swift and Kotlin key lists. - Remove the pure JS Yjs v1 decoder from hosts/web/src/idb-storage.js, expose a safe Rust wasm-codec cdylib from affine-store reusing merge_crdt_updates_v1, share a strict wasm-scalar-rpc.js loader with preview workers, wire crdt-wasm-client through index.html, worker-loader, host.js, stage-preview-workers, CI, and real-browser IDB E2E, and migrate real Yjs v1 fixtures to affine-store tests. - Remove the 12-iteration blind SQLite retry loop in sqlite/doc.rs while preserving single-row empty-update registration. - Upgrade SqliteDocStorage::checkpoint_passive to return WAL counts and remove duplicate maintenance pools from iOS and Android hosts. - Remove top-level mirrored workspace fields and workspace-switch cloning in MobileAppState, and use generate_key_between for ordering. - Remove pixel-fallback selection drag paths in iOS and Android hosts so text-layout endpoints remain the single drag authority.
1.2 KiB
1.2 KiB
Working in packages/frontend/client/ (for agents)
packages/frontend/client/ (affine-client) is the L3 device-neutral client domain crate shared by Mobile, Desktop, and Web hosts.
This crate belongs to the client Cargo workspace rooted at packages/frontend/Cargo.toml.
Domain boundaries and invariants
- Keep
#![forbid(unsafe_code)]at the crate root. - Remain strictly device-neutral: never import
ui::Window, view elements, or mobile-only shell concepts. - Enforce
F3: onlyHostKind::Nativeallows adding cross-origin self-hosted servers;HostKind::Webrejects self-hosted server addition. - Keep
StoreBackedDocDirectory(WorkspaceDocDirectoryimplementation) aligned with the root-registration and anti-resurrection invariants (F1): persistroot_registeredimmediately upon root write success, support in-sessionintent_ididempotent replay, and returnErr(DirectoryError::NotFound)on replaying deleted intents. - Keep
PlatformAccessibilityactive in production (non-harness) builds so Web, iOS, and Android hosts can consume a stable first-frame semantic root. - Keep every
.rsfile at or below 800 non-test lines, zerosuper::super::, and zero system wall-clock calls.