2026-05-13: Fix Tauri Prod — Wrong DB Path and Wrong Version
Fix: Tauri Prod — Wrong DB Path and Wrong Version
Section titled “Fix: Tauri Prod — Wrong DB Path and Wrong Version”Problems
Section titled “Problems”1. Seeded demo data instead of real production data
Section titled “1. Seeded demo data instead of real production data”npm run tauri:prod builds and opens Strata.app. The app showed seeded demo data instead of the user’s real assets.
Root cause: Two separate database files, neither pointing to the same location:
- Docker prod (
npm run docker:prod):backend/.data/strata.db← real data - Tauri prod (
.app):~/Library/Application Support/Strata/strata.db← created fresh → seeded
The user expects tauri:prod and docker:prod to share the same strata.db — the intended workflow is: run web app → close → open desktop app → see the same data.
2. Version displays 1.1.0-2-gc6c9ce4-dirty
Section titled “2. Version displays 1.1.0-2-gc6c9ce4-dirty”Should display 1.1.0. Root cause:
tauri-build.shdoes not setVERSION_OVERRIDE, unlikedocker:prodgit describe --tags --dirty --alwaysreturns the full string with commit count and dirty suffixsrc-tauri/build.rscallsversion.mjs --jsondirectly (noVERSION_OVERRIDE)- Git tree is dirty:
front/.astro/types.d.ts+src-tauri/Cargo.lockare modified
AGENTS.md Compliance Checklist
Section titled “AGENTS.md Compliance Checklist”| # | Convention | Status |
|---|---|---|
| 1 | Doc update | DesktopApp.md needs updating; plan doc saved |
| 2 | All 4 test gates | Infra/Rust change — Convention 9 applies; unit/e2e not affected |
| 3 | Self-review | All referenced files verified |
| 4 | Endpoint coverage | No new endpoints |
| 5 | Bug-to-Test | Build script bug — verified by running the script |
| 6 | Seed isolation | N/A |
| 7 | Transaction invariants | N/A |
| 8 | Plan history | This file saved to docs/src/content/docs/plans/ |
| 9 | Infra test gate | Must run ./scripts/tauri-build.sh && open Strata.app to verify |
| 10 | Env compatibility | No new tools |
| 11 | Do-no-harm baseline | Documented current state above |
| 12 | Execution Summary | Appended after verification |
| 13 | Doc Grep Rule | grep -r 'Application Support' docs/src/ — DesktopApp.md updated |
Fix 1: Share DB between Docker prod and Tauri prod
Section titled “Fix 1: Share DB between Docker prod and Tauri prod”Change data_dir() in src-tauri/src/lib.rs: Remove the dev/prod branch — always use <repo>/backend/.data/, same as the dev build and Docker:
// Before (prod branch):fn data_dir() -> std::path::PathBuf { if is_dev_build() { } else { // ~/Library/Application Support/Strata/ }}
// After (unified):fn data_dir() -> std::path::PathBuf { // Both dev and prod Tauri builds use backend/.data/ // This matches Docker dev (strata-dev.db) and Docker prod (strata.db) let manifest = std::path::Path::new(env!("CARGO_MANIFEST_DIR")); let repo_root = manifest.parent().expect("CARGO_MANIFEST_DIR has no parent"); repo_root.join("backend").join(".data")}Remove the now-unused dirs crate:
src-tauri/Cargo.toml: removedirs = "6"src-tauri/build.rs: no change needed (dirs not used there)
Fix 2: Correct version in tauri-build.sh
Section titled “Fix 2: Correct version in tauri-build.sh”Add VERSION_OVERRIDE to scripts/tauri-build.sh (mirrors docker:prod behavior):
# After the root npm install, before any build steps:export VERSION_OVERRIDE="$(git describe --tags --abbrev=0 2>/dev/null)"Add cargo:rerun-if-env-changed to src-tauri/build.rs:
println!("cargo:rerun-if-env-changed=VERSION_OVERRIDE");This ensures cargo reruns build.rs when VERSION_OVERRIDE changes (otherwise cached).
Files Changed
Section titled “Files Changed”| File | Change |
|---|---|
src-tauri/src/lib.rs | Simplify data_dir() — always return backend/.data/ |
src-tauri/Cargo.toml | Remove dirs = "6" dependency |
scripts/tauri-build.sh | Add export VERSION_OVERRIDE before build steps |
src-tauri/build.rs | Add cargo:rerun-if-env-changed=VERSION_OVERRIDE |
docs/src/content/docs/DesktopApp.md | Update DB path docs — prod now uses backend/.data/ |
Acceptance Criteria
Section titled “Acceptance Criteria”npm run tauri:prodopens app showing real production assets (frombackend/.data/strata.db)- Version displays
1.1.0(or latest clean tag) — no-dirty, no commit count File → Reveal Data Folderopensbackend/.data/in both dev and prod Tauri builds- DesktopApp.md updated to reflect shared DB path
Execution Summary
Section titled “Execution Summary”Commit: 6558f43
Actual changes
Section titled “Actual changes”src-tauri/src/lib.rs: Simplifieddata_dir()— removed prod branch pointing to~/Library/Application Support/Strata/; both dev and prod now returnbackend/.data/src-tauri/Cargo.toml: Removeddirs = "6"(no longer needed)src-tauri/Cargo.lock: Auto-updated by cargo (dirs and its transitive deps removed)scripts/tauri-build.sh: Addedexport VERSION_OVERRIDE="$(git describe --tags --abbrev=0 2>/dev/null || true)"after root npm installsrc-tauri/build.rs: Addedcargo:rerun-if-env-changed=VERSION_OVERRIDEdocs/src/content/docs/DesktopApp.md: Updated all DB path references; architecture diagram updated
Deviations from plan
Section titled “Deviations from plan”None. All changes implemented exactly as planned.
Test results
Section titled “Test results”| Gate | Result |
|---|---|
| Backend unit | ⏭ not affected |
| Backend e2e | ⏭ not affected |
| Frontend unit | ⏭ not affected |
| Frontend e2e | ⏭ not affected |
| Infra (tauri-build.sh) | ✅ full build succeeded; version shows 1.1.0 (production); Strata.app produced |
Key discoveries
Section titled “Key discoveries”- The
-dirtyin the version string came fromfront/.astro/types.d.tsandsrc-tauri/Cargo.lockbeing modified in the working tree —VERSION_OVERRIDEbypasses all git describe output cleanly. dirscrate was the only external dependency added solely for the~/Library/Application Support/prod path; removing it reduces the dependency surface.