diff --git a/desktopApp/src/main/kotlin/org/incido/desktop/Main.kt b/desktopApp/src/main/kotlin/org/incido/desktop/Main.kt index 3222b5d..ca6c2e5 100644 --- a/desktopApp/src/main/kotlin/org/incido/desktop/Main.kt +++ b/desktopApp/src/main/kotlin/org/incido/desktop/Main.kt @@ -130,6 +130,12 @@ fun main(args: Array) { // --onboarding-verify on the SAME dir asserts the flag gates it off. val onboardingSmoke = "--onboarding-smoke" in args val onboardingVerify = "--onboarding-verify" in args + // M5.5 perf legs (Phase 1 recommendation §8 "perf on a multi-thousand- + // note library"): --perf-smoke seeds + times on a FRESH dir, + // --perf-verify times the reopen of the SAME dir. UI stays composed + // throughout — the recomposition pressure is part of the measurement. + val perfSmoke = "--perf-smoke" in args + val perfVerify = "--perf-verify" in args // Recovery-envelope file legs: --key-export writes the INCKEY1 envelope // the phone's Settings screen writes; --key-import reads one (e.g. a // REAL phone export) with the passphrase and installs the key — the @@ -239,6 +245,8 @@ fun main(args: Array) { showFirstRun = !onboarded && !otherScriptedLeg, onboardingSmoke = onboardingSmoke, onboardingVerify = onboardingVerify, + perfSmoke = perfSmoke, + perfVerify = perfVerify, backupImport = backupImport, backupExport = backupExport, backupExportEnc = backupExportEnc, @@ -272,6 +280,8 @@ private fun NotesWindow( showFirstRun: Boolean, onboardingSmoke: Boolean, onboardingVerify: Boolean, + perfSmoke: Boolean, + perfVerify: Boolean, backupImport: String?, backupExport: String?, backupExportEnc: String?, @@ -323,6 +333,53 @@ private fun NotesWindow( } } + if (perfSmoke) { + LaunchedEffect(Unit) { + delay(1000) // past first frame, per the §3 collectAsState trap + withContext(Dispatchers.IO) { + val n = 3000 + val t0 = System.currentTimeMillis() + repeat(n) { i -> + val now = System.currentTimeMillis() + repository.saveNoteWithHashtags( + note = Note( + id = 0L, + content = "Perf note $i\nbody line", + createdAt = now, + updatedAt = now, + ), + hashtagsToAdd = emptySet(), + hashtagsToRemove = emptySet(), + ) + } + val seedMs = System.currentTimeMillis() - t0 + println("PERF seed notes=$n total=${seedMs}ms per-note=${seedMs / n}ms (UI streaming throughout)") + val t1 = System.currentTimeMillis() + val all = repository.observeAll().first() + println("PERF fresh observeAll notes=${all.size} in ${System.currentTimeMillis() - t1}ms") + all.firstOrNull()?.let { target -> + val t2 = System.currentTimeMillis() + repository.setFavorite(target.id, true) + println("PERF favorite toggle write ${System.currentTimeMillis() - t2}ms") + } + println("PERF seed leg ALL-DONE (library left at ${all.size} notes for --perf-verify)") + } + } + } + if (perfVerify) { + LaunchedEffect(Unit) { + withContext(Dispatchers.IO) { + val t0 = System.currentTimeMillis() + val delivered = repository.observeAll().first { it.isNotEmpty() } + println( + "PERF reopen first non-empty emission notes=${delivered.size} " + + "in ${System.currentTimeMillis() - t0}ms", + ) + println("PERF verify leg ALL-DONE") + } + } + } + // M3: theme_mode is a real shared setting here — resolveDark picks the // scheme. M4.5b: the app's OWN IncidoTheme wraps the shell — the // shared screens get the exact color scheme + typography the phone diff --git a/tools/DESKTOP_FEASIBILITY.md b/tools/DESKTOP_FEASIBILITY.md index 0cc7fbc..fa0a63e 100644 --- a/tools/DESKTOP_FEASIBILITY.md +++ b/tools/DESKTOP_FEASIBILITY.md @@ -972,6 +972,44 @@ M5.3 suite: **Next up: M5.5** — §9 perf pass on the real screens. +**M5.5 — perf pass on the real screens: DONE.** + +New `--perf-smoke` (fresh dir) / `--perf-verify` (reopen the same dir) +legs run against the REAL screens with the window composed and the list +streaming — recomposition pressure is part of the measurement, not a +separate microbench. Numbers on this dev box (Arch, Ryzen, no +encryption — the field-cipher leg would add the M3-proved ~55 ms PBKDF2 +once per unlock, not per note): + +``` +--perf-smoke seed notes=3000 total=279ms per-note=0ms (UI streaming throughout) +--perf-smoke fresh observeAll notes=3000 in 70ms +--perf-smoke favorite toggle write 1ms +--perf-verify reopen first non-empty emission notes=3000 in 89ms +RENDER lines during the whole seed: 4 (size-keyed emission coalesces — +no per-save recomposition storm) +exit codes 0, clean --exit-after teardown both legs +``` + +Verdict: a multi-thousand-note library is a non-event on desktop — the +ObjectBox queries, flow emission and LazyColumn all stay far under a +frame budget at 3000. The §8 "perf on a multi-thousand-note library" +unknown is CLOSED. + +**M5 — PACKAGING AND INTEGRATION: DONE** (sub-milestones M5.1–M5.5 +above, one commit each). Remaining pending-MANUAL items, all recorded +where they arose: +1. One real Esc / Ctrl+N keypress at the desk (`esc(captured)` logs — + Wayland blocks headless injection). +2. HiDPI font crispness eyeball at `uiScale=2` (geometry scaling proven). +3. First real tag run of `desktop-release.yml` (job steps verified + locally piecewise). +4. Carried from M3: the physical phone→desktop recovery-key leg. + +**Next up: Phase 2 selection (§8)** — streaming backup formatVersion 2 +driven by the seed numbers above, voice notes on desktop, OS-keyring +caching, JBR bundling for native Wayland, macOS/Windows GA. + diff --git a/tools/DESKTOP_PHASE_PLAN.md b/tools/DESKTOP_PHASE_PLAN.md index 909157f..78f233d 100644 --- a/tools/DESKTOP_PHASE_PLAN.md +++ b/tools/DESKTOP_PHASE_PLAN.md @@ -247,7 +247,7 @@ Exit criteria: one shared UI codebase; Android visually unchanged (`assembleDebug` + on-device smoke); desktop shows the real list, editor and settings wearing Incido's theme. -## 7. M5 — packaging and integration +## 7. M5 — packaging and integration — **DONE** (M5.1–M5.5, run logs in `DESKTOP_FEASIBILITY.md`; pending-manual list recorded there: real keypress, uiScale eyeball, first tag run of `desktop-release.yml`, M3's phone→desktop recovery-key leg) `packageDistributionForCurrentOS` per OS on a GitHub Actions matrix (no cross-compiling); icons, `.desktop` entry, tray + single-instance, first-run @@ -273,10 +273,11 @@ this handoff trustworthy. Never widen a seam silently: if a platform needs a new abstraction, justify it in the commit message. Flag anything unverifiable instead of assuming it works. -**First actions for a new session:** `git log --oneline -6` → read -`tools/DESKTOP_FEASIBILITY.md` → run `:core:data-jvm:smoke`, the -`:desktopApp:run … --self-test` command, and the M3 crypto legs above to -confirm the tree matches this description → start M4 task 1 (convert -`:composeApp` in-place to `kotlin("multiplatform")` with -`androidTarget()` + `jvm()`, per §6 order of attack — decide within a day -of real friction whether to fall back to a `:ui-shared` module). \ No newline at end of file +**First actions for a new session:** `git log --oneline -8` → read the +"Phase 1 status" tail of `tools/DESKTOP_FEASIBILITY.md` (M5 entries) → +run the §1 gates to confirm the tree (they now include the M5.1/M5.2 +legs) → **Phase 1 M1–M5 are all DONE**; what remains is the four +pending-MANUAL checks listed at the end of the feasibility status +(real Esc/Ctrl+N keypress, uiScale=2 readability, first +`desktop-release.yml` tag run, phone→desktop recovery-key leg), then +pick Phase 2 candidates from §8. \ No newline at end of file