Skip to main content

Module install_state

Module install_state 

Source
Expand description

User-level install state (VIS-1109): what this machine’s TraceVault setup was last brought to, so a newer CLI knows to run its upgrade step once (commands::upgrade), and the user’s Claude Code telemetry opt-out, so nothing ever turns telemetry back on after --no-claude-telemetry.

Kept in ~/.config/tracevault/install-state.json, beside config.toml: config.toml is rewritten from its struct by init --global, and a repo’s .tracevault/ does not exist in workspace mode.

Structs§

InstallState
Lock
Serialises whoever changes the telemetry settings together with this state: the upgrade step and telemetry on|off / init. Without it, an upgrade that read the state before an opt-out could turn telemetry back on and save its stale copy over the opt-out. Also keeps two sessions starting at once from both showing the notice. A lock older than Lock::STALE was left by a killed process and is taken over. Released on drop.
RepoState

Constants§

CURRENT_VERSION
This binary’s version.

Functions§

is_newer
Whether current is newer than the recorded version. Nothing recorded (or something unparseable) counts as older, so the step runs; a recorded version newer than current (a downgrade) does not.
load_in
The state under config_root; a missing or unreadable file is an empty state (every step then runs once, which is safe: each one is idempotent).
save_in
Write state atomically (temp file + rename), creating config_root.
state_path_in
update_in
Load, apply change, save.