Finder .DS_Store in var/state.db permanently blocks legacy SurrealKV retirement
Summary
validate_legacy_surrealkv_entry allow-lists the entries permitted in a released legacy SurrealKV tree and hard-fails on anything else. On macOS, Finder writes .DS_Store into any directory a user browses — including ~/.astrid/var/state.db — so simply opening ~/.astrid in Finder is enough to make the daemon refuse to boot, permanently:
Error: Failed to boot Kernel: unexpected entry in released legacy SurrealKV source: .DS_StoreThere is no message telling the operator that deleting the file is safe and sufficient.
Mechanism
crates/astrid-core/src/dirs_layout_retirement.rs:141 enumerates exactly what may appear:
let valid = match components.as_slice() {
[entry] if entry.as_os_str() == "LOCK" => is_file,
[entry] if matches!(entry.as_os_str().to_str(),
Some("manifest" | "wal" | "sstables" | "vlog" | "versioned_index")) => is_directory,
...
_ => false,
};
if !valid {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("unexpected entry in released legacy SurrealKV source: {}", relative.display()),
));
}The strictness is deliberate and the reasoning is sound — the comment at dirs_layout_retirement.rs:210 explains that remove_dir_all is avoided because it can walk into a mount. But the failure mode treats an inert 6 KB Finder cache file as indistinguishable from a redirected mount point, and the only path out is for the operator to read the source to discover what the allow-list contains.
The same tree is also inventoried and compared against the migration receipt at crates/astrid-core/src/dirs_layout.rs:381, so an added .DS_Store additionally makes source != receipt.intent.material.source. Both checks fail on a file macOS creates without being asked.
This is not hypothetical: I found .DS_Store in 12 directories under ~/.astrid, including var/state.db, secrets/claude-code/, secrets/default/, cow/, home/default/ and etc/.
Reproduction Steps
- Have a
~/.astridwith a legacyvar/state.dbawaiting retirement. - Open
~/.astrid/var/state.dbin Finder (or let Quick Look / Spotlight touch it). - Run
astrid start. - Boot fails with
unexpected entry in released legacy SurrealKV source: .DS_Store, and keeps failing.
rm ~/.astrid/var/state.db/.DS_Store clears it — but nothing in the error says so.
Expected Behavior
- Ignore known-inert platform metadata when validating a tree that is about to be deleted anyway. On macOS that is
.DS_Store; the entry is a regular file, carries no data the runtime wrote, and is removed along with the tree. - If ignoring is unacceptable, make the error actionable: name the full path and state that removing an unrecognised regular file is safe, rather than emitting a bare filename.
- Since
~/.astridlives under the user's home directory on macOS and will be browsed, consider writing a.metadata_never_indexmarker or otherwise discouraging Finder from writing into runtime state.
Environment
- OS: macOS 15.6 (Darwin 24.6.0), arm64
- Astrid: 2026.9.2, installed via
astrid update - Source: astrid-runtime/astrid @
73661c9b(Cargo version 0.10.4) - Legacy tree:
~/.astrid/var/state.db, 6.9 MB, awaiting retirement
Logs / Backtrace
i Starting Astrid daemon (persistent mode)...
2026-09-15T06:27:18.488311Z INFO astrid_config::loader: loaded user config path=/Users/jamie/.astrid/config.toml
✗ error: Daemon exited prematurely (exit status: 1). Check logs: /Users/jamie/.astrid/log
# ~/.astrid/log/daemon-boot.log
Error: Failed to boot Kernel: unexpected entry in released legacy SurrealKV source: .DS_Store$ ls -la ~/.astrid/var/state.db/
-rw-r--r--@ 1 jamie staff 6148 Sep 5 14:31 .DS_Store
-rw------- 1 jamie staff 6 Sep 15 09:16 LOCK
drwxr-xr-x 3 jamie staff 96 Sep 15 09:17 manifest
drwxr-xr-x 6 jamie staff 192 Sep 15 09:17 sstables
drwxr-x--- 2 jamie staff 64 Sep 15 09:17 walSource: astrid-runtime/astrid