Skip to content

feat(rust): Go/Wails → Rust/Tauri rewrite (in progress) - #28

Draft
Jaro-c wants to merge 12 commits into
developfrom
rewrite/rust-tauri
Draft

feat(rust): Go/Wails → Rust/Tauri rewrite (in progress)#28
Jaro-c wants to merge 12 commits into
developfrom
rewrite/rust-tauri

Conversation

@Jaro-c

@Jaro-c Jaro-c commented Jun 29, 2026

Copy link
Copy Markdown
Member

Long-lived branch for the Go/Wails → Rust/Tauri rewrite mandated in ai-context. Draft; lands in phases, each phase fmt/clippy/test-clean before the next.

Phase 1 — core foundation (this push)

  • Cargo package on the internal/ layout (Cargo src/ overridden via path keys, per the structure standard)
  • engine module — DbType (with Valkey added as the 6th engine), Status, Instance, Version, the Engine trait and a typed EngineError. serde attributes preserve the exact camelCase / omitempty JSON wire contract the existing frontend consumes, so the bridge can swap underneath it.
  • store module — atomic (write-then-rename), owner-only instances.json; missing registry reads as empty, corrupt registry is reported not silently dropped.
  • rustfmt (hard tabs) + .editorconfig per the style standard.
  • cargo fmt --check, clippy -D warnings, 9 unit tests — all clean.

Remaining phases

  1. Core services — versions (bundled 4-major stable list, drops the endoflife.date phone-home), i18n (embed locales/*.json), manager (registry, race-free port allocation, lifecycle).
  2. Engines — pg/mysql/mariadb/valkey/redis/mongodb implementing Engine (subprocess control).
  3. Tauri bridge — the 15 commands + the install:progress event channel, least-privilege capabilities.
  4. Frontend rewire — window.go.*invoke(), EventsOnlisten(); bun + Biome tooling.
  5. CI/release — adopt the rust-ci/rust-supply-chain/line-limit/dco reusables, signed release contract (.deb + Snap + binaries), fuzz targets, 90% coverage gate.
  6. Cutover — remove Go/Wails, bump, release.

The Go app stays intact and shippable on main until cutover.

Jaro-c added 8 commits June 29, 2026 18:47
Start the Go/Wails -> Rust/Tauri rewrite with the engine-agnostic core as
a pure, fully tested library, ahead of wiring the Tauri bridge.

- Cargo package with the internal/ layout (src/ overridden via path keys)
- engine module: DbType (Valkey added as the sixth engine), Status,
  Instance and Version, with serde attributes that preserve the exact
  camelCase/omitempty JSON wire contract the frontend already consumes,
  plus the Engine trait and a typed EngineError
- store module: atomic (write-then-rename) owner-only instances.json
  persistence that reads a missing registry as empty and reports a
  corrupt one instead of dropping it
- rustfmt (hard tabs) and editorconfig per the style standard

cargo fmt, clippy -D warnings and the unit tests are clean.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
- versions: bundled stable major families per engine, dropping the
  endoflife.date phone-home; only stable majors, newest first, capped
  at four per engine, with major-key/major-match helpers
- i18n: compile-time embedded locale catalogue; English is the source of
  truth and every locale is completed against it so a missing key falls
  back to English, never blank; POSIX env detection and RTL direction
- manager: instance registry, lifecycle, isolated per-instance data
  dirs, race-free port allocation (host-bind + in-app checks), atomic
  persistence, and failed-start error capture, all over the Engine trait

cargo fmt, clippy -D warnings and 25 unit tests are clean.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
- engine::paths — snap-aware base/engines directories and binary
  resolution (snap bundle only when confined; user engines dir, then
  system paths, then PATH otherwise)
- engine::proc — pidfile liveness via /proc, TCP port probing and a
  SIGINT-by-pidfile stop that shells out to kill (no unsafe)
- redis — one RespEngine driving both Redis and Valkey (the BSD fork is
  config-compatible): generated daemonized config bound to loopback with
  persistence off, CLI-then-signal shutdown, dual pid+port status

cargo fmt, clippy -D warnings and 38 unit tests are clean.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
Complete the engine layer over the Engine trait:

- pg: per-major bin discovery, initdb with trust auth on loopback,
  pg_ctl lifecycle, status from postmaster.pid
- mysql: --no-defaults insecure init so the host config can never
  redirect it, mysqld_safe/daemonize start, snap-prefix awareness
- mariadb: mariadbd validated as a genuine MariaDB build (not a
  masquerading mysqld), mariadb-install-db init, [mariadbd] config
- mongodb: forked mongod from a generated YAML config, mongosh/mongo
  admin shutdown
- engine::paths: snap bundle dir and an exposed PATH search helper

All engines bind to loopback and write owner-only config. cargo fmt,
clippy -D warnings and 54 unit tests are clean.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
- commands: the 15-command webview bridge over the manager, i18n and
  installer, validating every untrusted argument at the boundary (engine
  kinds parsed against the known set, ids only looked up); installs
  stream install:progress:<id> events and run off the manager lock
- install: host package-manager install (apt via pkexec, brew), refused
  inside a snap, output streamed line by line
- main: Tauri entry point wiring all six engines into the manager and
  the locale catalogue as shared state
- tauri.conf.json + least-privilege capability + RGBA app icon
- Engine is now Send + Sync so the manager can cross bridge threads

cargo check (with Tauri), fmt, clippy -D warnings and 56 tests clean.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
Point the webview at the Rust backend through the global window.__TAURI__
(enabled via withGlobalTauri, so the bundler-free vanilla frontend needs
no imports):

- a small facade maps the former binding method names to Tauri commands,
  so the rest of the UI is untouched; camelCase args convert to the Rust
  snake_case parameters
- an event bridge tracks Tauri unlisten handles by event name and unwraps
  the payload, keeping the subscribe/unsubscribe-by-key install-progress
  call sites working

node --check and the Tauri build are clean.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
Replace the bespoke Go CI with thin SHA-pinned callers of the org
reusables — rust-ci (tests + 90% coverage gate, MSRV, cross-OS),
rust-audit, rust-supply-chain (SBOM + licenses), line-limit and dco. The
engine/installer/bridge layers are coverage-excluded because they need
real DB tooling and the Tauri runtime (the live gate), not unit tests.

Add a cargo-fuzz crate (its own workspace, off the stable test path) with
targets for the two untrusted-input parsers: the instances.json registry
and engine --version strings.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
Complete the cutover. The Rust/Tauri implementation now stands alone:

- delete all Go sources, go.mod/go.sum, wails.json and the generated
  wailsjs bridge
- snapcraft builds the Rust binary with cargo --locked instead of wails
- release workflow builds per-OS with cargo, verifies the tag against
  Cargo.toml and main, publishes the snap, emits SHA256SUMS and build
  provenance attestation, and creates the GitHub release — all within the
  org actions allowlist
- README, frontend header and appicon notes updated to Rust/Tauri

BREAKING CHANGE: the desktop app is now built with Rust/Tauri; the Go
and Wails toolchains are no longer used.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
@Jaro-c
Jaro-c marked this pull request as ready for review June 30, 2026 00:27
@Jaro-c
Jaro-c marked this pull request as draft June 30, 2026 00:27
Jaro-c added 4 commits June 29, 2026 19:28
The caller passed extra-os and coverage-exclude, but the reusable's
inputs are extra-test-os and coverage-ignore-regex, so the workflow
failed at startup. Use the correct names.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
The generic org Rust CI builds with --all-features and no GTK/WebKit
system libraries, so a core crate that depended on Tauri failed the
build. Move the Tauri shell (commands + entry point + config) into an
isolated app/ crate that depends on the core, leaving the root crate
free of Tauri.

- root klyradb crate: the GUI-agnostic core (engines, manager, store,
  versions, i18n, install) — what rust-ci tests, no system libraries
- app/ crate: its own workspace so rust-ci never builds it; the Tauri
  shell, built by the snap and release jobs that install WebKit/GTK
- snapcraft and release build with --manifest-path app/Cargo.toml

Core: fmt, clippy --all-features and 56 tests clean. App: fmt, clippy
and the Tauri build clean.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
- gate the /proc-based liveness test to Linux (macOS/Windows have no
  /proc, where the port check carries status instead)
- add deny.toml and about.toml allowing the permissive license set the
  dependency tree resolves to, so cargo-deny and cargo-about pass
- lift core coverage to ~92% (>90 gate): cover the manager lifecycle,
  engine error/parse helpers, port probing and locale detection; exclude
  the snap/filesystem-probing engine::paths from the coverage count

cargo fmt, clippy --all-features and 69 unit tests clean; coverage 92%.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
- split the manager unit tests into manager/tests.rs so mod.rs is back
  under the 500-line hard limit (a child module still reaches the
  parent's private items)
- render the MySQL/MariaDB socket path with a forward slash instead of
  Path::join, so the config and its test are stable on Windows runners
- add about.hbs so cargo-about can render the license attribution

fmt, clippy --all-features and 69 tests clean; no file over 500 lines.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
@Jaro-c
Jaro-c changed the base branch from main to develop June 30, 2026 01:27
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