Skip to content

feat: production-harden sidecar with auth, watchdog, and dev workflow - #4

Merged
GeiserX merged 1 commit into
mainfrom
feat/sidecar-production-hardening
May 25, 2026
Merged

GeiserX merged 1 commit into
mainfrom
feat/sidecar-production-hardening

Conversation

@GeiserX

@GeiserX GeiserX commented May 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Dev workflow: cfg!(dev) bypasses sidecar spawn, connects to manually-started Python backend on port 8765 (make dev-backend)
  • Process watchdog: polls sidecar every 5s, auto-restarts up to 3 times on crash
  • HTTP health check + version handshake: replaces raw TCP connect with GET /health returning JSON with version field
  • Auth token: 64-char cryptographic hex token generated per-session via getrandom, passed to sidecar as CASHPILOT_AUTH_TOKEN
  • PyInstaller onedir: eliminates 3-7s cold start from temp extraction; bundled via sidecar/**/* resource glob
  • Windows code signing: conditional CI steps for sidecar and installer signing (requires WINDOWS_SIGN_CERT + WINDOWS_SIGN_PASSWORD secrets)
  • Banner fix: "Desktop" now matches "CashPilot" style (same size/weight/gradient)
  • README rewrite: full service catalog with referral links, FAQ, Desktop vs Web comparison, architecture diagram

Test plan

  • cargo build passes
  • All 24 unit tests pass (cargo test)
  • make dev-backend + make dev-tauri connects successfully in dev mode
  • Production build bundles sidecar directory correctly
  • Windows CI signing steps skip gracefully without secrets configured

Summary by CodeRabbit

Release Notes

  • New Features

    • Sidecar automatic restart on failure with enhanced health monitoring
  • Improvements

    • Version mismatch detection to ensure compatibility between components
  • Chores

    • Version updated to 0.3.0
    • Windows installer code signing for enhanced security

Review Change Stack

- Add cfg!(dev) branch to bypass sidecar spawn and connect to manual Python on port 8765
- Add process watchdog (5s poll, auto-restart up to 3 times)
- Replace TCP health check with HTTP GET /health + version handshake
- Generate 64-char hex auth token via getrandom, pass as CASHPILOT_AUTH_TOKEN
- Switch PyInstaller from onefile to onedir (eliminates 3-7s cold start)
- Add conditional Windows code signing steps in CI workflow
- Fix banner SVG to use consistent styling for "CashPilot Desktop"
- Rewrite README with full service catalog, FAQ, and Desktop vs Web comparison
- Add Makefile for dev workflow (dev-backend, dev-tauri, build, test)
@GeiserX
GeiserX merged commit d90dc10 into main May 25, 2026
1 of 2 checks passed
@GeiserX
GeiserX deleted the feat/sidecar-production-hardening branch May 25, 2026 08:32
@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 329b1915-b1f4-4aa6-96ab-9876d62ddf27

📥 Commits

Reviewing files that changed from the base of the PR and between 9749bd5 and 23c2b6b.

⛔ Files ignored due to path filters (2)
  • docs/banner.svg is excluded by !**/*.svg
  • src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • .github/workflows/desktop-release.yml
  • Makefile
  • README.md
  • package.json
  • sidecar/cashpilot-sidecar.spec
  • src-tauri/Cargo.toml
  • src-tauri/src/lib.rs
  • src-tauri/src/sidecar.rs
  • src-tauri/src/window.rs
  • src-tauri/tauri.conf.json

📝 Walkthrough

Walkthrough

CashPilot Desktop 0.3.0 adds sidecar authentication with randomly generated tokens, redesigns health checking via HTTP with version validation, implements process restart capability, enables dev-mode external backend connection, adds Windows release signing, and provides expanded development documentation and build tooling.

Changes

CashPilot Desktop 0.3.0 Release

Layer / File(s) Summary
Sidecar auth token and health checking
src-tauri/src/sidecar.rs
SidecarManager generates 64-hex auth tokens on initialization, passes them to child processes via CASHPILOT_AUTH_TOKEN and CASHPILOT_VERSION environment variables. check_health() now returns HealthResult enum and performs HTTP GET to /health, parsing version fields and validating against app version. New respawn() method reuses stored mode/path to restart crashed processes. Tests updated for token uniqueness, health enum variants, and respawn error handling.
Frontend sidecar integration and dev mode
src-tauri/src/lib.rs, src-tauri/src/window.rs
get_sidecar_auth_token Tauri command exposes auth token to frontend. Dev mode (cfg) bypasses sidecar and connects to external Python backend on fixed port with retry loop. Normal mode refactors health polling into wait_for_healthy helper with 10s timeout and handles VersionMismatch by marking sidecar crashed. New spawn_watchdog background task monitors process liveness and attempts recovery via respawn(). Dev sidecar binary resolution added to resolve_sidecar_path.
Build dependencies and packaging
src-tauri/Cargo.toml, sidecar/cashpilot-sidecar.spec, src-tauri/tauri.conf.json
getrandom = "0.2" added for token generation. PyInstaller spec refactored to onedir mode with explicit COLLECT() step bundling binaries/zipfiles/datas instead of inline EXE wiring. Tauri bundle resources updated from placeholder .gitkeep to sidecar/**/* glob pattern.
Windows release signing and CI
.github/workflows/desktop-release.yml
Desktop release workflow adds Windows-only "Sign sidecar" step decoding certificate and signing src-tauri\sidecar\cashpilot-sidecar.exe via signtool. Post-build "Sign installer (Windows)" step signs all *.exe and *.nsis.zip artifacts in release bundle. Fixed sidecar upload path from matrix variable to constant sidecar/dist/cashpilot-sidecar/.
Development tooling and documentation
Makefile, README.md, package.json
New Makefile with dev-backend, dev-tauri, build, and test targets using configurable CASHPILOT_BACKEND and DEV_PORT variables. README.md expanded with two-mode description (CashPilot vs Worker Node), enhanced features list, "Desktop vs Web" comparison table, improved architecture section detailing sidecar communication, expanded development workflow, and FAQs. Version bumped to 0.3.0. License attribution added for Sergio Fernandez, 2026.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A rabbit hops through version three—
Auth tokens dance cryptographically!
Health checks leap with version grace,
Sidecars restart at frantic pace.
Dev mode connects, the watchdog keeps,
Windows signs while the builder sleeps! 🔐

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sidecar-production-hardening

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant