Store document, folder, collection, and tag favorites in the userdata$<uid>$favorite table with fractional indices and soft-delete removal.
Fall back to legacy docProperties favorite flags when no favorite table exists, and copy them into the table on the first favorite write.
Load and persist the favorite table across SQLite read-write sessions, read-only workspace opens, Web Desktop IndexedDB stores, and cloud sync.
Render and expand favorite documents, folders, collections, and tags in the desktop sidebar Favorites section apart from the Organize tree.
Add menu actions to add or remove favorites and drag reorder for top-level Favorites rows without changing db$folders order.
Copy the database to a separate path before writing a test -wal sidecar in sqlite_wal_blobs to avoid close races.
A doc row that you drag from any sidebar section onto an organize folder
adds a link to that doc in the folder. If the folder already has a link
to that doc, the drop moves the link. A drop on an organize row still
moves that row.
A doc row that you drop on a tag row adds the tag to the doc. The tag
change is idempotent and stays after the workspace opens again.
Escape, or a release outside the sidebar, cancels the drag and writes
nothing.
Doc rows that link to other docs now expand to show the linked docs.
Rows start collapsed. The expansion state uses the full row path, and a
doc that is already an ancestor in the path does not show again. "Add
linked doc" expands the parent row.
The "show linked docs in sidebar" setting is on by default and Web
Desktop keeps it in localStorage. When the setting is off, doc rows
show no arrow and no linked docs.
Page FormatToolbar `Create Linked Doc` opens the `Create linked doc` title
dialog. The dialog shows the first block as the title when that block is a
heading. `Confirm` moves the whole blocks that the selection touches, with
their subtrees and all their properties, into a new linked page. Code
text, table and database cells, marks, and inline references stay intact.
It puts an `affine:embed-linked-doc` card in their place. A blank title
gives `Untitled`. `Cancel`, `Escape`, or a press outside the dialog write
nothing.
The Edgeless `More` menu adds `Turn into linked doc` for one unlocked
note. This puts an `affine:embed-synced-doc` card with the frame, index,
and connectors of the note in its place. The menu also adds `Create linked
doc` for other unlocked selections. This moves the items, selected notes
included, into a new Edgeless document in their paint order. Then it puts
a 364 x 390 `vertical` card at their center. Both actions use the same
title dialog. Each conversion is one undo step in the source document. The
open-document group of the menu comes before the clipboard group. A menu
that does not fit scrolls its rows with the wheel and does not cover the
toolbar or the creation toolbar. `PageDocSession::export_block_tree`
exports a block subtree with every property for these copies and for
Edgeless copy and clone.
`WorkspaceDocDirectory::seed_created_doc` gives the complete Yjs V1 state
of a new document to the host, so that the content persists. The desktop
host replaces the initial blocks of the store with the seed blocks through
`PageDocSession::replace_blocks_update_v1`. It queues the change for the
connected session. The desktop directory keeps the snapshot of each loaded
document, and of a seeded document that the store does not have yet, so
synced cards show the content after a refresh or a reopen. The client
directory queues the seed with the pending updates of the workspace
database (`enqueue_pending_update`). The mobile host keeps the seed as the
cached CRDT state. The mobile bridge adds a document that the shell
created to the workspace root before it merges the content. New mobile
document IDs come from the intent, or from a random value, for each
workspace. They never reuse the ID of a document in the trash.
Saved collections and the rule preview now match workspace custom
properties of the text, number, checkbox, and date types. The rules are the
same as the property filters of the web client.
- An unknown or deleted property, a type without filters, or a method that
does not apply to the type is an error, as in the web client.
- Compare numbers as JavaScript Number does. A document without a value is
NaN, so no number comparison matches it.
- All filter scopes share one source of custom properties. A filter reads
the property type and the value from it when it matches a document.
- The document views, the sidebar rows, the saved collections, and the
preview read the property tables again when their revisions change. A
change that no store command made also shows at once. Only a filter by a
custom property causes a read of the property tables.
- Add YjsTableDoc::for_each_row. It reads only the fields that the caller
asks for, so other fields of a row cause no copies.
Decode DocCustomPropertyInfoRow records directly in custom_property_definitions with list_rows.
This change removes the intermediate serde_json::Value allocation while keeping per-row fault tolerance for invalid entries.
Also reuse a single scratch string buffer in custom_property_rows instead of allocating a key string per property.
Add NUMBER (NumberIcon) and DATE_TIME (DateTimeIcon) constants in packages/ui/tokens through extract-tokens.mjs.
Add the `Pages | Rules` collection editor modal, rule filters (including
local calendar day `Created`/`Updated` evaluation via `LocalZone`,
viewport-clamped scrollable filter menus with full keyboard navigation,
and `Reset` input state synchronization), and `NavigationEdit::UpdateCollection`
CRDT persistence.
Borrow string slices in LinkGraph::backlinks dedup sets so repeat edges avoid cloning Strings.
Skip repeat reverse-bucket scans in LinkGraph::remove_outbound_only for consecutive identical targets.
Reuse one scratch buffer in build_drawer_sections for ASCII case-insensitive matching.
Isolate live_doc_clocks build counts from breadcrumb_builds in DerivedCache and WorkStats.
Tests: cargo test --locked -p affine-client -p affine-mobile, check-invariants.sh, check-l0-tier-a.mjs
Search now scores documents without allocations and builds highlights
only for the documents it returns.
- `PreparedQuery` lowercases each field into a reusable `QueryScratch`
buffer. ASCII text uses ASCII lowercase and skips UTF-16 tables.
Other text uses `str::to_lowercase()`, and maps lowercase bytes to
source UTF-16 ranges only when the field contains the query.
- `score_with_scratch` returns the field score without highlight spans.
`match_utf16_with_scratch` returns the same result as `match_utf16`.
- With a limit, `WeightedSearchEngine::search_refs` keeps the best
documents in a bounded heap. Then it builds hits for those documents
only. Ties resolve as in a stable full sort.
- With no limit, search matches each document once and sorts the hits.
On 4,096 documents with 2,048-byte bodies and a limit of 20, a query
that matches every document allocates 0.04 MB instead of 188 MB.
Add SearchDocumentRef and WeightedSearchEngine::search_refs so callers search live records by reference.
Keep WeightedSearchEngine::search as a wrapper with identical scores, tie-breaking, and UTF-16 highlight spans.
Route MobileAppState::search_hits through search_refs to remove per-query title, tag, and preview clones.
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.
Search:
- Add PreparedQuery. It folds the query to lowercase one time per search.
- Reject a field with a fast substring check before the UTF-16 span scan.
- Keep the scores and the highlight spans the same as before.
Desktop:
- Build the directory from one visible document list.
- Move each blob cursor past the blobs that the editor already has.
- Remove the blob caches of removed workspaces.
- Use a numeric element ID for the tab close button.
Quick Search:
- Shape the input line at the 18 px heading size that the modal paints.
- Type the first key into the field when the focus moves to it.
Keep creation and theme preferences across browser restarts. Align the preview and inspector with the editor and add a page outline rail. Record recent visits across panes and tabs.
Keep workspace controls and primary navigation outside the scrolling tree.
Use the platform text input handler for sidebar names.
Keep collection entries as plain objects and merge concurrent edits by ID.
Build the Web Desktop client with local workspace storage.
Keep cloud sync enabled by default and in native Desktop.
Require cloud sync for the cloud integration tests.
Model: codex/gpt-6.2-sol.
Tests: Rust unit tests.
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.
SQLite is now the only clock writer for document updates. Each row takes
the event time or 1 ms after the document clock, whichever is later. The
session no longer keeps its own copy of the clock and gives SQLite the
event time of each update.
Each committed row reports its slot: the document clock before the write
and the row time. A row that the server holds moves pushed_clock when
the row took the slot right after the current pushed_clock.
A row from the server holds this proof when SQLite writes it. A local
row holds it when the server acknowledged its push and every earlier
push of the document.
The session keeps the slots of the other committed rows until the server
holds them. The flush checks only peer_clocks and clocks in its write
transaction, and it reads no row data.
Thus a remote update on a pushed document that the session never opened
moves pushed_clock in the same transaction. The next start no longer
loads and pushes that document again.
A row of another writer between two own rows stops pushed_clock. When
the server holds the whole in-memory state of that document, a content
check runs after the commit in one deferred transaction.
The same transaction reads the rows and writes pushed_clock. If another
connection writes first, SQLite returns SQLITE_BUSY_SNAPSHOT, the
transaction rolls back, and the next flush tries again.
A SQLite-backed session drops the staged broadcasts of the oldest
unknown document above the 64 document or 1 MiB limit. It now keeps the
ID of that document in a queue of up to 1024 IDs. The next flush looks
up these IDs in SQLite in one query.
A document that another writer added becomes a disk document that the
session loads and reconciles with the server, so the dropped changes
come back. The flush drops the other IDs.
On a page with 10,000 blocks, the flush after 20 acknowledged edits
takes 7.5 ms instead of 432 ms. The flush after 50 remote updates takes
12.3 ms instead of 1,024 ms.
Write one log record per draft edit. Fold the shared log into the
snapshot under a file lock to preserve changes from all writers.
Index child folders by parent to reduce repeated scans during traversal
and deletion.
Add SqliteDocStorage::has_active_blob to check blob existence without
reading blob payload overflow pages during ingestion.
Remove the redundant pre-check loop for generated media block IDs and
retry only when PageDocSession::insert_block reports a duplicate key.
Store SpaceSyncEngine outbound items in a VecDeque, peek before send in
WorkspaceSession, disconnect immediately on send failure, and clear
stale frames on disconnect.
Drop passive remote broadcasts for unknown documents without local
baselines or active loads in an in-memory session, bound in-flight load
staging with a reload flag, and clear load leases on failure,
disconnect, or deletion.
Another writer of the same SQLite file can add a document after a
session opens. Thus a SQLite-backed session stages passive broadcasts
for unknown documents, up to 64 documents and 1 MiB.
The next flush persists the broadcasts for documents that SQLite has
and drops the others. Above the limits, the oldest document loses its
staged broadcasts and needs a reload.
Split share receipt persistence into a sibling module and reject shares
targeting tombstoned documents before any write.
Keep only the written sidecar keys and their previous entries for
rollback. When COMMIT fails, take a new write lock and read the
sidecar again.
Restore only the keys that still hold this attempt without a committed
import. Thus receipts that another writer committed after SQLite
released the lock stay.
Migrate a legacy receipt of a permanently deleted document without a
witness, so the migration does not recreate its doc properties row,
and count that receipt as committed while the document stays deleted.
Reclaim oldest complete quarantine groups in ShareDiskInbox when old
quarantine files block valid batches under the 128 MiB cap.
Remove unnecessary allocations, scans, and repeated SQLite queries across document sync, media ingestion, and workspace table storage:
- Replace the full-page snapshot read and ID set scan in `next_available_media_block_id` with bounded O(1) read-only lookups against the root `blocks` map, keeping explicit block IDs in `ingest_media_into_doc_session` strict.
- Avoid cloning broadcast update payloads when a document is not in `LoadingRemote`, isolate per-update apply errors across live broadcasts and staged `DocLoaded` replays while triggering a single reconciliation and holding `remote_ts` on failure, skip unmanaged entries during timestamp sync, remove the unused `observed_remote_ts` state, and unify root, table, and page reconciliation dispatch in `doc_sync`.
- Encode `YjsTableDoc` state vectors and diffs directly via `y_octo::Doc::get_state_vector` and `encode_state_as_update_v1` instead of round-tripping full V1 updates.
- Cache per-document tombstone checks and monotonic clock watermarks within a single `BEGIN IMMEDIATE` write transaction in `sqlite/doc.rs`.
- Replace the two-query in-memory `HashMap` join in `list_unpushed_doc_clocks` with a single SQLite `LEFT JOIN` query while preserving `NaiveDateTime` comparison semantics.
- Wire asynchronous off-thread native Mermaid, Typst, and RaTeX previews with CJK/Emoji system .ttc collection discovery, compact bundled NewCMMath-Book OpenType MATH outlines, 2048px rasterization cap, and a 32 MiB byte-bounded PinnedPixelCache
- Enable preview-typst by default on affine-ios-host and affine-android-host with size-optimized release codegen and wake idle native host runtimes when background preview workers finish
- Add external embed cards (YouTube, Figma, GitHub, Loom) with Idle/Selected/Active click-shield states and validated http(s):// open_url bridges on iOS and Android hosts
- Add TOC Outline and Document Info side panels, atomic table row/column insert/delete toolbar with mobile non-overlap placement, and code block wrap/language/preview controls
- Implement lossless Edgeless Note subtree paste, upfront Connector endpoint ID remapping, Mindmap/Group Yjs V1 wire parity, mixed affine:table text predicate matching, and Web Worker crash recovery
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.
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.
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`.
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")]`.