v0.3.0-PWA
v0.3.0 — Mobile / PWA Capture Surface
Summary
Merging web → main and cutting v0.3.0. This release ships the PWA capture surface end-to-end (server, embedded shell, offline queue, presets, history heatmap) plus the TUI ↔ Serve handoff that makes pour serve a one-keypress action from inside the dashboard.
Per pour - docs/09 milestones/v1.0.0-Release.md, v0.3.0 is the planned tag for "web/PWA capture surface, when web merges to main." This PR is that moment.
Cargo.toml:0.2.2→0.3.0.CHANGELOG.md:[Unreleased]promoted to[0.2.1]; new[0.2.2]and[0.3.0]sections added.
What's landing
Server foundation (~2.7k LOC)
pour servesubcommand on port 8421 (default),0.0.0.0binding, QR code + URL printed at startup.- Bearer-token auth via
mobile_tokenin~/.pour/secrets.toml; constant-time compare;?token=bootstrap-only. - Nine
/api/v1/*endpoints — health, config, options, submit, captures, history, presets CRUD + reorder. - Idempotency layer (LRU 1024, in-flight 60 s, done 5 min) so submit retries are safe.
- Contract-first surface frozen at
pour - docs/08 specs/pour-api-contract.md; OpenAPI atpour - docs/02 references/pour-openapi.yaml.
Embedded PWA (~6k LOC)
- Vanilla HTML/CSS/JS shell via
rust-embed. Module list, form rendering, submit, history, presets, "Add to Home Screen." - Phase 2 closeout (2026-04-27): IndexedDB offline queue, service worker app-shell cache, sub-form overlay for
create_template, preset mutation UI, 90-day history heatmap, bottom-tab navigation, cursor-paginated history list. Seepour - docs/06 reports/v1.0.0-phase2-closeout.md.
TUI ↔ Serve handoff (this branch's most recent work)
sfrom the dashboard suspends the TUI, runspour serveinline (QR visible in the cooked terminal), Ctrl+C drains gracefully (5 s budget), dashboard resumes. One process, one terminal, transient server.- New
src/server/startup.rs— shared banner + token resolution between CLI and TUI handoff. Banner uses fixed-width Unicode box-drawing (BANNER_WIDTH = 70), truncates URLs with ellipsis on overflow. - New
run_with_shutdowncancellable axum entry —with_graceful_shutdown+local_addr()-derived logging. - Signal handler installed before any setup work via a spawned task — eliminates the pre-poll Ctrl+C-kills-process window.
- Errors (port-in-use, drain timeout, bind failure) surface through
app.startup_warningsas a dismissable overlay on the next dashboard render. - Plan + post-implementation audit notes:
pour - docs/08 specs/pour-tui-serve-handoff.md.
Adversarial audit + fixes
The handoff went through a Redline Audit before merging; 4 critical and 4 high-value issues were found and fixed in a second pass:
- C1: Errors no longer dropped into
deferred_stderr(which only flushes at process exit) — they surface via the existingstartup_warningsoverlay. - C2:
tokio::signal::ctrl_c()errors no longer cause the server to "spontaneously exit" — failure falls through topending()so the documented contract holds. - C3: Signal handler installed via
tokio::spawnat the very top ofAction::Serve, beforeratatui::restore()— pre-poll kill window reduced from hundreds of ms to microseconds. - C4: Banner width regression fixed;
tests/server_startup_banner.rsasserts every line is exactlyBANNER_WIDTHchars and locks the invariant. - H1: Handoff reuses
app.config.clone()instead of reloading from disk — TUI and server share the same config snapshot. - H2:
run_with_shutdownlog line useslistener.local_addr(), not a hardcoded0.0.0.0:{port}. - H3: New tests —
shutdown_with_no_connections,shutdown_drains_in_flight_request— verify the 5 s drain timeout works for the case it was added for. - H4: Buffered keypresses after
sdiscarded on dashboard resume — pressingsthenqquickly no longer causes pour to quit on return.
Hierarchical preset picker
preset_axesconfig (config v3);preset_treebuild / validate / suggest with TUI overlay tests.
TUI form rework (src/tui/form.rs, +562 lines)
- Sub-form UX with inline
◂ ▸cycling indicators; Up/Down navigates rows, Left/Right cycles values; no dropdowns inside overlays.
Test hardening
test_pollutioncleanup;POUR_HOMEpanics inside cargo integration tests.- Expanded server / preset / history coverage.
- Test count: 816 passing across 30+ binaries.
Docs pass
- v0.2.0 accuracy + linking pass across
pour - docs/. - New plan + audit doc for the TUI ↔ Serve handoff.
Known limitations carried into v0.3.0
- TUI handoff hardcodes port 8421 (matches CLI default). If 8421 is permanently occupied, the user gets a clear
startup_warningsmessage; the workaround is to runpour serve --port Xin a separate terminal. A[serve.port]config option is a reasonable v0.3.x or v0.4.0 follow-up. - Banner emits a
pour serve:prefix even when invoked from the TUI handoff — cosmetic only. serve_on_listenerretained alongsiderun_with_shutdownto avoid touching existing integration tests; minor API duplication.- Panic-hook chain grows by one closure per
spress (slow leak, only material in 100+ cycles).
Test plan
cargo test— 816 passing, 0 failed.cargo clippy --all-targets— clean.cargo fmt -- --check— clean.- Smoke:
pour,pour me,pour coffee(TUI capture loop unaffected). - Smoke:
pour servereachable, PWA loads in browser, basic capture round-trips. - Smoke: TUI handoff — press
sin dashboard, scan QR, capture from phone, Ctrl+C, dashboard resumes. - Smoke: TUI handoff with
pour servealready running externally — error surfaces viastartup_warnings, dashboard stays interactive. - Smoke: token persistence — first
spress generates token insecrets.toml, secondspress reuses it.
Post-merge
- Tag
v0.3.0onmain. - Update
pour - docs/09 milestones/v1.0.0-Release.md"Path from Today" snapshot to reflect post-tag state (current snapshot dates to 2026-04-25 and predates the bump).