fix(nodes): honour storage dir setting + show real storage usage#34
Merged
Nic-dorman merged 2 commits intomainfrom Apr 22, 2026
Merged
fix(nodes): honour storage dir setting + show real storage usage#34Nic-dorman merged 2 commits intomainfrom
Nic-dorman merged 2 commits intomainfrom
Conversation
The per-node Storage field always showed 0 B because we pointed at
`${dataDir}/chunks.mdb` — LMDB's default subdir layout makes that a
directory, not a file. `std::fs::metadata(dir).len()` returns a trivial
value on Windows and macOS, which the old code then clamped to zero
after subtracting a 16 KB "empty LMDB" baseline.
Point at the actual payload file `chunks.mdb/data.mdb`, and route
through a new `get_disk_usage` Tauri command that reports on-disk bytes
allocated (not the logical file length). On Unix that's
`stat.st_blocks * 512` so a sparse LMDB map reports real
chunks-stored rather than the configured map size. On Windows the
command falls back to `metadata.len()` since NTFS doesn't mark LMDB
`data.mdb` as sparse in our current ant-node config.
Belt-and-suspenders until the upstream daemon exposes storage usage
(see project_todo_daemon_storage_api.md).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The "Storage Directory" setting was persisted to config.toml but never
sent to the daemon on add_nodes, so every new node landed in the
default data directory regardless of the user's choice. ant-core's
add_nodes endpoint already supports data_dir_path and auto-appends
node-{id} per node, so we just need to pass it through.
Also clarifies in Settings that the directory only affects newly
added nodes — existing nodes keep their original data_dir in
node_registry.json and are not migrated.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #33
Summary
Two related node-management fixes that shipped broken:
storage_dirsetting was ignored. Every new node landed in the daemon's default data dir becausestores/nodes.ts::addNodesnever passeddata_dir_pathon the request, even though the setting was persisted toconfig.tomland ant-core's add endpoint already accepts it. Also makes it explicit in the Settings UI that the directory only applies to newly added nodes (existing nodes aren't migrated). As a small follow-on,addNodesnow firesenrichNodeDetailsright after the add so the node tile shows itsdata_dirwithout needing a refresh.Per-node Storage field always read 0 B. We were pointing
get_file_sizeatchunks.mdb, which under LMDB's default layout is a directory, not a file —metadata.len()on a directory returns a trivial value that the old baseline subtraction clamped to zero. We now readchunks.mdb/data.mdbvia a newget_disk_usageTauri command that reports the filesystem-allocated bytes (sparse-aware on Unix,metadata.len()on Windows).Supersedes #31 — this branch contains the same storage-display fix plus the storage-dir fix on top. Please merge this and close #31 as duplicate.
Test plan
data_dirlives under<new-dir>/node-<id>/(verified on local release build).project_todo_daemon_storage_api.md), drop the on-disk workaround.🤖 Generated with Claude Code