Commit Graph
7416 Commits
Author SHA1 Message Date
DarkSky a6bb03e702 feat(editor): restore 0.27.5 mobile keyboard toolbar, native previews, and fold CRDT codecs 2026-11-27 08:18:25 +09:00
DarkSky 531da7466d feat(editor): add S3 rich blocks, live CRDT table cells, and mobile input
Add the S3 PageEditor stack on top of darksky/np/mobile:

- Read and render seven rich block kinds (callout, table, attachment,
  LaTeX, embed linked doc, embed synced doc, and surface ref) with pure
  Rust RaTeX math layout, syntax highlighting, Hayro PDF previews, and
  shared premultiplied RGBA-to-BGRA conversion via ui::swap_rgba_pa_to_bgra.
- Replace offline table cell string diffing and the conflict popover
  with direct in-place Y.Text CRDT splicing, O(1) read_table_block with
  zero-clone replacement, split_delta preedit, and RichParagraph cells.
- Share insertion_marks_at across paragraphs, table cells, surface
  elements, and block titles via single-delta splice_live_text; share
  AnchoredInlineInput and finish_inline_targets across table cells and
  Edgeless labels with unselected root-input suppression and same-target
  preedit commit on pointer press.
- Land mobile keyboard toolbar with 0.27.5 @blocksuite/icons tokens,
  bidi selection, touch gestures, native web clipboard paste, shared
  HTML/Markdown slice builders, and host-layer Emoji font registration.
2026-11-27 06:55:48 +09:00
DarkSky 65a2c9b097 refactor(mobile): remove duplicated logic across store and hosts
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.
2026-11-27 06:55:48 +09:00
DarkSky b21a21e30e fix(mobile): polish breadcrumb switcher, blank page placeholders, and delete confirmation sheet
Keep multi-location breadcrumb switcher chips visible with their dropdown chevron across narrow viewports and locales. Preserve the location count suffix while truncating only the owner document title.

Render high-contrast muted placeholders on blank documents using static empty-state copy, keep primary text color for non-empty body previews, and keep display titles in lists, breadcrumbs, trash pages, and accessibility landmarks.

Remove the ambiguous Done button from the permanent delete confirmation sheet in both the view and the accessibility tree.
2026-11-27 06:55:48 +09:00
DarkSky b708c59897 feat(mobile-web): localize canvas selection menu and mirror RTL layout
Localize the canvas-drawn mobile selection menu across English, Simplified
Chinese, Traditional Chinese, and Arabic, including BCP-47 extension subtags.
Preserve html lang="en" for boot-skeleton accessibility while reading host and
global-cache:i18n_lng preferences, guarding blocked localStorage reads while
enforcing writable storage on persistence writes, and forwarding browser locale
fallbacks. Allocate button widths with a 44px touch floor on narrow viewports
and mirror menu order and hit-testing for Arabic RTL.
2026-11-27 06:55:48 +09:00
DarkSky 1bf1a4e31d feat(mobile): finish shell parity and layout fixes
Update mobile shell screens across Home, Explorer, Journals,
Settings, and Trash document pages.

- Explorer and navigation: show active documents in the All Docs root
  with wheel and native touch scroll, and keep the bottom tab bar
  fixed. Scroll Collections and Tags lists, restore scroll on back
  navigation, and add screen-reader scroll actions.

- Scoped actions and Trash: encode workspace and document IDs with a
  byte-length prefix to stop dot collisions, and require confirmation
  before permanent delete. Purge matching history entries with
  NavHistory::remove_target, replay outgoing edges on restore, and
  show a document-not-found state for missing pages.

- Journals and Settings: wrap the 7-day strip into two rows below
  364pt and use a compact landscape layout below 460pt so every day
  pill and CTA reaches 44x44pt. Separate read-only settings rows from
  toggle and cycle controls without chevrons, and use localized
  untitled titles in main landmarks and backlinks.

- Harness and tests: cover Journals and Trash in audit-matrix with
  width and height touch-target checks. Add touch, scroll, collision,
  and accessibility parity tests alongside matching gallery captures.
2026-11-27 06:55:48 +09:00
DarkSky e88ee8e9fe feat(web): add GPU recovery, canvas selection menu, lazy PDF client, and zero-3p-JS gate
Add WebGL2 context loss recovery, epoch-guarded async restore, single-flight fallback locking, and WebGPU canvas compositing to the Web Mobile host.
Flush pending IndexedDB writes before legacy shell navigation and recreate a visible retry banner on flush failure.

Add canvas-drawn selection highlights, teardrop handles, pointerup action triggers, and selection-guarded clipboard actions.
Add a lazy hayro PDF worker client with crash recovery, clamped scale rendering, transfer-safe deduplication, and asset root pinning.
Add a static zero-third-party-JS gate script and wire both web host gates into mobile CI.
2026-11-27 06:55:48 +09:00
DarkSky 9a3195bf81 feat(mobile): add S3 mobile shell, breadcrumb engine, and outbound doc refs
Implement the S3-Shell deliverables across L1 to L4:
- Add read-only outbound document reference extraction in `blocksuite/crates/doc/src/refs.rs` with zero-writeback tests.
- Add baked keyframe micro-icons, domain-neutral Breadcrumb layout, and RTL mirror tests in `packages/ui/kit`.
- Add sanitized FolderForest caching, NavHistory with 128-entry cap, pure breadcrumb derivation, and LinkGraph backlinks in `packages/frontend/client`.
- Add `affine-mobile` with interactive 4-TabBar routes, 10-section Settings, Location and Trail sheet, and `mobile-harness`.
2026-11-27 06:55:48 +09:00
DarkSky 71697c42ce feat(android): add StaticLayout selection gestures and Autofill buffer isolation
Implement Android host selection, Autofill isolation, surface lifecycle, predictive back, and PDF rendering in packages/frontend/hosts/android.

- Keep ShapedTextLayout as the single layout source across drag, cancel, and selectAll in SelectionGestureController.
- Anchor vertical grab offsets to line midpoints and flip active_drag across the locked UTF-16 anchor.
- Disambiguate mixed-direction run boundaries and orient same-line teardrop handles outward.

- Route Autofill focus, exit, resize, and route changes through HostDocumentBufferController to keep form values separate.
- Clear the default surface to 0xFFFA_FAFC with luminance-adaptive text colors.
- Check ClipDescription metadata in AndroidClipboardAdapter.hasPlainText and cache paste state outside onDraw.
- Add 26 Rust unit tests and 22 Kotlin JNI parity sequences.
2026-11-27 06:55:48 +09:00
DarkSky 5fc9486baf feat(ios): add native selection handles, keyboard avoidance, PDFKit renderer, and haptics
Add the native UIKit and PDFKit bridges in `packages/frontend/hosts/ios/`:

- Add teardrop selection handles, UTF-16 anchor drag probing, keyboard occlusion hiding, and loupe layout in `src/selection.rs` and `Sources/SelectionOverlayView.swift`.
- Add CoreText `CTTypesetter`, `CTLine`, and `CTRun` glyph-slot selection rects, BiDi endpoint carets, preferred-offset hit testing, and loupe drawing in `Sources/TextRenderingBridge.swift`, `src/ffi_text.rs`, and `src/text_layout.rs`.
- Add `UITextInput`, `HostTextPreviewView`, light canvas `#FAFAFC` clear color, rotation sync, and `UIEditMenuInteraction` wiring in `Sources/MetalHostViewController.swift`.
- Add per-frame keyboard avoidance in `src/keyboard_insets.rs` and `Sources/KeyboardAvoidanceCoordinator.swift` aligned with `ui::WindowInsets::effective()`.
- Add system `PDFKit` page rasterization in `src/pdf.rs` and `Sources/PdfRendererBridge.swift` with `.cropBox` rotation sizing and explicit document handles.
- Add UIKit haptics in `src/haptics.rs` and `Sources/HapticsBridge.swift`, `tests/IosHostS3SmokeTest.swift`, and `AGENTS.md`.
2026-11-27 06:55:48 +09:00
DarkSky 8c49b3922a fix(web): isolate in-flight OTP send state and per-email cooldown on Back
Scope OTP send busy state and Turnstile resets to the active email and step
epoch, and record the 60-second resend deadline when an in-flight request
succeeds after clicking Back.
2026-11-27 06:55:48 +09:00
DarkSky 0036df69b5 fix(frontend): close S2.1 parity gaps across editor, web, and CI
Close the S2.1 parity and review items across the editor, web host,
and CI workflows.

- Add affine:latex block layout and the equation editor popover.
- Support Space and Enter triggers, inline rendering, click-to-edit
  chips, IME commit on Done, and Web slash copy.
- Guard open equations with zero-width CRDT identity checks and skip
  writes when closing an unchanged equation.

- Align web sign-in OTP validation, resend state, anti-reentry,
  cross-Back cooldown, preflight races, and initial OTP errors.
- Align step-bound email submit, deployment Terms display, and native
  Chromium discovery in verify-idb-real-browser.

- Key WebTextSystem Canvas fallback descriptors by logical font ID so
  static single-face fonts preserve requested weights.
- Keep Release LTO active for s1-probes-bench in np-mobile.yml.
2026-11-27 06:55:48 +09:00
DarkSky 7fb559c89f fix(frontend): close S2 post-review edge cases across web, client, ios, and android
Address edge cases identified during the S2 review rounds:

- Make `extractYjsV1SubdocEntries` iterative on `origin` chains, binary-search
  merged `DeleteSet` ranges, require the trailing `DeleteSet` count on every
  update, and resolve concurrent `Y.Map` writes deterministically via YATA
  sibling ordering.
- Clear stale password and OTP inputs when returning to the email step in
  `sign-in.js`, run `/api/auth/preflight` on every email-step submit, and
  clarify the status message when email login is disabled while OAuth remains
  available.
- Guard `is_valid_rfc3339` against non-ASCII slices and invalid calendar days,
  enforce `1..=86400` `expiresIn` and non-empty token invariants in
  `StoredAuthTokenPair`, make `AuthController::load_stored_credentials`
  read-only on `HostBridge`, and add epoch-fenced session response helpers.
- Preserve same-ID `affine-cloud` `last_workspace_id` entries when removing a
  local workspace in `HostBootstrapCoordinator.swift` and `legacy_storage.rs`.
- Persist `auth-refresh-attempt:<endpoint>` digests across Android process
  restarts, preserve `FreshInstall` state across rollback write-back, surface
  legacy `affine.preferences_pb` cleanup failures from `deleteSession`, remove
  test-only JNI exports from `NativeBridge`, and gate `touch_dispatch.rs` on
  `#![cfg(feature = "harness")]`.
2026-11-27 06:55:48 +09:00
DarkSky 698c268e3a feat(android-host): implement S2 Android surface, SQLite co-storage, and auth bridge
Upgrade the thin Android host from S1 to S2 across four areas:

- Present real pixel frames via NDK EGL/GLES3 (`glClear` + `eglSwapBuffers`)
  with automatic `EGLSurface` teardown and `CpuFallback` downgrade when EGL
  is unavailable, retaining `pending_frame` on failure until a frame presents.
  Full `wgpu` Vulkan-to-GLES3 rendering lands in `S3-Android`.
- Open in-place `0.27.5` SQLite WAL databases through `affine-store` with
  `busy_timeout = 5000ms` and `onStop()` `PASSIVE` checkpoints. Gate local
  workspaces by the ordered `affine-local-workspace` allowlist with zero disk
  scanning, evict unlisted local handles on shrink, and allow cloud workspaces
  and userspaces directly.
- Implement a file-locked atomic Jetpack Preferences DataStore protobuf codec
  with zero silent corruption wipes, single-lock `getOrCreateInstallationId`,
  pure-Kotlin RFC 4648 Base64 for API 24+, `v1:` AES-GCM envelopes, process-wide
  single-flight `refreshSession` with idempotent `x-affine-refresh-attempt`
  reuse and disk-write retry caching, a default `HttpUrlConnectionRefreshTransport`
  sending `refreshToken` only in the JSON body, `INTERNET` manifest permission,
  and exact `0.27.5` three-cookie plus `affine.preferences_pb` auth cleanup.
- Wire `AndroidBootstrapCoordinator` in `MainActivity.onCreate` with unified
  `WebViewStorageSentinel` validation, active `indexedDB` interception,
  lossless raw preservation of malformed workspace lists, and explicit partial
  mount failure reporting with allowlist-synced retry and write-back gating.
2026-11-27 06:55:48 +09:00
DarkSky 24e1b5d202 feat(ios-host): add in-place SQLite WAL, 2001-epoch auth, and zero-IDB localStorage bridge
Add the iOS host storage, authentication, and upgrade/rollback bridges under packages/frontend/hosts/ios:

- Wire affine-store and blocksuite-playground-doc into affine-ios-host for in-place SQLite WAL workspace and userspace databases under <Documents>/workspaces/<spaceType>/<sanitizedPeer>/<spaceId>.db, failing closed on missing or malformed affine-local-workspace allowlists so deleted local .db files never resurrect.
- Configure explicit SQLite busy_timeout (5000 ms), split remote_clock_ms from local_now_ms in apply_remote_update, add non-blocking PASSIVE WAL checkpoints on background entry, preserve dirty state whenever Metal drawables or render encoders are unavailable, and skip idle Metal draws.
- Align LegacyAuthBridge.swift and src/auth.rs with Keychain service app.affine.pro.auth-token (2001 reference-epoch f64 accessExpiresAt, shared process-level actor single-flight refresh with mutationEpochs across bridge instances, corrupt-entry self-healing, permanent invalidation cleanup, HTTP and WebKit auth cookie cleanup), UserDefaults key app.affine.pro.auth-installation-id, and /api/auth/session/{exchange,refresh,revoke} headers (x-affine-client-kind: native, x-affine-version).
- Unify LegacyLocalStorageProbe.swift and src/legacy_storage.rs on the WebViewStorageSentinel contract (all keys, whitelisted entries, idbAccessCount == 0, corrupt affine-local-workspace raw preservation, strict write-back whitelist guard, stopLoading and timeout cleanup) and wire HostBootstrapCoordinator (with allowlist eviction, rollback state sync, partial-mount error reporting, and retryable bootstrap) into MetalHostViewController with executable Swift and Rust smoke tests.
2026-11-27 06:55:48 +09:00
DarkSky b1fdf08a73 feat(web-host): add IDB v3/V1 bridge, auth routes, and a11y tree
Add the same-origin IndexedDB v3 (12 object stores, frozen version 3),
V1 read-only fallback, and BroadcastChannel bridge in `src/idb-storage.js`.
Keep local workspace enumeration strictly on `localStorage['affine-local-workspace']`
and commit pending CRDT writes before navigation or handoff.

Complete standalone authentication routes (`/sign-in`, `/magic-link`,
`/oauth/*`, `/redirect-proxy`, and `/open-app/*`) in `src/sign-in.js`
with `x-affine-client-kind: web`, double-submit CSRF headers, single-use
code guards, and on-demand Turnstile loading.

Add the first-frame write-only ARIA semantic subtree in `src/a11y.js`
with incremental attribute patching and mutual focus exclusion across
`#a11y-tree`, `#ime`, and `#embed-layer`.
2026-11-27 06:55:48 +09:00
DarkSky 6efd971122 feat(editor): add web CJK/RTL fallback, touch dispatch, and BlockSuite parity
Enable browser Canvas CJK and fullwidth punctuation fallback by default,
bundle Noto Sans Arabic and Noto Sans Hebrew for native RTL shaping, and
bridge touch tap and pan gestures to window mouse and scroll listeners.

Align BlockSuite editor behavior with Web:
- Trigger the linked-doc menu on mid-word `@`, `[[`, and `【【`.
- Add all eight inline Markdown rules on ASCII space or Enter with IME
  guards and non-leaking trailing space or pending marks.
- Support block-level Markdown on Enter and inside list and quote blocks.
- Outdent nested empty list items on Enter and exit quote blocks on two
  Enter keys without an extra blank paragraph.
- Use subsequence fuzzy matching in the slash menu, pass through Enter
  and arrow keys when in-document search has no match, and split Linked
  Page into New Doc and Linked Doc commands.
- Add block conversion shortcuts, Mod-k link focus, and Escape / second
  Mod-a whole-block selection.
2026-11-27 06:55:48 +09:00
DarkSky d63b1c7d3b feat(frontend): add IDB v3/V1 store, legacy import, and L3 client core
Add the Wasm IndexedDB v3/V1 storage model, cross-tab BroadcastChannel codec,
frozen v0.27.5 REST and GraphQL request/response codecs, and SQLite inbound
sync batch persistence in affine-store.

Add the pure-Rust affine-legacy-import crate for allowlisted Capacitor WebView
localStorage parsing, positive sentinel validation, and rollback-window
writeback serialization.

Add the device-neutral affine-client L3 domain crate with HostBridge,
ServerRegistry (enforcing F3 on Web hosts), AuthController,
StoreBackedDocDirectory (closing root registration, anti-resurrection, and
restart recovery invariants), workspace domain services, exact substring
weighted search, 25-language i18n catalog, and production PlatformAccessibility
first-frame semantic root entry.
2026-11-27 06:55:48 +09:00
DarkSky ed72cca4a3 feat(mobile): deliver S1 thin hosts, Mermaid font measurer, and release probes
Add thin Web, iOS, and Android mobile hosts, harden the blocksuite-preview
Mermaid renderer and Wasm exports, and add S1 release performance probes
with CI artifact and native host linking gates.

- Preview: use FontPoolWidthMeasurer with variable-font HVAR weight
  instantiation, integer pixel ceil widths, front-matter theme injection,
  high-contrast Light and Dark palettes, premultiplied RGBA PNG compositing,
  and Wasm theme parameters.
- Probes and CI: add s1_sqlite_probe and s1_probes release tests, record
  measured latency and peak RSS in BENCHMARK.md, add timeout-minutes on all
  np-mobile jobs, upload s1-probes-artifacts, and link Android NDK .so,
  kotlinc Activity, and iOS Simulator swiftc executable in CI.
- Web host: use an offscreen canvas GPU probe, add OAuth redirect-loop and
  runtime GPU loss guards, restrict embed URLs and sandbox tokens, match
  /api/auth/captcha Turnstile headers, and launch four independent ES module
  Blob workers pinned to site root.
- iOS host: add affine-ios-host staticlib crate implementing all C-ABI
  functions with surrogate-pair safe UTF-16 editing, weak DisplayLinkProxy,
  absolute ime_bottom contract, and in-memory LegacyCapacitorSchemeHandler.
- Android host: implement hand-written JNI bridge with absolute ime_bottom
  logical-dp conversion, predictive and legacy back gesture handling, and a
  pure Android platform SDK MainActivity and LegacyLocalStorageProbe.
2026-11-27 06:55:47 +09:00
DarkSky 8e0b345036 feat(editor): extract ui-tokens, ui-kit, and blocksuite-editor crates
Add the zero-dependency ui-tokens crate to export generated theme tokens,
icon definitions, and bundled font bytes without cross-tree include_bytes!
paths.

Add the domain-neutral ui-kit crate with logical geometry helpers, SafeArea,
VirtualList, SwipeDialog, and SwipeMenu state machines backed by scheduler
time and four-rate replay invariance tests.

Extract blocksuite-editor from playground with the WorkspaceDocDirectory
host port, exact substring UTF-16 highlight matching, and LTR/RTL logical
start/end block flow layout. Slim playground to the demo and harness host.
Update workspace manifests, static invariant guards, CI workflows, and
AGENTS.md files.
2026-11-27 06:55:47 +09:00
DarkSky d619bfbcda feat(preview): add pure-Rust offline preview kernel crate 2026-11-27 06:55:47 +09:00
DarkSky 0c9e634d08 feat(ui): add L0 mobile logical layout, bidi shaping, gestures, motion, web safe-area and iOS foundation
- Add logical geometry helpers on Edges, Corners, Svg, and scroll offsets, and propagate inherited LayoutDirection through Taffy and fast splice rebuilds with a zero-clone LTR fast path.
- Propagate explicit BaseDirection through LineLayoutCache and all platform shapers (Apple CoreText, CosmicText, and Web), sort visual clusters by x_start, add UAX #9 multi-line soft-wrap bidi reordering, preserve contextual Arabic joining across same-font runs, and align text truncation on shaped glyph-cluster boundaries (`UI_LOC_CEILING = 95200`).
- Add scheduler-clock TouchGestureRecognizer with tap, long-press timer wakeup, pan cancellation, pinch re-anchoring, and closed-form MotionCurve presets including SwipeMenu InOutSine and SwipeDialog cubic-bezier/outQuad.
- Replace Web four-element safe-area probing with a single hidden probe and exact per-edge float comparison, preserving non-double-subtracted IME insets.
- Align the iOS platform stub traits and PlatformInfo, update packages/ui/AGENTS.md, and add aarch64-apple-ios and aarch64-apple-ios-sim compile guards to native-playground CI.
2026-11-27 06:55:47 +09:00
DarkSky eff3ff6d56 feat(store): integrate affine-store into frontend workspace and harden sync
Integrate `packages/common/store` (`affine-store`) into the unified
`packages/frontend` workspace and close cross-client compatibility and
crash-recovery invariants against `0.27.5`:

- Encode page creation identity via `PageIdSource` and `CreateDocId`
  (`DerivedFromOp` vs `Explicit`), derive deterministic 10-character
  URL-safe NanoIDs from `(space_id, op_id)` without sidecar tables or
  extra keys in shared Yjs `meta.pages`, and reject `page_id` collisions
  with the root `space_id`.
- Keep `DocMode::Page` writing only the root document, require
  `db$docProperties` to be resolved before non-`Page` creation
  (returning `StoreError::DbTableNotResolved` so retry intent survives
  restarts), gate explicit non-`Page` crash-replay backfill on a
  client-local `export_explicit_create_journal` /
  `import_explicit_create_journal` record so legacy `0.27.5` pages
  without `DocProperties` rows keep `DocMode::Page`, preserve existing
  live or soft-deleted `DocProperties` rows independently of root page
  repair, and start `SqliteDocStorage::push_updates_batch` with
  `BEGIN IMMEDIATE` to prevent `SQLITE_BUSY_SNAPSHOT` on pooled WAL
  connections.
- Capture unacknowledged `in_flight` and deferred `JoinDocs` updates in
  `SpaceSyncEngine::snapshot()` ahead of `offline_queue` while keeping
  live local writes gated on `waiting_for_id_converter`.
- Wire `vars.NP_ALLOW_PERF_BOOTSTRAP` in `native-playground.yml` and
  document the three `perf/accepted.json` lifecycle actions in
  `packages/frontend/AGENTS.md`.
2026-11-27 06:55:47 +09:00
DarkSky 6f9f1cace5 refactor(workspace): dissolve native-playground into domain directories 2026-11-27 06:55:47 +09:00
DarkSky 9cd813275b refactor(server): isolate v0.27.5 compatibility code and track its exit
Move the userspace SessionRedis lock bridge and the lazy root doc lifecycle
migration into server-sync/src/legacy_compat. Mark every remaining
v0.27.5 compatibility point with a compat tag.

Add docs/post-cutover-ablation-backlog.md with the exit check and removal
scope of each tag. L0 Tier A gate 7 now checks that tags and entries match
one to one.
2026-11-27 05:48:02 +09:00
DarkSky 302e3d853d refactor(server): align transcript upload limits and trim hot paths
Return 403 ACTION_FORBIDDEN while Copilot is off.

Parse multipart GraphQL requests with the v0.27.5 upload limits. A
non-file field holds at most 1000000 bytes, a file at most 100 MiB, and a
request at most 32 files and map entries. Each limit returns 413 Payload
Too Large.

Limit JSON GraphQL bodies to 16 MiB.

Keep transcript slices in their upload files and leave the 50 MiB slice
check to the transcript runtime, after its duplicate-task check. Drop the
total upload cap. Read at most 100 MiB in setBlob.

Close dedicated session connections on every exit path. Take the domain
workspace lock with one blocking advisory lock.

Cache the search projection probe per storage. Compute
StorageBackendSpec::backend_identity without a client.

Use one millisecond renew script in server-worker. Split the node-semver
parser out of version_guard, and bound the invalid range log.

Remove the manifest test hook from the assetpack read path.
2026-11-27 05:47:27 +09:00
DarkSky 5b79dd4a69 refactor(server-db): isolate the v0.27.5 Prisma baseline in phase_a_compat
Move the _prisma_migrations replay, the top-level transaction stripping,
and the schema_baseline_0275 gate into phase_a_compat::prisma_baseline.
schema.rs keeps the native component migrations and calls the baseline
through one entry point.

Close the dedicated schema session connection on every exit path.

Add bounded reads (get_limited) and signed downloads (presign_get) to
BlobStorageBackend. The fs and assetpack backends check the size before
they read and cannot sign downloads. S3 signs with SigV4, and R2 behind a
signing worker signs with the upload URL prefix.

Read error bodies up to 64 KiB, keep the raw R2 sign key, and read the
download URL lifetime from presign.expiresInSeconds.
2026-11-27 04:33:12 +09:00
DarkSky f46af9a696 feat(server): add DynamicBlobStorage hot reload for copilot.storage 2026-11-27 02:47:56 +09:00
DarkSky b5b4fcb7e0 feat(backend): add Copilot embedding SPI and GraphQL resolvers 2026-11-26 19:02:48 +09:00
DarkSky 1ec9019fcb feat(server): add copilot transcript SPI and GraphQL contract 2026-11-26 17:59:24 +09:00
DarkSky 49a37caf3d feat(server-blob): upgrade assetpack crates and add precomp2 config toggle
Upgrade assetpack-core to 0.4.2 (default-features = false, file-transform),
assetpack-transform-precomp2 to 0.4.4 (precomp2 0.3.4), brotli to 9, and
zstd to 0.14, and drop the direct lzma-rust2 dependency.

Refactor AssetpackBlobStorage onto sqlx SqlitePool, FileTransformConfig::fast,
FileReader, and TransformDecoderRegistry with zero-clone chunk reads, separate
read/write/transform semaphores, manifest-only promote_object, and Unix-second
object/cache timestamps. Add config.precomp2 (default true), reject precomp2 on
fs configs in both validation and startup parsing, document v0.27.5 coexistence
in docs/rollout-coexistence.md, and cover real 0.1.0 interop, PCF2 segment
bombs, and 16000x16000 PNG regressions.
2026-11-26 14:22:39 +09:00
DarkSky 6b74655aee feat(server): add BYOK SPI and GraphQL contract surface 2026-11-26 09:00:57 +09:00
DarkSky 719a791c0c feat(server): add copilot graphql surface and rest routes
Expand CopilotRuntimeSpi with neutral session, history, quota, route
option, attachment, and SSE streaming methods. Add the matching Copilot
GraphQL types, UserType.copilot and UserType.quotaUsage resolvers,
ServerFeature::Copilot gating, canonical error mappings, and the seven
/api/copilot/* REST routes in server-http.
2026-11-26 07:37:49 +09:00
DarkSky 3bbac69479 fix(search): extract inline doc references like the v0.27.5 reader
The search extractor did not read inline `reference` attributes in rich
text, so a doc that links to another doc only through an inline mention
did not show as a backlink. It also dropped `prop:params` of linked and
synced doc embeds, and it did not index database columns, table cells
or LaTeX.

- Read the `reference` attribute of the visible runs in `prop:text` of
  paragraph, list and code blocks. Parse each `reference` format once,
  so a long run of text under one reference costs linear time.

- Keep `ref` unique by its full string and push the `pageId` of each kept
  `ref` to `ref_doc_id`, so the two lists stay in step. Check database
  cells one at a time, as the reader does.

- Serialize `ref` as `JSON.stringify({ docId, ...params })`. Spread
  strings and arrays by index, put index keys first, and format numbers
  as ECMAScript does.

- Keep only the `docId` when the params are larger than 256 KiB, nest
  too deeply, have too many entries, or pass the 16 MiB budget of the
  block. Check duplicates by the hash of the full reference, so such a
  reference does not merge with a different reference to the same doc.

- Merge `prop:params` into the `ref` of `affine:embed-linked-doc` and
  `affine:embed-synced-doc`, and keep an empty `pageId`.

- Index the database title, column names and select options from `Y.Map`
  columns. Read cell references from `Y.Text` or from boxed text with a
  truthy marker. Add `databaseName` to database blocks and row paragraphs.

- Read the text of each flavour as the old server does. Read rich text
  only from `Y.Text`. Index the table cells in key order and the LaTeX
  source.

- A note, frame or edgeless text with no text of its own joins the
  text of its direct children, up to 1 MiB. Each child gives its text to
  one container only.

- Index no text for doc embeds and bookmarks. Skip blocks with only
  white space, and keep bookmark blocks.

- Raise `SCHEMA_FINGERPRINT` to 2, so that startup builds a new generation
  and reprojects docs that did not change. Retire drained generations of
  any schema version.

- Move the `TestDoc` builder to `tests/support`. Test each flavour, the
  params spread, malformed input, the time for many runs and references,
  backlinks through `search` and `aggregate`, and the schema upgrade.
2026-11-26 06:34:59 +09:00
DarkSky 99791c3bc0 chore(backend): upgrade y-octo to 0.4.2 and harden sync boundaries
- Upgrade `y-octo` to `0.4.2` (`y-octo-core 0.1.1`) in `packages/backend`
  and add `y-octo-core` to `server-sync` and `server-domain` for write-boundary
  v1 scanning.
- Reject new zero-length struct updates in `server-sync::storage::validate_doc_update`
  and `server-domain::workspaces::create_workspace_with_init` via
  `y_octo_core::decoder_v1::decode_update_v1` while keeping persisted
  historical zero-length reads intact.
- Align workspace lifecycle root-doc decoding to `WORKSPACE_LIFECYCLE_MIGRATION_READ_LIMITS`
  (`max_structs = 16_000_000`), propagate `ReadError::ResourceLimit` before
  committing `storage_reconciliation_checkpoints`, and preserve the
  `[affine-doc:resource_limit]` marker in `server-domain::doc_sharing`.
- Keep `ReadError::IncompleteSnapshot` fallback to `Doc::try_from_binary_v1`
  in `server-sync` and `server-domain` while enforcing `ReadLimits`.
- Add regression tests for cross-frame zero-length poisoning, workspace init
  zero-length rejection, legacy zero-length recovery, multi-client clock gaps,
  alias `ResourceLimit` markers, and lifecycle `ResourceLimit` rollback plus retry.
2026-11-26 05:42:25 +09:00
DarkSky 70173e6565 feat(backend): add billing GraphQL resolvers, SPI, and disposition handler 2026-11-25 21:40:22 +09:00
DarkSky 8c9f4512d5 feat(backend): add public HTTP surfaces and maintenance workers
Implement static asset hosting (Selfhost and Front canary Web Mobile shell), SSR document renderer with ACL-backed preview exposure, HTML head/avatar OG metadata, and iterative bounded Markdown rendering skipping affine:surface and edgeless notes, worker proxy (image-proxy and 2 MiB link-preview) with bounded cache and shared Redis Hash Lua/memory throttling with SHA-256 tracker hashing, telemetry collection with shared version/throttle guards, per-method invalid origin messages, and bounded param flattening, GraphQL CR comment depth pre-scan hardening, and periodic background maintenance workers with slash-separated advisory locks and pending-updates backlog gauge.
2026-11-25 18:55:14 +09:00
DarkSky 69bacafdad feat(http): wire multipart blob routes, storage hot-reload, and boot_storage 2026-11-25 18:55:14 +09:00
DarkSky 51b24de310 feat(storage): add multipart, assetpack, reconciliation, and search wire tests 2026-11-25 17:27:48 +09:00
DarkSky 51c7cd31a5 feat(server): add workspace MCP credentials, GraphQL resolvers, and stateless JSON-RPC transport 2026-11-25 14:10:29 +09:00
DarkSky 55adbc6080 feat(server): add calendar sync service, GraphQL resolvers, and webhook REST routes 2026-11-25 14:10:29 +09:00
DarkSky 3304aaa4cf feat(server): add calendar provider adapters, crypto, iCal parser, and OAuth state store 2026-11-25 14:09:03 +09:00
DarkSky c043f6c7ac feat(server): add security challenges, signing key rotation, and UserType.token
Implement single-transaction security challenges (email verification, password change/set, email change with percent-decoding and realtime user-updated fan-out), admin session signing key rotation/deletion with strict verify_until boundary and parent token TTL policy, UserType.token, Query.error, and GraphQL strict throttling.
2026-11-25 10:01:21 +09:00
DarkSky 2f41f8977c feat(server): add login OAuth/OIDC, PostgreSQL captcha, and strict throttling
Implement OAuth/OIDC preflight, atomic runtime_states claim (3h TTL), bounded TTL discovery/JWKS caching, ring/p256 JWT verification across RS/PS/ES algorithms, Apple args secret normalization, PostgreSQL-backed Hashcash and Turnstile captcha, and request-level strict throttling.
2026-11-25 09:56:04 +09:00
DarkSky ed2852614d feat(server): add admin console workspace, dashboard, shared-link, and mail-delivery queries
- Add AdminService in server-domain for workspace listing, counts, details, member/shared-link lookups, workspace updates, dashboard metrics, shared-link pagination, and mail-delivery aggregates.
- Expose adminWorkspaces, adminWorkspacesCount, adminWorkspace, adminUpdateWorkspace, adminDashboard, adminAllSharedLinks, and adminMailDeliveries in server-http GraphQL.
- Update packages/backend/AGENTS.md with AdminService and admin console query documentation and extend integration tests.
2026-11-25 09:24:01 +09:00
DarkSky f218b68e4b feat(server): add admin user management, config validation, doc analytics, and realtime topic tests
- Implement admin user CRUD, feature updates, batch import, enable, and recreate-for-ban transaction semantics in UserService.
- Derive ServerConfigType oauthProviders and OAuth/Captcha feature flags dynamically from app_configs and resolve availableUpgrade on demand via safe_fetch.
- Add appConfigMetadata and dry-run validateAppConfig with secret redaction and env-only key rejection.
- Add workspaceRolePermissions and DocType analytics/lastAccessedMembers with Doc.Read and Doc.Analytics permission checks.
- Wire WorkspaceService to EventBusPublisher for single notification.count.changed emission on invite, accept, and approve flows and add integration tests.
2026-11-25 09:21:34 +09:00
DarkSky 9603b4b762 feat(server): add SQL manifest, safe_fetch, route matrix, and client version guard
Add the server foundation contracts for SQL execution order, outbound SSRF
protection, deployment and role route isolation, and client version control:

- Add the ordered SQL manifest (`packages/backend/server-db/sql-manifest.json`)
  and check manifest coverage and SHA-256 digests in `check-l0-tier-a.mjs`.

- Add `server_domain::safe_fetch` with pinned DNS resolution, per-origin
  private network allowlist, redirect header filtering, cross-origin body
  replay blocking, and legacy error envelope mapping.

- Add `RouteMountMatrix` across `(DeploymentMode, dev_mode, ServerRole)` with
  modular REST and GraphQL route wiring and `ServerExtension` isolation.

- Enforce `client.versionControl` with cached `AppConfigService` snapshots,
  anonymous fast-path short-circuiting, npm semver range parsing, named guard
  coverage on public auth endpoints, and read-only cookie session resolution
  with TTR refresh.
2026-11-25 04:12:12 +09:00
DarkSky 42a52df55c fix(server-domain): box partial cleanup on DeleteUserError 2026-11-24 23:58:11 +09:00
DarkSky af0d124d5d feat(server): add lockless compaction CAS, search projection v6, and server-search
Refactor document compaction and search projection to remove cross-workspace lock contention and hold zero locks during CRDT merges.

Document compaction and user deletion changes:
- Replace single-transaction compaction with lock-free reads, owned-permit blocking CRDT merges, and short strict-CAS write transactions.
- Retry compaction on snapshot or update CAS mismatches and PostgreSQL 40P01 deadlocks.
- Replace full-table pending update grouping with a rotating primary-key loose index scan and per-batch quota cache.
- Delete owned personal workspaces in individual short transactions with post-lock Team verification and partial cleanup returns.

Connection, rate-limit, and test harness changes:
- Set default statement and idle transaction timeouts on dedicated PostgreSQL session connections.
- Run deferred invite rate-limit effects only after rejected invite transactions roll back cleanly.
- Pass prebound SMTP sinks in parity-harness replay tests to eliminate ephemeral port races.

Search projection v6 and pure-Rust runtime changes:
- Add search_projection_v6.sql with per-workspace advisory locks, post-lock mode re-checks, and a 30s pre-expiry dual-lock bridge.
- Skip steady-state workspace_states updates during ordinary document snapshot writes to remove hot-row contention.
- Validate forward-compatible contiguous prefixes in native_schema_migrations during rolling upgrades.
- Add pure-Rust server-search (disabled by default) with committed marker-XID fences, deferred GC progress retention, repeatable-read ACL snapshots, and GraphQL resolvers.
2026-11-24 23:36:03 +09:00
DarkSky fe911cf25e fix(license): propagate schedule confirmation error in sync_workspace_seats
Return a DomainError when installed_licenses.validated_at fails to update after remote seat synchronization.
2026-11-24 18:41:18 +09:00