The handoff plan is the product contract. This document distinguishes the managed-notebook navigator/editor boundary from later product phases. Runtime evidence belongs in verification.md.
apps/vnote_mobile is the Flutter app in the root Dart workspace. lib/services/editor_session.dart owns a generation-bound volatile source mirror; Riverpod supplies the constructor-injected workspace dependency; Flutter listens to its immutable ValueNotifier states. Only a matching, validated edit batch advances the mirror. A received acknowledgement does not mean disk persistence.
packages/editor_web independently builds CodeMirror source/highlighting/history into apps/vnote_mobile/assets/editor. The view owns editable text, selection and undo; the host owns generation, document identity and accepted revisions. A narrow JSON channel is the only application boundary. No path, credential, notebook handle, renderer or filesystem command is exposed to JavaScript.
The document identity binds the real notebook and node IDs. notebook_session.dart coordinates one immutable in-flight native save and one newest pending target; editor_drafts.dart persists accepted deltas on joined filesystem workers. Received, draft-durable and saved watermarks remain separate; only the native committed prefix advances durability, never an editor reply or a timer. The core-classified Markdown/plain-text language is fixed by the load envelope; plain text installs no Markdown parser. Theme changes reconfigure the existing view. Explicit discard is distinct from successful save. Loading and editing untrusted Markdown as source never executes its HTML.
Automatic-save timers are cancelled when the source becomes clean. A queued automatic target already satisfied by an earlier write is retired without another source barrier; explicit Save still requests a fresh barrier. A nonresponsive or composing editor retains its source/draft and the existing timeout failure.
Notebook close/reopen treats final editor-close dispatch as irreversible for that
epoch. A lost final reply never authorizes an abort back into a possibly closed
page. The draft remains attached until native owner close joins. Before native
close starts, recovery can checkpoint/rebase only the same non-retired capture
whose journal read-back equals the acknowledged quiesced snapshot. Unknown live
source still requires resynchronization. Native-close dispatch blocks further
owner admission; failure exposes restartRequired, prioritizes the copy/restart
instruction and removes unsafe save/reopen/recovery/close actions. Confirmed
failed-view discard remains a no-send path, deleting its draft only after a
successful native join. Sync-epoch replacement retains its separate reservation
and recovery rules; this is not a general protocol retry or timeout change.
Root scripts/verify.mjs is the supported asset/dependency/check/packaging entrypoint. The Node build emits deterministic bundled assets, dependency license notices, application licenses and a hash manifest. Outputs are ignored; the source and dependency locks are authoritative. Check mode fails on absent or changed output rather than silently repairing it. Native sources remain pinned through recursive gitlinks.
notebook_workspace.dart owns one managed notebook workflow: either a catalog host
or a NotebookSession, never both. The catalog has no open editor buffer. Folder
browsing and create/rename/move/delete run through core APIs on its native owner.
Selected notes are opened by notebook/node UUID after catalog shutdown. Core SQLite identity lookup is only a lazy cache: the bridge anchors the root ID in core metadata and resolves cache misses through bounded authoritative core listings, without reading/rebuilding notebook schemas itself. Returning
from the editor completes quiesce plus Save/Keep draft/Discard/Cancel, drains the editor owner, then
reopens the catalog with the already observed notebook UUID. Missing/replaced
notebooks are errors, not opportunities to recreate identities.
The browser displays real indexed children, including missing and unsupported
content. Native filetype and protection checks admit only supported Markdown or
plain-text bodies to the editor. Structural actions refresh after every attempted
mutation; a failed refresh marks retained data stale and does not imply rollback.
Delete explicitly warns that core recycling can fall back to permanent deletion.
There is no mobile restore promise or second recycle implementation.
Listing JSON stays core-owned until event release. Dart decodes it using generated
CoreJsonKeys from the authoritative core header, including nodeExists = "exists"
and nested metadata.encrypted. Native admission reserves bounded result space
before dispatch and retains actual ownership through cancellation and shutdown.
Names, IDs, resolved paths and configured resource namespaces are checked before
mutation; external/traversing layouts are refused without rewriting metadata.
Markdown file moves additionally preflight the core's implicit linked-resource
side effects with the same pinned public cmark parser. Destinations cannot be
overwritten, linked indexed nodes cannot be orphaned, and resource postconditions
are checked after core success. This is not a new transaction/rollback guarantee.
The offline application includes the managed library, search/tags, notebook and files/assets interchange, standalone cohorts, and ordinary-note resources. Durable drafts/autosave and isolated preview are implemented; the stopped-app share inbox is integrated through the same cohort service. Platform/release evidence remains separate; WebDAV execution is recorded independently.
packages/vxcore_bridge owns the real context, notebook, buffer, bounded requests/events and FFI allocation releases. The Android/iOS extension vxcore_context_create_with_paths, declared in vxcore/mobile/vxcore_mobile.h, copies validated, nonoverlapping app/local roots before configuration loading. Default desktop builds neither expose this extension nor change legacy context defaults. Desktop-hosted bridge tests explicitly enable only the context extension, not mobile persistence. The platform adapter obtains persistent Application Support/internal-files locations. Notebook bodies and metadata are written only through core APIs.
The host has one native owner OS thread for context/metadata/buffer lifetime and ordinary saves, plus at most two joined network workers globally. Explicit-root contexts skip legacy session restoration; app recovery explicitly admits every owner. A core-job gate serializes owner work and stage/apply, but is not held during network or UI handshakes. Core UUID generation and latest-context diagnostic snapshots are synchronized. Dart uses bounded enqueue/control/events, not synchronous disk/network calls. Ordinary saves reload/compare exact disk SHA-256 before set-content/save under owner exclusion; memory-only prepared saves are not a substitute.
CMake selects the checked POSIX writer from src/mobile/ only for Android/iOS; desktop saves use the original in-place implementation from src/platform/buffer_file_save_desktop.cpp. The Windows DACL/recovery path from the initial native slice has been removed. Shared callsites and the native owner-thread protocol are unchanged.
No second authoritative note database, mobile notebook-schema rewrite, credential store in JavaScript, generic WebDAV uploader or Qt interface is introduced. The complete product still requires the documented platform/release evidence; WebDAV uses the same core rather than a replacement protocol engine.
Native receivers only capture immutable deliveries and transactional receipts;
they never open a live notebook. Android has a separate receiver process and an
exact-token read-only export provider. The SDK-only iOS extension shares the
owner-configured App Group ledger with its main-app plugin. ShareInbox uses a
separate validated method channel; system picker completion keeps its existing
DocumentTransferPlatform contract.
The library is the sole foreground authority. Resume installs a real joined session/workspace writer barrier, drains admitted saves and synchronization, reconciles importing claims, and only then releases the current lifecycle epoch. A retained cohort's immutable IDs and current native committed/rollback proofs, not timestamps or an expired lease, decide consumption/disposal. Private cohort cleanup follows durable inbox settlement. Removed committed destinations never turn into replay permission.
Native admission reserves 1 GiB for inbox obligations and permits at most 3 GiB of positive ordinary-transfer/outgoing-share allocation. Historical 4 GiB records remain readable; zero-byte scans return actual charges and a clamped remainder. Inbox activation independently verifies native staging usage before committing its receiver admission marker. Outgoing snapshots have separate recipient leases; chooser return is not permission to delete a recipient's bytes.
Flutter localization delegates and native private locale settings share
system/English/Simplified-Chinese choices. Trusted editor presentation receives a
closed locale preference, distinct from the fixed source language. Adaptive
layouts retain fixed element slots, not a second catalog beside an open note.
Android process-wide WebView denial remains initialized before any surface can
load content; asynchronous network and document proofs remain fail-closed.
notebook_sync.dart owns readiness, coalescing, credential transactions and typed
phase orchestration. Workspace transitions drain/detach sync before closing the
old catalog/note owner, then reconcile the successor. Native context shutdown
preserves per-device metadata; explicit clone registration is private until join.
sync_credentials.dart owns versioned scope/CAS recovery, backed by the native
Keystore/Keychain adapter; secrets never cross the editor bridge.
Stage drains admitted writes without force-saving pending text; network permits ordinary saves. Apply owns a synchronously installed editor/writer reservation, actual private-draft drain and native-resolved protection. Refresh and source settlement precede last-success. Persistent refresh markers and core journals survive interrupted work; missing path reports are not empty reports. Library Connect uses the existing sealed import publication with a native-only clone receipt, not a second installer. See ADR 0005 for the exact transaction contract.
Private drafts/ is persistent and separate from notebook truth; previews/ is
disposable only after joined readers/renderers/export leases retire. Native draft
commands share the existing no-follow filesystem helpers and one journal/quota
mutex. Immutable candidates precede core writes, and committed receipts bind both
original source and encoded disk hashes. Startup reconciles exact actual state
before writers; differing disk/identity/policy becomes an inspectable conflict.
New WebView tokens are checkpointed before load and cannot inherit stale revisions.
preview_session.dart owns one active and one newest pending immutable capture.
The NOTE owner resolves confined resources/stable navigation IDs; FS workers own
sealed files. Android heavy rendering runs in the nonexported dedicated process;
the visible viewer installs only final sanitized output and manages bounded image
residency. Its controller has no editor JavaScript channel. The native watchdog
joins or retires renderer ownership before staging cleanup.
Native policy proof precedes source/markup delivery in every editor/renderer/viewer. Android uses exact intercepted response headers, a WebView-only deny proxy when INTERNET is granted, and public settings/client denial. Its Flutter-owned Chrome client remains intact; public callbacks deny permission, chooser, console and dialog capabilities before load. WK remains capability-gated rather than claiming that content rules/CSP alone block every network protocol. See ADR 0004 for the explicit iOS limitation and ADR 0003 for source/close/recovery invariants.
The library acquires one synchronous reservation across notebook import/export,
cohorts and resources before provider or worker awaits. transfer_worker.dart
joins filesystem isolates and provider cancellation before freeing borrowed native
tokens. Native filesystem commands share no-follow/hash/identity helpers and a
quota ledger which includes still-owned attempts moved into notebook journals.
Startup reconciles pending effects before admitting ordinary writers; uncertain
targets remain unavailable rather than being rediscovered as fresh data.
Cohort preparation bulk-indexes an isolated private workbook through core APIs, closes its builder owner and seals complete content/metadata plus generated IDs. The destination catalog consumes a separate attempt through core journaled attach. Authoritative reachability and durable receipts decide commit; retries never reconstruct IDs or trust stale paths. Dart does not serialize notebook metadata.
Resource operations reuse the editor's NOTE owner, or a fresh metadata-only RESOURCES owner during recovery. Protected bodies and persisted restore work are refused before buffer opening. Listing does not create directories; bounded export copies bytes before provider IO. Desired operations, possible dispatch and proved outcomes are distinct durable records. A raced suffix is retained as ambiguous, not silently linked or copied again. Session Write/switch/close joins its resource barrier, and library shutdown drains controllers before native owner retirement.
CodeMirror insertion first returns an exact current selection after flushing edits, then accepts one revision/selection-bound transaction. Its received acknowledgement follows the normal edit batch and cannot advance disk state. An already-published asset survives stale cursor, transport and insertion failures for explicit reuse.
| ADR | Selected boundary |
|---|---|
| 0001 | Native dependency packaging, explicit persistent sandbox roots and platform-selected mobile API |
| 0002 | Owner/worker matrix, ownership, bounded events, cancellation and shutdown |
| 0003 | Exact-source UTF-16 protocol, received/durable/saved distinctions, autosave and recovery |
| 0004 | Unprivileged preview, bundled parser/math/diagrams, resource and navigation policy |
| 0005 | Readiness facts, stage/network/apply reservations, credentials and conflicts |
| 0006 | Managed imports, journaled publication, share inbox, backup and privacy |
These ADRs select designs and acceptance cases. Their existence does not establish that the corresponding mobile implementation or device tests exist. The current slice implements version-two received/draft-durable/saved boundaries and source-preserving recovery. These contracts do not claim physical-device power-loss or iOS browser capability. Reopen drains and destroys the old native owner before starting a new editor revision epoch. Native teardown/join runs on a cleanup isolate, with the listener retained until join completes; UI disposal never joins a native thread.