iOS and watchOS apps catch up to the web app (epic, grill first) #426
Open
opened 2026-10-15 08:45:48 +00:00 by kayg
·
36 comments
No Branch/Tag specified
main
port/tasks-float-2
fix/train-1116-2
fix/train-1116-3
fix/train-1116-1
fix/flake-1134
fix/server-1182
dev
port/notes-float-3c
docs/auto-update-ig
feat/dav-transport
port/tasks-float-1
wip/mail1011-sv-order-1116
fix/flake-1179
fix/flake-1178
fix/guards-1153-fsio-split
fix/guards-1153-notes-split-we
fix/guards-1153-notes-lib
fix/guards-1153-notes-home
fix/guards-1153-ui-primitives
fix/guards-1153-primitives-e2e
fix/guards-1153-visibility-doc
feat/paper-grey-1116
fix/flake-1165
fix/flake-1119
docs/imap-766-plan-v2
fix/e2e-unique-ports
t3/paged-search-reconcile-final
wip/mail1011-final-1115
docs/tasks-float-port
perf/editor-first-paint-1c
feat/imap-notes-fetch
feat/imap-notes-projection
feat/imap-notes-readonly
feat/imap-notes-auth
feat/imap-notes-server-foundation
wip/mail1011-txn-ownvocab-1115
wip/mail1011-txn-novocab-1115
perf/p1117-final-harness
perf/single-shot-repeats
port/tasks-matrix
wip/mail1011-txn-1115
fix/static-gates-1155
feat/files-s1-identity-r7
fix/files-r7-idle-loop
fix/daily-train-1152
port/notes-float
fix/editor-tables-test-types
port/notes-float-listscript
feat/tasks-actions
port/notes-float-phone-preload
perf/sound-comparator
port/notes-float-listscroll
port/notes-float-budgets
port/notes-float-suite-fix-b
port/notes-float-sidebar-fix
port/notes-float-trim
port/notes-float-3-lists
fix/attachments-meta-capability
docs/carddav-writes-v2-plan
feat/contacts-companion-pure
issue/carddav-read-perf-fix-r2
issue/carddav-read-r2
port/notes-float-devsync2
review/calendar-2
review/switcher-a-pills
port/notes-float-switcher-a
port/port-tables-2
review/switcher-ends
wip/whiteboard-s1-1114
port/port-tables
wip/mail1011-perfneutral
review/photo-tint
port/notes-float-shell
wip/local/collections-db
wip/local/mail-p1
wip/local/cold-growth-on-tiering
wip/local/tiering-v3-s1
wip/local/wal1051-cap
wip/local/tiering-v3-s1-resume
wip/local/index-position-startup-scan
port/notes-float-flat
port/notes-float-promote
wip/handover/mail1011-candidate
wip/handover/files-s1-candidate
port/notes-float-shell-only
port/notes-float-perf
feat/whiteboard-s1
feat/tiering-v5
fix/app-switch-hitch
wip/local/files-s1-dev-v4-final
feat/files-s1-dev-v4
fix/c2-glass-shared
feat/flat-lists
wip/handover/whiteboard-s1-resume
wip/att-lazy-861
feat/switcher-browse
wip/att-lazy-860
feat/tasks-float
recovered/flat-backup-candidate
perf/stalls-1054-kc
land/ai-toolbar
feat/collections-db
feat/collections-db-fixes
codex/mail-1011-redesign-20261111
fix/ai-toolbar
backup/macos-vm/st3-head
perf/trim-candidate-phonestack
feat/switcher-three
fix/1051-index-idle-checkpoint
perf/stalls-1054-kb
perf/stalls-1054-k
perf/stalls-1054-r3
fix/c2-contrast-tail
perf/stalls-1054-r3-preview
feat/collections-before
feat/tiering-v4
fix/timelog-caret
wip/local/tasks-actions
docs/tasks-writes-v2-plan
st3-r3
feat/pass8
review/calendar-2-before-1111
wip/tiering-v3-cold4
perf/stalls-1054-r2
fix/suite-A4
fix/suite-A5-probe
fix/suite-A6
fix/suite-A3
fix/suite-A2
fix/suite-A5
fix/suite-A1
wip/local/attachments-861-fix
feat/contrast
wip/local/ports-861
storage/wal-checkpoint-off-save-1051
wip/local/mail-1011-reconcile-20261110
feat/style-sheet-fixes
feat/money-round
perf/stalls-1054
wip/tiering-v3-cold5
t3/mail-1011-liveness
feat/iphone-fixes
feat/notes-approve
wip/local/shrow-work
feat/files-s1-identity
feat/quickfix
wip/tiering-v3-cold
wip/local/shared-row-swipes
backup/macos-vm/pfx-B
backup/macos-vm/pfx-C
backup/macos-vm/pfx-D
feat/contrast-r1
feat/tiering-v3-s2-tags
feat/folder-drop
t3/photos-s1
feat/tiering-v3-s1-namespace
wip/local/photos-s1
t3/photos-plan-slice-one
recovered/backup/p1b-61505
t3/paged-search-reconcile
t3/smooth-pane-transitions
t3/index-position-startup-scan
fix/private-staging-759b-r2
backup/macos-vm/hk/hk1009/pr877
backup/macos-vm/hk/hk1009/pr878
docs/undo-block-ids-plan
fix/undo-768
backup/macos-vm/hk/hk1009/pr875
backup/macos-vm/hk/hk1009/pr904
proto/block-identity-v7d
backup/macos-vm/hk/hk1009/pr846
backup/macos-vm/hk/hk1009/pr860
backup/macos-vm/hk/hk1009/pr861
backup/macos-vm/hk/hk1009/pr849
backup/macos-vm/hk/hk1009/pr848
backup/macos-vm/hk/hk1009/pr853
backup/macos-vm/hk/hk1009/pr957
backup/macos-vm/hk/hk1009/pr893
backup/macos-vm/hk/hk1009/pr889
backup/macos-vm/hk/hk1009/pr902
docs/imap-notes-plan
docs/quota-plan-2
fix/parallel-test-flakes
docs/calendar-backend-v2-plan
feat/calendar-ical-converter
backup/macos-vm/hk/hk1009/pr808
docs/contacts-import-v2-plan
issue/610-pm-midnight
feat/calendar-v2-s1-containment
backup/macos-vm/hk/hk1009/pr854
backup/macos-vm/hk/hk1009/pr845
backup/macos-vm/hk/hk1009/pr917
docs/dav-recorder-v2-plan
plan/previews-865
plan/save-log-durable-entry
backup/macos-vm/hk/hk1009/pr934
fix/e2e-data-on-ram
backup/macos-vm/hk/hk1009/pr888
feat/appwindow3
feat/appwindow2
feat/appwindow
feat/money-p1
feat/keys-sheet
review/calendar-2-themes
feat/smooth-cursor
fix/float-style
review/calendar-2-float
release/2026-11-06-hotfix
archive/port/rows-drop-code
archive/port/rows-actions
archive/port/rows
scratch/tasks-894-ui-gates
review/calendar-2-night-wip
recovered/flaky/toast-reduced
release/2026-11-05
archive/flaky/rows-drop-fixed
archive/flaky/rows-actions
archive/flaky/rows
sim/bm15-final
sim/bm15-bis-932
sim/bm15-bis-909
sim/bm15
sim/bm15-bis-887
perf/tiering-option-b
fix/sw-lazy-precache
archive/plan/save-log-durable-entry
mock/money-fix2
archive/fix/e2e-data-on-ram
mock/appearance-all
mock/pill-press
mock/pill-press-mac
backup/macos-vm/appearance-after
mock/auto-swipes
mock/mail-actions
backup/macos-vm/mock/mail-actions
mock/money-static
archive/review/standards-917
perf/tiering-761-fix
mock/type-audit
mock/third-pane
feat/contacts-import-v2-s1
perf/executor-hot-path
archive/port/hidden-blocks
archive/port/devices
scratch/executor-on-894
scratch/executor-spans2
scratch/executor-spans
archive/port/rows-drop
feat/tiering-761-d-scale
feat/tiering-761-c-index
feat/tiering-761-b-reader
archive/review/sharing-pr3-review-9fec3d1f
perf/ports-lazy-budgets
feat/tiering-761-a-migration
archive/review/sharing-pr3-review
archive/review/sharing-pr3-review-code
archive/plan/previews-865
archive/port/port-attachments-3
archive/port/contacts-merge
fix/motion-audit-859
fix/motion-audit-859-mac
archive/port/port-pickers
archive/port/port-tables-2
archive/port/port-tables
recovered/local/sharing-s1-pr2-room-snapshot-candidate
archive/fix/parallel-test-flakes-code-minipc01
docs/imap-766-readonly-slice
feat/dav-recorder-v3
research/788-diagnosis
archive/fix/parallel-test-flakes
archive/perf/pr792-cold-index-edit
docs/sharing-slice-1
recovered/feat/dav-recorder-v2
recovered/feat/dav-recorder-v2-edd7bbb
spike/imap-766-s0-cases
archive/fix/undo-768
recovered/feat/dav-recorder
recovered/feat/dav-recorder-901acd4
feat/contacts-import
perf/cold-growth-on-764
perf/cold-growth-on-tiering
recovered/feat/tasks-set-status
feat/tasks-move-reorder
feat/tasks-delete-promote-duplicate
feat/carddav-writes
perf/quota-on-tiering
perf/quota-simple
perf/cold-growth-on-quota-stack
recovered/perf/cold-growth-on-tiering
feat/calendar-identity
feat/calendar-event-parser
feat/calendar-props-maps
port/glass-when-ring
recovered/feat/tiering-761-s1-wip-8132a84
recovered/feat/tiering-761-s1-wip-9da4094
recovered/feat/tiering-761-s1-wip-724512c
recovered/feat/tiering-761-s1-wip-66e667e
recovered/feat/tiering-761-s1
wip/6by32-01-tier-761-s1-pause-20261030
spike/imap-766-s0
wip/6by32-02-calternal-pause-20261030
wip/8by64-01-review-688-pause-20261030
wip/6by32-01-verify-744-pause-20261030
wip/6by32-01-verify-742-pause-20261030
fix/private-staging-759b
wip/6by32-01-review-748-pause-20261030
wip/6by32-01-review-733c-pause-20261030
wip/6by32-01-review-733b-pause-20261030
review/calendar-month
wip/local/bm15-trash
plan/759b-staging
review/767b-tests
review/preview-2026-10-29
docs/tiering-731-plan
wip/c6b02-review-733d
wip/c6b02-bm1-full-a
docs/deploy-plan
fix/storage-owner-liveness-642
fix/storage-fix-7
feat/tiering-731
wip/tiering-731-first-attempt
perf/idle-honest-2
fix/storage-private-tmp-642-dev
fix/storage-exact-file-quarantine-642
perf/one-flush-save
review/calendar-static
review/indexing-ring
review/when-field-2
proto/block-identity-2-review
proto/block-identity-review
review/when-field
issue/tasks-create-ids
issue/tasks-create
review/combined
review/task-polish
review/top-buttons
review/q1-q5
archive/integ325-293
archive/integ325-ci
issue/calendar-adr
archive/old/train/2026-10-23bk2
archive/old/train/2026-10-23bk
issue/469-mockup-9a
issue/smart-tasks-mockup
issue/469-menus
issue/652-signout-flake
issue/652-history-fix7
issue/652-history-fix6
archive/old/issue/spring-check-perf
issue/spring-check-perf
issue/659-rename-fast
archive/old/train/2026-10-21ar
issue/search-hardening-3
issue/652-history-fix5
issue/660-port-sheets-glass
issue/652-history-fix4
issue/652-history-fix3
issue/652-history-fix2
issue/652-history-flake
train/2026-10-21an
issue/settings-admin-port
issue/search-port
train/2026-10-20am
issue/storage-split-fix2
issue/storage-split
archive/old/issue/folder-ids-fix
train/2026-10-20al
archive/old/issue/folder-ids
train/2026-10-20ak
issue/tables-mockup
train/2026-10-19aj
train/2026-10-19ai
issue/469-merge-fixes
issue/sidebar-band
archive/old/issue/608-settings-spec
train/2026-10-19ah
issue/swipe-offscreen
train/2026-10-19ag
archive/old/issue/590-nlp-adr
archive/old/issue/587-event-after-write-2
train/2026-10-19af
archive/old/issue/587-event-after-write
issue/469-pill-room-c
issue/469-pill-room
train/2026-10-19ae
issue/469-narrow-handle
issue/397-ios-swipe-2
issue/469-desk-fixes
archive/old/issue/auto-update-adr
issue/469-filter-gap
issue/469-port-1b
issue/442-opacity-flake
issue/327-web-fast-3
archive/old/issue/469-port-1
issue/469-port-1
issue/327-web-fast-2
archive/old/issue/327-web-fast
archive/old/issue/425-stt-bench-vq1
archive/old/issue/445-no-bleed
archive/old/issue/400-swipe-mockup-2
issue/426-client-review
issue/426-client-2
issue/426-client
archive/old/issue/476-safe-area-lab
archive/old/issue/445-top-light
issue/471-blocks-mockup
archive/old/issue/448-links-app-2
archive/old/issue/448-links-app
archive/old/issue/398-cold-links
issue/434-442-small-2
issue/434-442-small
archive/old/issue/398-unload
archive/old/issue/445-bottom-band
issue/445-bottom-band
issue/351-rem-3
issue/351-rem-2
issue/351-rem
archive/old/issue/327-first-note
issue/395-width-phone
archive/old/issue/327-typing
issue/396-ios-edges
issue/397-ios-swipe
archive/old/issue/327-notes-index
issue/345-347-contrast-empty-2
archive/old/issue/44-arenas
issue/44-arenas
archive/integ325
archive/old/issue/327-perf-harness
archive/old/issue/44-thp
issue/44-thp
archive/old/issue/285-sticky-pills
archive/old/issue/44-trim-3
issue/44-trim-3
archive/old/issue/165-cards
archive/old/issue/165-picker-2
archive/old/issue/212-multi-select
No results found.
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
kayg/calternal#426
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
kayg, 2026-10-15: the iOS and watchOS apps should catch up to the web app. Per ADR 0009 (native clients: UIKit on iOS, AppKit on macOS, one repo) and ADR 0030 (every client is an Installation, with sign-in through the system web sheet).
The grill (NA1–NA6) is posted in chat. First question: where does today's iOS/watchOS app live (v0 archive? another repo?), and what does it do now?
Grill sent to kayg in chat on 2026-10-15, still waiting:
Started #426 on branch issue/426-client, based on origin/dev at
c82161d7c6. I am reading the auth, journal and room protocols before implementing the shared Rust client. No Swift app work, merges or deploys are planned.kayg (2026-10-16): the CLI, API and MCP must be extremely fast, and every surface uses ONE event route, the Apple apps included.
MCP Events. Support MCP Events (protocol 2026-07-28, https://developers.openai.com/plugins/build/mcp-events) while staying backward compatible:
capabilities.events: {}inserver/discover.events/list(withinputSchema/payloadSchema),events/subscribe(name,arguments,delivery {mode,url,secret},cursor, withid/refreshBefore/cursor/truncatedreturned), andevents/unsubscribe.{eventId,name,timestamp,data,cursor}, signed with Standard Webhooks headers plusX-MCP-Subscription-Id. Bodies are capped at 256 KiB, the callback is verified with a signed challenge, and failures return error -32015.One event route. The server's change journal is the single source of events:
Every consumer reads that same stream:
crates/client);calternal watchin the CLI;None of them gets its own event logic. MCP event cursors map directly to journal positions.
kayg (2026-10-16): the macOS toolkit is NOT decided. The "macOS uses Mac Catalyst" ADR must be Status: proposed, pending a spike, not accepted. ADR 0009's AppKit stays in force until the spike decides. kayg: "I don't want mobile UI on desktop."
The spike runs on kayg's Mac once the iOS editor exists. It builds the same two screens, the notes list (100k notes) and the editor (a long note), in both Mac Catalyst ("Optimized for Mac") and AppKit, sharing the Rust client and the TextKit 2 engine. It compares:
kayg picks after seeing both. Until then, macOS code shares only the toolkit-free layers: the Rust client, the TextKit 2 editor engine and the models.
Findings: the auth crate supports passkey browser sessions and bearer Installation checks, but has no device code or app password path. The additive path will use a short-lived device code approved by an already signed-in browser, issuing a separate revocable CLI Installation. Existing browser sign-in stays unchanged.
The server rooms already expose Yjs sync plus save-check tags 100/101 (crates/notes/src/room/acks.rs). The client will keep the exact Yrs state and lineage in SQLite before sending, then remove pending work only after tag 101 confirms durability. Retrying that state adds nothing twice.
The server binary is already named calternal (crates/calternal), so this slice uses calternal-client for the CLI. All heavy checks are queued through the shared build-slot wrapper; the host currently has all three slots occupied.
Review finding: notes.list reads a background metadata database. Its incomplete flag stays true for a cold unopened Home (crates/notes/src/meta.rs, Notes::page), and metadata can lag events that happened before a snapshot's journal baseline. Treating that list as a complete snapshot could lose a note permanently. The client starts the Home with notes.peek on an empty id list, waits for a complete scan, and replays the journal from the current epoch's beginning using notes.get for affected ids. This costs more on initial sync but avoids changing server behavior.
Validation is currently waiting for a build slot; no compiler or test results exist yet. The required wrapper is being respected.
Concurrency and cancellation review found two ways to lose accepted work. An old server acknowledgement could clear an edit written by another handle, and cancelling a journal read after consuming an entry could skip it on the next read. The store now merges concurrent Yrs states under BEGIN IMMEDIATE and clears pending work only when its bytes still match the state sent. Journal sockets are retained only after the consumed entry and cursor commit; cancellation drops the socket and forces replay. Store and room tests cover state merging, stale acknowledgements and durability checks. These are source findings, not test-pass claims.
Initial snapshot staging is connection-local, and snapshot/replay/live commits take an asynchronous cross-process file lock. Local list reads do not take that lock. Separate queued cargo jobs were consolidated into one sequential gate job to avoid occupying several build slots while waiting for Cargo's target lock. All build slots remain busy with other jobs.
Independent review found two more protocol cases. The room handshake was needlessly echoing the server's full document; that would make a read or tiny append fail once the Yrs state exceeded the server's 1 MiB incoming-frame limit. It now sends the state-vector diff already requested by the server, followed by the durability check. A test covers a document over 1 MiB and tiny outgoing frames, including a resync before acknowledgement.
A queued edit whose note was deleted or whose lineage changed must not stop the rest of the store from catching up. Such edits now stay queued and readable by id for recovery, while unrelated queue entries and the journal continue. Explicit sync reports the conflict after catch-up. Live polling includes a heartbeat, network reconnect, and periodic queue replay. These cases have tests written; compilation is still waiting for a shared build slot.
The first validation attempt acquired a slot and passed formatting, then stopped before project compilation because this shell had no C linker on PATH. The host's existing Nix compiler and OpenSSL paths are available; I have added those paths to the job environment and requeued the same sequential gates through the build-slot wrapper.
Verbatim failure output:
The compiler reached crates/client and found one missing trait import: room.rs called TransactionMut::prune_pending without bringing yrs::WriteTxn into scope (E0599). The server's Yrs workaround uses that trait. The import is added and the sequential checks are requeued; no runtime test result exists yet.
Targeted validation now passes. The client unit suite reports:
The ignored test is the explicit 100k performance run, scheduled later in the gate job. The real-server integration suite reports:
The new device sign-in tests and existing auth suites also pass. Full workspace clippy and tests are next; a rendered-browser check is prepared to confirm the CLI append reaches the actual web editor without reload.
Full workspace clippy found one warning in a test handshake callback: Tungstenite requires Result<Response, ErrorResponse>, and its fixed HTTP error response triggers result_large_err. The callback now has a narrowly scoped lint expectation documenting that library requirement. No production lint is suppressed. The targeted client and auth tests had passed before this lint check; the full sequence is being rerun.
Full workspace clippy now passes with -D warnings. The workspace test run stopped in the existing crates/calternal/tests/notes_live.rs helper, line 78, which unwraps read_to_end on a raw TCP HTTP connection:
This test file and the server room/API implementation are unchanged. I am reproducing the failure with a backtrace before deciding whether any test change is needed; I am not treating the workspace gate as passed.
The existing notes_live test passed three isolated reruns (2 tests per run). The original failure left its spawned server alive, which places the panic in the startup /healthz probe before Kill(child) was constructed. That orphan was stopped.
The test helper now constructs its cleanup guard immediately, checks whether the child exited, and retries ConnectionReset only for /healthz readiness. Actual note API reads still unwrap transport failures, so this does not hide a notes API regression. No server runtime behavior changed. Formatting, full workspace clippy and the full workspace tests will be checked again after this test-only adjustment.
The 100k local-store measurements pass the 50 ms requirement for the default page of 100. Both runs used the required shared build slot on this Linux host, in the debug profile.
Verbatim library timing output:
Verbatim CLI timing output (includes process startup and writing the 100 rows):
This is a warm local SQLite fixture with 100,000 rows, not a measurement of initial server download or listing all 100,000 notes in one page. Full gate output and the final head SHA will follow after Swift generation and the browser check.
The actual browser proof has a failure still under investigation. Browser passkey setup, CLI Installation approval, local list/read, and CLI append all succeeded. The append exited 0, reported server-saved, and had no queued work, but the visible editor did not show the marker before its assertion timed out. The Rust peer test alone was not enough to claim the rendered web path passed. I am adding narrow browser and server-state diagnostics before changing client code.
The browser failure is now identified: Chromium exits with SIGTRAP when it renders the appended crab emoji. Its fatal diagnostic is:
The server confirms the appended marker and durable acknowledgement; this was not a failed client save. The host has DejaVu fallback fonts but no installed Noto emoji font. I am repeating the rendered live check with ASCII text, while retaining the Unicode Rust/server/independent-peer tests and recording the browser font limit explicitly. No client or web source code is changed for this environment failure.
Finished this slice on
81491beee9. PR into dev: #480. The branch is pushed; the PR remains open.Issue #426 / N7 result
PR: #480
Branch: issue/426-client
Head:
81491beee9Works: one Rust client owns CLI Installation sign-in, a private SQLite device store, journal catch-up and live reconnect, markdown reads, yrs appends and durable offline replay. The thin calternal-client CLI provides login, notes list/show/append and watch; the existing server already owns the calternal binary name. UniFFI async scaffolding compiles and generates Swift bindings on Linux. ADRs 0040, 0041 and 0042 record the client, Mac Catalyst and Apple platform/layout decisions.
API: Client::open(server,database); begin_login(); finish_login(device_code,device); list_notes(limit,offset); resolve_note(id_or_title); show_note(id_or_title); append_note(id,text); sync(); next_changes(); pending_count(); pending_note_ids(). Records: NoteSummary, Change, DeviceCode. Errors distinguish sign-out, offline, missing note, changed lineage, conflict, invalid input, storage, protocol and other server errors. Queued deleted-note edits remain readable by id and do not block unrelated catch-up.
Numbers: 100,000-row local SQLite fixture, warm default page of 100, shared Linux host, debug build. Library over 100 samples: p50 0.250 ms, p95 0.376 ms, max 2.188 ms. CLI including process start and output over 30 samples: p50 6.182 ms, p95 12.990 ms, max 17.289 ms. Initial server download and printing all 100,000 rows were not measured. Full workspace: 460 passed, 0 failed, 3 ignored; the client performance test was also run explicitly and passed.
Rendered proof: browser passkey setup -> browser approval of CLI Installation -> local CLI list/read -> CLI append -> actual web editor updates without navigation/reload -> API readback. Browser plugin not available; regular Playwright used the supplied environment, desktop 1440x1000. Screenshot: /tmp/client-web-live.png. ASCII live rendering passed. The emoji variant hit this host's Chromium/Skia font fallback abort (SIGTRAP, SkFontMgr_FontConfigInterface.cpp:163 Not implemented). Unicode appends pass the Rust/server/independent-peer tests. Browser emoji rendering remains unverified on this host. Web build warnings were pre-existing Svelte CSS/chunk warnings; no web source changed.
Other limits: Swift binding generation succeeded; optional swift-format was unavailable. Generated Swift, C header and module map are temporary and uncommitted. Initial sync replays the retained journal because the server's metadata projection has no authoritative snapshot cursor. Live editor room exchanges use a socket per operation in this slice.
Open design questions for kayg (recommendations, no answer needed to review this slice):
Validation environment: CARGO_TARGET_DIR=/home/kayg/Developer/calternal-target-client; Nix C compiler/OpenSSL paths; CARGO_BUILD_JOBS=4; RUST_TEST_THREADS=4; TOKIO_WORKER_THREADS=2. Every heavy command used the required build-slot.sh wrapper. The existing server test helper was adjusted after an early health probe reset exposed a leaked child: cleanup is owned immediately; only health-check resets retry; note API reads stay strict.
Verbatim gate output, part 1 of 2, head
81491beee9:Every command exited 0. Empty formatting output is preserved as empty.
$ cargo fmt --all --check
$ cargo clippy --workspace --all-targets -- -D warnings
$ cargo test --workspace
Verbatim gate output, part 2 of 2, head
81491beee9:$ cargo test -p calternal-client --test e2e real_server_login_list_read_append -- --exact --nocapture
$ cargo test -p calternal-client --test e2e offline_append_restarts_and_syncs_once -- --exact --nocapture
$ cargo test -p calternal-client --lib store::tests::warm_list_100k -- --ignored --exact --nocapture
$ CLI process measurement
$ cargo build -p calternal-client --lib --features bindgen
$ UniFFI Swift generation on Linux
$ Rendered browser / CLI proof, ASCII marker
Starting independent defensive audit of #481 on issue/426-client-review, based on issue/426-client-2 at
20a23d9ff5. Comparing against origin/dev and testing authentication, isolation, revocation, credential storage, origin checks, input limits and offline replay.Validation initially blocked by the unattended shell environment: cargo test could not find linker cc, and openssl-sys could not find pkg-config. The commands did run through the required shared slot wrapper. No test claim is based on these failed builds. Repairing PATH and OpenSSL discovery using installed Nix tools, then rerunning the before-fix tests and gates.
Finding 1: real credential exposure under the audit's browser-token rule. crates/auth/src/device.rs token() uses json_body(), which permits the server's own browser Origin, then returns the raw Installation token in JSON. No browser/device distinction is enforced. browser_cannot_redeem_a_cli_token exercises an approved code from that Origin and expects 403 with no token. Fix: refuse Origin, Cookie and Sec-Fetch-Mode on redemption, before consuming the approval. Browser approval remains available. The unchanged PR snapshot is being tested to capture the failing assertion.
Finding 2: real revocation gap in the server path used by the client. crates/server/src/live.rs authenticates only at HTTP upgrade. run() subscribes later, so a revocation between those operations can be missed. catch_up() also sends revocation entries without applying signs_out(), unlike the broadcast path; that includes recovery after broadcast lag. Tests: revoked_between_handshake_and_subscription_never_becomes_ready and revocation_in_catch_up_closes_socket_before_ready. Fix: recheck the original identity after subscribing and before sending or accepting live data, and stop when catch-up encounters this Installation's revocation. Existing open-socket sign-out behavior remains covered.
Finding 3: real defensive protocol gap, without evidence of a cross-user exploit. crates/client/src/sync.rs apply_entries() writes the supplied cursor without checking the entry order, entry sequence/token agreement, epoch, or final page token. A malformed page can regress the committed cursor or skip data. malformed_journal_order_cannot_regress_the_committed_cursor covers descending and repeated sequences, a backwards page cursor, and an inconsistent epoch. Fix: validate the complete batch against the committed cursor before fetching notes or writing anything. Live duplicate entries continue to be ignored before application.
Audit coverage and choices
The reviewed head is
20a23d9ff5on issue/426-client-2. The fix branch is issue/426-client-review. No app-password implementation or server journal/room route was added by #481; device-code sign-in is the new server surface, and the new client uses the existing journal and room routes. No app-password feature was invented during this audit.No production VM, staging VM or perf VM was accessed. Heavy commands use the shared build-slot wrapper and the requested CARGO_TARGET_DIR. Installed Nix compiler/OpenSSL paths repair this unattended shell's missing build environment. Before-fix tests run in a separate detached worktree of the unchanged PR head, with only regression tests copied in.
All regression tests now fail against the unchanged #481 implementation (
20a23d9), with only tests added in the detached baseline worktree. The repaired compiler environment was used. Evidence:browser_cannot_redeem_a_cli_token:
left: 200
right: 403
revocation_in_catch_up_closes_socket_before_ready:
left: String("ready")
right: "error"
revoked_between_handshake_and_subscription_never_becomes_ready:
left: String("ready")
right: "error"
malformed_journal_order_cannot_regress_the_committed_cursor:
assertion failed: matches!(client.inner.apply_entries(&entries,token).await,Err(ClientError::Protocol))
Each run ended with test result: FAILED. Complete before-fix output is saved in /home/kayg/codex-jobs/client-auth-review/{browser,revoke,upgrade,order}-before.log. The fixed workspace gates are now running. The first clippy pass caught a test fixture using a disallowed filesystem helper; replacing that helper before rerunning the gates.
Validation update: the fixed authentication, client integration, offline replay and extended isolation checks passed in the first workspace test run. The run then failed in unchanged engine test tests::no_write_is_lost_while_users_are_released_and_reopened with "the test never released anyone" (crates/engine/src/tests.rs:475). This assertion depends on the concurrent sweeper observing an idle scheduling gap. No engine implementation or test was changed by the audit. Preserved the full failing run as test-first.log and rerunning the full gates, including the newly added CLI subprocess credential test. No gate is being skipped.
Completed the independent audit of #481 for #426. Fix branch: issue/426-client-review. Head:
f6cd9d82af. PR: #482 into dev, building on #481. No merge, deployment or issue closure was performed.Fixed three findings: browser redemption of raw CLI tokens; missed Installation revocation during websocket upgrade or catch-up; and acceptance of inconsistent journal batches that could regress the client cursor. Four regression tests fail against the unchanged PR head and pass with the fixes. No cross-user data leak was found in the tested action, journal and room paths. No app-password path exists in this diff.
All required gates passed. The final cargo test --workspace run passed 472 tests with zero failures. Three existing internet/performance tests are ignored by the default gate. The CLI subprocess credential test, extended whole-server isolation suite, real device-token isolation checks, client integration and offline replay tests all passed. The initial unrelated engine sweeper scheduling failure passed on the full rerun; its original output is retained in test-first.log.
Detailed findings, coverage and baseline failures are in findings.md. Full final gate output is retained in fmt.log, clippy.log and test.log and quoted verbatim on #426. Commands used CARGO_TARGET_DIR=/home/kayg/Developer/calternal-target-client and the required shared build-slot wrapper; CARGO_BUILD_JOBS=2 and RUST_TEST_THREADS=2 limited concurrency. Installed Nix compiler and OpenSSL paths repaired the unattended shell environment.
Verbatim gate output follows. The formatting check produced no output.
cargo fmt --all --check (exit 0)
cargo clippy --workspace --all-targets -- -D warnings (exit 0)
cargo test --workspace (exit 0)
kayg (2026-10-16), binding for every client: file over app on EVERY device.
Calternal is a personal cloud (files, photos, mail, notes, budget, calendar in one), not only a notes app. On every device (Mac, iPhone/iPad, CLI/Linux, and the Watch where feasible), the user's data lives as plain files on that device's file system and syncs both ways with the server. A database is only an index or cache that can be rebuilt from the files.
Slice 1 (#481/#482) keeps notes and live-edit state only in SQLite. The client store must be redesigned so files are the truth on the device and SQLite is just the index. That covers local file layout, two-way sync, edits made by other apps, conflicts and live editing over files. A new ADR replaces that part of 0040.
Started the files-first client redesign on branch issue/426-files, based on
f6cd9d82af(issue/426-client-review). I am inspecting the server Home, markdown round trips, watcher and client sync before implementation. The approved non-interactive plan governs this run.kayg's answers to the client grill C1–C18 (2026-10-16). All recommendations are accepted. In brief:
<folder>/<account>/).Starting the client architecture ADR work on branch
issue/426-adrs, based onorigin/devatc82161d7c6fefcd476d73a92f1fbc2461ef2fef1.Finding: origin/dev ends at ADR 0039, while the two unmerged client branches already use ADR numbers 0040 to 0042. I will keep 0040 for the revised Rust client ADR and start the six new storage and sync ADRs at 0043 so those branch numbers do not collide. The Mac toolkit ADR on the review branch remains proposed pending the Catalyst versus AppKit spike. Evidence: docs/adr on origin/dev ends at 0039; origin/issue/426-client-review contains 0040, 0041 and 0042, and its 0041 status says proposed.
Finding: the slice-1 client stores note rows and Yrs room state in SQLite, while the binding for this issue says files are the durable truth on each device. The revised client ADR will make SQLite a rebuildable index and keep live edit state only while a file is open. Evidence: crates/client/src/store.rs defines notes and rooms tables and crates/client/src/room.rs persists Yrs state; issue #426 comment 54737 records C1 to C18. Issue #478 comment 54531 also says the web app, Apple client, CLI, public API and MCP Events use one replayable journal route.
Finished the ADR work on branch
issue/426-adrs. Head:c86d7759816eb3e7f0455d7ef5f9c90ded339c1f. PR: #483. The PR is open and targetsdev.ADR 0040 keeps one Rust client for native apps, CLI and MCP, while the public API stays a thin server adapter. Its device database is only a rebuildable index, and the macOS toolkit remains undecided under proposed ADR 0041.
ADR 0043 makes files the durable truth on the server and every device. It keeps live state only while a file is open, imports outside edits automatically, and keeps Trash and version history on the server.
ADR 0044 gives every client one replayable per-user journal and file transfer contract, with resumable uploads and content dedupe. MCP Events uses signed webhook subscriptions on the same cursor, and older MCP clients keep working.
ADR 0045 defines safe conflict handling by data kind: text uses a three-way merge, structured files merge by record through their plugin, and binary conflicts keep both copies under the device-name rule.
ADR 0046 sets the device layout and sync scope: Apple File Provider, a plain Linux folder, full sync for small data, on-demand or pinned large content, Maildir, a small Watch cache, a rebuildable index, OS encryption and protected tokens.
ADR 0047 combines silent APNs, background refresh and journal catch-up with atomic local writes and an idempotent outbox that clears only after durable server acknowledgement.
ADR 0048 shares Rust format plugins between server and clients for parsing, indexing and structured merges; OCR, transcription and other heavy work stay on the server.
Final gate output:
git diff HEAD^ HEAD --check: exit 0, no output.Code tests were not run because this change only updates documentation.
kayg referenced this issue2026-11-05 23:21:12 +00:00