Commit Graph
22 Commits
Author SHA1 Message Date
DarkSky c24c39301f feat(desktop): apply editor fonts and stage presentations
Apply the editor font settings to split panes and Center Peek.
Save the font settings on Web Desktop and load the serif font assets.

Give full screen presentations the desktop viewport.
Restore the workbench when the presentation or its document changes.

Show tag names in the workbench. Skip writes for an in-place folder drop.
2026-12-03 23:42:07 +09:00
DarkSky 2b606566c4 fix(web): start readiness checks after navigation
Set a separate time limit for the first document request.
Use the same readiness deadline for the home and document routes.
Run each negative test in a separate context on one Chromium process.
2026-12-03 22:41:01 +09:00
DarkSky 44c504176f fix(web): Restore HTML preview wheel input under strict CSP
Move Desktop startup to a module and read fonts and workers from its manifest. Allow the HTML preview wheel bridge by hash on both hosts. Check the hash against the source and verify that Chromium returns wheel input to the canvas.
2026-12-03 15:26:07 +09:00
DarkSky 2866b3b7fa test(desktop): Run the persistence smoke test in CI
Compare the full set of document IDs after the Desktop reload.
Run the test with the optimized Wasm bundle and save its screenshots.

Model: GPT-6.2 Sol.
Checks: Yarn lint, Cargo tests, Python YAML, and Node.js gates.
2026-12-03 10:51:32 +09:00
DarkSky 16c509a356 test(desktop): verify document persistence after reload
Wait for title focus before the browser enters text. Read the stored
document mode, title, and paragraph from the V1 updates. Check the
browser click positions against the desktop layout.
2026-12-03 09:45:02 +09:00
DarkSky 445a1092e9 feat(desktop): keep Web Desktop workspaces in IndexedDB
Read and write each workspace through its IndexedDB v3 store.
Keep document edits and deletions in order across retries and reloads.
Seed empty workspaces under the startup lock and release it if a write
cannot start or the connection closes.

Wait for pending transactions and read the stored clocks before each
retry. Cancel queued retries when the connection closes. Compact a
document only when its snapshot and all source updates still match.
2026-12-02 15:10:57 +09:00
DarkSky 1678891fb5 ci(frontend): run Wasm and Linux checks in parallel
Reuse Cargo dependencies between tests and the harness build.
Use the iOS main run loop for the smoke tests.
Disable the GPU for the IndexedDB save test.
Record Chromium startup errors before cleanup.
2026-12-02 09:25:04 +09:00
DarkSky 2144304032 perf(preview): keep PDF documents open in the worker by docId
The preview workers now use a linear-memory ABI with four exports:
`memory`, `prepare(len)`, `invoke()` and `output_ptr()`. The host writes
each request into worker memory in one copy and copies each response out in
one copy. The old ABI called an export for every 4 bytes in each direction.

Rust gives out only the addresses of its own buffers, so the crate keeps
`forbid(unsafe_code)`. Buffers larger than 1 MiB go back to the allocator
after each request.

The PDF worker keeps each parsed document under a `docId` that the host
assigns. The frames are `PDF_OPEN`, `PDF_RENDER` and `PDF_CLOSE`.

The bytes of a document go to the worker once per open, not once per page.
Page pixels come back as a compact RGBA buffer that the worker transfers.

The playground bridge has one session table in `wasm_pdf_state.rs`. It
opens at most 8 documents or 256 MiB of source bytes.

To make room, the table closes least recently used idle documents, but only
when that makes the new document fit. Empty documents and documents larger
than 256 MiB never go to the worker.

The table closes a document when the view clears the last scope that used
it, also when no page request claimed it yet. A reopen that fails after a
worker restart keeps the known page count.

The table restarts the worker before the IDs run out.

The bridge no longer keeps 16 copies of PDF bytes.

Each worker event listener ignores events from a replaced worker, so a late
error of an old worker cannot stop the new one. A crash answers each sent
request once, so the count of unanswered requests stays exact.

`pdf-client.js` uses the same protocol and keeps its public methods. It
keeps the same open budget and waits for room before it sends an open.

New bytes for a known `docKey` now open a new document and drop the old
page count and pages. Before, the client returned the old page count.

Four snapshot IDs of the PDF viewer and the attachment toolbar use
`format_args!`, so the production bundle has no copy of their prefixes. The
prefix gate now checks 14 prefixes.
2026-12-01 18:55:10 +09:00
DarkSky 88343a5303 test(web,ci): verify legacy workspace readiness and guard wasm snapshot prefixes
Replace the interactive control check in the dual-shell verifier with a legacy workspace readiness check for @affine/mobile 0.27.5.

The verifier requires a valid workspace document route and a visible editor container with a mounted editor host.
It also requires the legacy shell cookie and no synthetic legacy shell object.
One page check covers these conditions, and it uses the same route parser as Node.
The verifier runs this page check again after each IndexedDB read and before it returns.
A shell that leaves the document route or unmounts the editor before it stores data fails.

The verifier loads yjs on demand so Node tests run without installed packages.
It reads only target document records from local IndexedDB and verifies root catalog and page block state.
Rows must agree with the nbstore schema, and the updates store must have its docId index.
When a fresh profile stops at the workspace home route, it reads one document ID from the catalog.
It then locks that workspace and document and navigates once to the document route.
A redirect to a different document fails the check.

The legacy CLI path now reopens the mounted document in a new tab of the same Chromium profile.
That tab blocks the welcome template, so the shell must load the workspace from IndexedDB.
The local workspace database count must stay the same.
A server that cannot serve the document route directly fails the check.
Limit Chromium browser test file concurrency to two in CI so three browser suites do not overload four runner CPUs during SwiftShader startup.

Add a zero-dependency Node script that scans WebAssembly Section 11 data segments for eleven harness snapshot ID prefixes.
The script also scans Rust sources under blocksuite/crates to confirm that every watched prefix stays active.
The source scan ignores test modules and their child modules.
Wire the source check into packages/frontend/scripts/check-invariants.sh.
Wire the binary check into .github/workflows/native-playground.yml after wasm-opt.
2026-12-01 14:42:28 +09:00
DarkSky 6f193694ba fix(web): serialize legacy document saves and share Chromium cleanup
Save the page and its catalog in one IndexedDB transaction.
Use the Chromium harness in four browser checks.
Use one 45-second DevTools handshake for the SwiftShader smoke tests.
Open each new page with one DevTools request.
Stop the process group if the browser exits before the handshake.
Use a short temporary directory if the socket path exceeds the limit.

Check the legacy control on two consecutive frames.
Report startup errors for --legacy-dir.
Wait for the OAuth configuration and provider render on /sign-in.
Run the browser regression tests in CI.
2026-12-01 11:11:27 +09:00
DarkSky 737fb5831d perf(frontend): enable Wasm SIMD, remove unused UI code, and add a browser lifecycle harness
Build the playground bundle and the four preview workers with `simd128`.
Pass the path remaps to the playground build. Pass `--enable-simd` to each `wasm-opt` call.

Remove the Taffy `grid` feature and the grid style API. No caller uses them.
Remove the unused wgpu `surface` pipeline and its shader entry points.
Remove the unused `SwipeMenu` component.
Remove the unused typography radii from the generated tokens.
Share one progress bar function between the database table and the kanban card.

Add `chromium-harness.mjs` for the browser verification scripts.
The harness owns the work directory and each process group that a script starts.
A normal end, a failed assertion, `SIGINT`, and `SIGTERM` stop each process group. Then the harness removes the directory.
Chromium keeps its temporary files in the work directory.

Use the harness in the two dual-shell verification scripts.
Correct the repository root path in `verify-canary-dual-shell-e2e.mjs` and `stage-canary-dual-shell.mjs`.

Record the SIMD worker sizes and the build flags in the preview `BENCHMARK.md`.
2026-12-01 04:24:06 +09:00
DarkSky bfd7eb9eaf fix(editor,playground,web,ios): polish block toolbars, lightbox gestures, Mermaid SVG sizing, and touch modality 2026-11-30 23:18:52 +09:00
DarkSky 57f32a5b6a feat(web-host,server-http): harden canary dual-shell routing, SSR caching, and IDB v3 interop 2026-11-30 14:55:02 +09:00
DarkSky e6f4c4313a feat(editor): add image toolbar, slash media authoring, and worker math font loading 2026-11-29 19:01:30 +09:00
DarkSky f7150b2191 feat(blocksuite): add affine:database CRDT codec and Table/Kanban/Calendar views 2026-11-28 00:33:36 +09:00
DarkSky 3d7c480933 perf(preview,playground): drop unused wasm exports and serve validated web fonts statically
Gate wasm-bindgen worker exports per preview target, externalize the four bundled UI/script fonts from the web playground Wasm bundle into static web assets, and validate fetched font bytes through the text system's fontdb loader so empty or HTML fallback responses fail closed with usable-face checks.
2026-11-28 00:31:40 +09:00
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 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 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 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 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 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