perf: webview/app §8 measurements + migration-checksum heal#15
Merged
Conversation
…on-checksum DB break Webview/full-app performance pass (the PRD §8 targets the engine harness can't cover), measured against the real production app via WebView2's DevTools Protocol (--remote-debugging-port) + a perf-gated window.__strand store hook. Win 11 / Ryzen 7 7700X, v0.7.0. Full numbers + methodology in docs/perf-baseline.md § "Webview / full-app baseline". - Cold start: ~407ms launch->shell paint, ~568ms launch->repo-interactive. PASS (<1.0s) - Stage/unstage perceived: ~34ms isolated. PASS (<50ms) - Diff render 5,000-line: ~87ms for a normal hunk-sized change, but ~1460ms for a whole-file diff in the non-virtualized Local Changes pane (7,500 line elements); the virtualized Review pane caps mounted rows at ~100. MIXED -> follow-up filed to virtualize the Local Changes stacked diff pane. - Idle memory: ~280MB private / ~438MB working set (medium repo); JS heap is 7MB, so the overage is WebView2's 6-process baseline (~408MB empty), not app code. OVER 250MB target -> needs process-count reduction or a per-platform target. main.tsx gains a store hook exposed on window.__strand only when localStorage['strand:perf']==='1' (gated by the same flag as the perf instrumentation), so an external CDP harness can open repos / select files / stage without a native dialog. Zero effect on normal use. Migration-checksum data-persistence fix (surfaced during the pass): sqlx stores a SHA-384 checksum of each migration's SQL and refuses to open a DB whose stored checksum no longer matches the binary. Commit 3e1f0bb reindented migration 1's SQL (whitespace only), so every strand.db created before it -- including public 0.x installs -- failed to open, silently disabling session restore AND all SQLite-backed settings persistence (the load error was caught and fell back to defaults). - state::repair_migration_checksums recomputes each migration's checksum the way sqlx does and rewrites any stale _sqlx_migrations row, in Tauri setup() before the SQL plugin's migrator runs (the webview's first Database.load). - Lossless: every migration is idempotent CREATE ... IF NOT EXISTS, so the applied schema is identical regardless of whitespace -- nothing re-runs and no user data (recents/icons/review state) is touched. - Verified against the real broken DB: v1 checksum healed, v2 then applied, session restore + persistence work, no console error. - sqlx + sha2 added as direct deps (already in the tree via tauri-plugin-sql). Verified: cargo check, cargo clippy -p strand-tauri -- -D warnings, tsc -b (via tauri build), and an end-to-end CDP run of both the perf measurements and the migration heal. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two things from one session: the webview/full-app performance pass (the PRD §8 targets the engine harness can't cover), and a migration-checksum data-persistence bug it surfaced and fixes.
Measured against the real production app via WebView2's DevTools Protocol (
--remote-debugging-port) + a perf-gatedwindow.__strandstore hook. Win 11 / Ryzen 7 7700X, v0.7.0. Full numbers + methodology indocs/perf-baseline.md§ "Webview / full-app baseline".Performance results vs PRD §8
Two follow-ups filed in
TASKS.md: virtualize the Local Changes stacked diff pane, and reconcile the memory target with WebView2's floor.ui/src/main.tsxgains a store hook exposed onwindow.__strandonly whenlocalStorage['strand:perf']==='1'(same gate as the perf instrumentation) — lets an external CDP harness drive the app without a native dialog. Zero effect on normal use.Migration-checksum fix (data-persistence bug)
sqlx stores a SHA-384 checksum of each migration's SQL and refuses to open a DB whose stored checksum no longer matches the binary. Commit
3e1f0bbreindented migration 1's SQL (whitespace only), so everystrand.dbcreated before it — including public 0.x installs — failed to open, silently disabling session restore and all SQLite-backed settings persistence (the load error was caught and fell back to defaults).state::repair_migration_checksumsrecomputes each migration's checksum the way sqlx does and rewrites any stale_sqlx_migrationsrow, in Taurisetup()before the SQL plugin's migrator runs (the webview's firstDatabase.load).CREATE … IF NOT EXISTS, so the applied schema is identical regardless of whitespace — nothing re-runs and no user data (recents/icons/review state) is touched.sqlx+sha2added as direct deps (already in the tree viatauri-plugin-sql).Verification
cargo check,cargo clippy -p strand-tauri -- -D warnings,tsc -b(viatauri build).5E02…→6D23…), v2 then applied, session restore + persistence work, no console error.🤖 Generated with Claude Code