Skip to content

fix(cli): honor UTEKE_HOME as store path override - #1107

Merged
ajianaz merged 1 commit into
developfrom
fix/1105-uteke-home-store-override
Aug 26, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/1105-uteke-home-store-override

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

What (description of the change)

The uteke CLI resolved its store from --store or uteke.toml only, ignoring UTEKE_HOME — so an isolated-looking invocation silently opened the default (often production) database:

$ UTEKE_HOME=/tmp/empty-home uteke doctor
  ✓ SQLite DB: 8045 memories  # <- opened ~/.codecora/uteke (prod), not the env home
  • New resolution order: --store flag > UTEKE_HOME env > uteke.toml [store].path > default, implemented as a shared resolve_store_path() in the CLI crate
  • Both call sites fixed: main and repair --rebuild (which resolved index paths independently — the most destructive command to mis-target)
  • Sequential precedence test covering all four cases (env-var tests merged into one #[test] to avoid the parallel env-mutation race pattern seen in ort_init)

Why

Operator trap with real consequences: during v0.16.0 pre-release QA this caused accidental v16+v17 schema migrations on a live DB (additive, non-destructive, but proves the risk). Also fixes an inconsistency: uteke-serve honors UTEKE_HOME for the DB while the CLI did not.

Testing

  • cargo test --workspace → 11/11 suites green (55 uteke-cli tests, incl. the new precedence test, 3x stable)
  • Empirical isolation check: UTEKE_HOME=<empty dir> ./target/debug/uteke doctor → DB: 0 memories in that dir (previously: 8045 from prod default)
  • cargo fmt + clippy --workspace --all-targets -D warnings clean

Closes #1105

The CLI resolved its store from --store or uteke.toml only, ignoring
UTEKE_HOME — so an isolated-looking invocation silently opened the
default (often production) database. During v0.16.0 pre-release QA this
caused accidental v16+v17 schema migrations on a live DB.

Resolution order is now --store > UTEKE_HOME > uteke.toml > default,
via a shared resolve_store_path() used by both main and repair --rebuild
(the latter resolves index paths independently and is the most
destructive command to mis-target).

Verified empirically: UTEKE_HOME=<empty dir> uteke doctor now reports
DB=0 in that dir instead of the default store's 8045 memories.

Closes #1105
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 72fd7d9 into develop Aug 26, 2026
15 checks passed
@ajianaz
ajianaz deleted the fix/1105-uteke-home-store-override branch August 26, 2026 10:06
ajianaz added a commit that referenced this pull request Sep 6, 2026