Files
Marcos Paulo d9359ba93d
ci / ci (windows-latest) (push) Has been cancelled
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
feat: live.* engine commands, last-edit lookup, waiting-to-sync queue and offline banner
- engine: live.join, live.edit, live.poll, live.peers, live.selection, live.info and live.leave over the live session client (at most 8 rooms, no token in any answer, dropping a session with open rooms returns within 2 s); server.file_meta names the last editor of a file
- engine: sync.pending lists the local changes the server does not have yet (new, edited, deleted; at most 500, local comparison only)
- ui-egui: a "Waiting to sync" queue sheet opened from the sync sheet, and the "You are offline" banner on the compact Notes page
- tests: two sessions converge through the real server using live.* commands; stub-server, queue and banner tests

Verified with cargo xtask ci (fmt, clippy -D warnings, workspace tests, layers, tree, i18n).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 13:00:13 -03:00

8.0 KiB

Tasks: Mobile and sync

Rules: each task is independently testable; order is execution order. [x] done, [~] running with a MiniMax agent, [ ] open. Task files for agents: scripts/mm/<name>.md; launcher scripts/mm-agent.sh; briefing rules specs/agents/.

  • 1. Pure sync logic: ledger, planner, three-way merge, conflict names, path and hash gates. Files: crates/sync/ Done when: cargo test -p notescraft-sync passes (26 tests) and cargo xtask ci is green. (done 2026-10-19)
  • 2. Sync server: pairing, device tokens, change log with long poll, file blobs, ETag, batch check. Files: apps/notescraft-sync-server/ Done when: 6 HTTP tests pass; cargo xtask ci green. (done 2026-10-19)
  • 3. Server hardening: pairing lockout, device list/rotate/revoke, audit log, request ids, /readyz, quota, blob GC. Files: apps/notescraft-sync-server/ (agent brief scripts/mm/server-hardening.md) Done when: each item has an HTTP test; crate clippy clean. (done 2026-10-20 by GLM 5.3 Flash via Pi: 22 server tests; verified by the orchestrator)
  • 4. Sync client driver in the engine: Remote trait, HttpRemote, SyncState, sync_once, base copies for merging. Files: crates/engine/src/sync/ (brief scripts/mm/sync-client.md) Done when: 10 driver tests pass with a fake remote; engine tests and clippy green. (done 2026-10-20 by MiniMax M3.1 Flash: 12 driver tests; verified by apps/notescraft-sync-server/tests/client_e2e.rs, the real client against the real server)
  • 5. Engine commands and worker: sync.pair, sync.now, sync.status, sync.conflicts, sync.resolve, sync.devices; background loop (debounce 2 s after edits, long poll, backoff); settings (server URL, Wi-Fi only, attachments); an end-to-end test of the driver against the real server binary. Files: crates/engine/src/sync/commands.rs, crates/engine/src/prefs/, crates/engine/tests/sync_server.rs Done when: two sessions converge through a real server in a test; commands listed in commands output. (done 2026-10-20 by GLM 5.3 Flash via Pi: SyncWorker, binding and token files (0600), Vault::sibling, sync.pair/status/now/unlink/conflicts/resolve, conflict resolution; 9 command tests; verified by the orchestrator. The test against the real server binary lives in apps/notescraft-sync-server/tests/client_e2e.rs.)
  • 6. Sync UI (desktop first): Settings > Sync page, status-bar sync pill, sync sheet, Conflicts view, pairing dialog (code entry; QR later). Files: crates/ui-egui/src/views/settings_view/sync/, panels/, i18n tables Done when: driven tests push pointer events through pairing, sync now and conflict resolution; matches design/mobile/03-09. (done 2026-10-20 by MiniMax M3.1 Flash through the Claude Code harness: Settings > Sync, status-bar pill, conflicts with Keep mine/theirs/both, 6 driven tests, full ui-egui suite green. Still open: the phone sync sheet (design 03), QR pairing, devices list from the server.)
  • 7. Compact (phone) layout: below 600 pt one column, bottom tab bar, sheets instead of side panels, 44 pt targets, keyboard toolbar, safe-area insets. Files: crates/ui-egui/src/shell/layout.rs and a new shell/compact/ folder Done when: offscreen render at 390x844 matches design/mobile/01-02; driven tests at that size. (done 2026-10-20 by GLM 5.3 Flash via Pi: tab bar, back chevron, per-page cards, 12 tests; verified by render. Still open: sync pill and overflow menu in the top bar, keyboard toolbar, the note-card home list of design 01)
  • 8. Mobile shells spike: apps/notescraft-mobile (Android via android-activity, iOS static lib); open a vault in the app sandbox, edit, sync. Cfg-gate process-spawning features. Files: apps/notescraft-mobile/, cfg attributes in apps/notescraft Done when: an APK runs on an emulator and shows the notes list; iOS simulator build opens. Needs NDK and Xcode (owner machine). Status 2026-10-20: BLOCKED on toolchains (no Android SDK/NDK, no Xcode on the build machine); the pure crates already type-check for Android, see portability.md.
  • 9. End-to-end encryption: key hierarchy, Argon2id wrapping, recovery key, opaque blob ids (see research/security-and-server.md). Needs owner approval for crates. Files: crates/sync-crypto/ (new), engine and server changes Done when: a capture of server traffic holds no readable text or path; two devices still converge.
  • 10. Deploy to the homelab k3s per HOMELAB_OPERATIONS.md (namespace, Deployment, PVC or MinIO, Traefik ingress, tunnel, backup and restore drill). Needs owner approval. Files: deploy/sync-server/ manifests, runbook Done when: GET /readyz is green through sync.marcospaulo.dev.br and a restore drill passes.
  • 11. Attachments: chunking, resumable upload, dedup for files over 8 MiB.
  • 12. Server-side version history and restore UI (builds on the Versions tab).

From the research (research/sync-landscape.md, research/security-and-server.md), ranked

  • 13. /changes returns resync_required when since is older than the retained window; event compression (one record per path already; add tombstone expiry). Client does a full re-scan and ends byte-identical.
  • 14. Server activity log per device (upload, download, delete, conflict; path, bytes, time) with an admin and owner endpoint, surfaced in a Sync activity panel.
  • 15. Server-side selective sync rules (include/exclude patterns per vault; excluded paths rejected, not stored) and the matching client setting.
  • 16. Headless client: notescraft-cli sync --once --vault <path> (no egui), non-zero exit when a conflict needs a human; used in CI as the end-to-end test against the real server binary.
  • 17. Refuse to compete with another sync engine: warn when a vault sits inside iCloud Drive, Google Drive, OneDrive or Dropbox folders, or contains a Syncthing/.obsidian/plugins/*sync* marker.
  • 18. Explicit sync status in the UI: Synced / Syncing / Paused / Offline / Error (sign in again) with last sync time (design 03, 07, 08).
  • 19. Mobile sync modes: foreground live, OS background job (about every 15 min), manual; attachment tier fetched on open above a size cap.

From the mobile research (research/mobile-platform.md), ranked

  • 20. Android shell on GameActivity + cargo-ndk + Gradle AAB (spike first; task 8 is the umbrella).
  • 21. iOS static-lib wrapper in Xcode (spike early: not officially supported upstream).
  • 22. Sandbox vault with Files-app visibility on both platforms.
  • 23. Soft-keyboard and IME correctness (accents, CJK, composition) in the Source and Visual editors: the single hardest blocker.
  • 24. Safe-area and keyboard-aware one-column shell (builds on task 7).
  • 25. Quick capture sheet and share-target receive (note.new_from_share command).
  • 26. Quick switcher and command palette on phone, over the engine registry.
  • 27. Background sync via WorkManager and BGTaskScheduler (the worker from task 5 runs headless).
  • [~] 28. Conflict resolution UI plus an offline queue view on phone (builds on task 6). The phone sync sheet with devices, conflicts row, options and Sync now is done (2026-10-20, GLM 5.3 Flash, 6 driven tests); the offline queue view ("Waiting to sync" list, sync.pending, offline banner on the compact Notes page) is done too (GLM 5.3 Flash, 2026-10-20).
  • 29. Mobile toolbar above the keyboard and long-press context menus (design 02).
  • specs/collaboration/ (live co-editing, sharing, many vaults, accounts): tasks in its tasks.md.
  • specs/vault-launcher/ (main menu, recents catalog).
  • specs/e2ee/ (end-to-end encryption, needs crate approval), specs/attachments-and-history/ (chunking, resumable upload, server revisions), specs/capture-and-publish/ (quick capture, share target, clipper, publish).
  • Agent briefs: scripts/mm/{sync-client,server-hardening,compact-layout,collab-ot,accounts-sharing,vault-catalog}.md; run order for the server app: server-hardening, then accounts-sharing (same files).