Skip to content

test: check the XDG_STATE_HOME branch in database-path-agreement - #830

Merged
vladimirrott merged 2 commits into
lacs-project:mainfrom
MaxonT:contrib/818-auto
Nov 21, 2026
Merged

vladimirrott merged 2 commits into
lacs-project:mainfrom
MaxonT:contrib/818-auto

Conversation

@MaxonT

@MaxonT MaxonT commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #818

tests/release/database-path-agreement.test.sh only asked the installer for its database path with XDG_STATE_HOME unset, so the other branch of databasePath() in packages/setup/install-daemon.js was never compared with the daemon's.

This adds a second comparison: the installer is asked with XDG_STATE_HOME=/xdg/state, and the answer is compared with /xdg/state/ plus the suffix read out of the PathBuf::from(state).join("...") line in crates/sysknife-core/src/lib.rs (grep on the source, no build). The expected value is not computed with the installer's own path.join. The existing fallback check and the docs check are unchanged. If the join line can no longer be found, the guard fails with a message instead of passing.

What I ran

  • bash tests/release/database-path-agreement.test.sh on the unmodified installer: exit 0.
  • Mutation from the issue: 'sysknife' changed to 'sysknife-audit' on the xdgState branch of install-daemon.js:
    • the updated test exits 1 and prints installer: /xdg/state/sysknife-audit/daemon.sqlite against daemon: /xdg/state/sysknife/daemon.sqlite;
    • the previous version of the test exits 0 on the same mutant (that is the gap the issue describes).
  • Mutation reverted afterwards; bash -n on the script is clean.
  • Not run: the Rust build, the full CI suite, scripts/ci-local.sh, shellcheck (not installed here).

@MaxonT
MaxonT requested a review from vladimirrott as a code owner November 20, 2026 17:42

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 3ded27ac3c101c9ede8838341b68f9473775dcd3.

Reading the daemon's suffix out of default_database_path() instead of rebuilding it with the installer's own path.join is the detail that makes this test worth having: it compares two pieces of code, not one with itself. The loud failure when the join line changes shape is the right default too.

I ran tests/release/database-path-agreement.test.sh in a container with no network:

tree result
your head rc=0, Installer, daemon and docs agree on /home/testuser/.local/state/sysknife/daemon.sqlite.
installer's XDG branch changed to 'sysknife-audit' rc=1, installer (install-daemon.js): /xdg/state/sysknife-audit/daemon.sqlite against daemon (default_database_path): /xdg/state/sysknife/daemon.sqlite
daemon's XDG join changed to sysknife/audit.sqlite rc=1, installer: /xdg/state/sysknife/daemon.sqlite against daemon: /xdg/state/sysknife/audit.sqlite
the installer mutant on main's test rc=0 (the gap #818 describes)

shellcheck --severity=warning (0.10.0) is clean on the script, which covers the one check you couldn't run locally.

Nothing blocks this. Approving. Your CI runs are waiting on an approval that is mine to give, so the merge is on my side from here.

If you run Linux machines yourself, npx sysknife-setup --daemon-mode=user installs SysKnife with no system service and read-only actions only. No obligation.

@vladimirrott
vladimirrott merged commit 54ca24e into lacs-project:main Nov 21, 2026
14 checks passed
@MaxonT

MaxonT commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Sysknife has my attention, and I'd like to stay involved, both by sending more changes and by helping maintain it down the road. If it would help you, I'd welcome being considered for collaborator access, and no worries at all if not.

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.

database-path-agreement.test.sh never checks the XDG_STATE_HOME branch, so the installer and daemon can drift there

2 participants