Skip to content

doctor keeps a second, already-drifted copy of the daemon store-file list #2083

Closed

Description

@thiras

#2081 introduced decdn_common::data_dir as the single home for the names of the store files a daemon owns, so the CLI and the daemon cannot disagree about which files mean "a decdn-node has run here". decdn doctor keeps its own copy, and that copy has already drifted.

The duplicate

crates/cli/src/commands/doctor/state.rs:273-280:

const REDB: &[&str] = &[
    "lanes.redb",
    "settle.redb",
    "floor-loss.redb",
    "checkpoint.redb",
    "buyer.redb",
    "buyer-pools.redb",
];

versus crates/common/src/data_dir.rs, which defines NODE_BUYER_DB_FILE, NODE_LANES_DB_FILE, NODE_SETTLE_DB_FILE, NODE_CHECKPOINT_DB_FILE, CLIENT_BUYER_DB_FILE and the DAEMON_STORE_FILES set, and which channel_store.rs and buyer_pool_redb.rs both now source their filenames from.

Evidence the drift is not theoretical

floor-loss.redb is created by nothing. PersistentPoolStateStore::open opens exactly four family files (crates/node/src/channel_store.rs), and a repo-wide grep finds the name only in this list and in one stale doc comment:

  • crates/cli/src/commands/doctor/state.rs:276 — the list entry
  • crates/incentive/src/buyer_pool_table.rs:14 — module doc still describing "the seller lane, pending-settle, floor-loss, and watcher-checkpoint families"

So doctor silently reports on a file that cannot exist, and the doc claims a family the daemon does not open.

Why it matters beyond tidiness

doctor's list drives the permission and zero-length checks in check_state. A fifth daemon store added to channel_store.rs without a matching edit here is checked by nothing — and the same omission against DAEMON_STORE_FILES would weaken daemon_marker, whose failure mode is a wrong node-vs-client classification, i.e. the #2078 bug. One list makes both consequences share one edit.

Suggested direction

  1. Point doctor/state.rs at DAEMON_STORE_FILES plus CLIENT_BUYER_DB_FILE; drop floor-loss.redb.
  2. Fix the stale family list in buyer_pool_table.rs's module doc.
  3. Optional, and what would actually keep it honest: a unit test in channel_store.rs that opens PersistentPoolStateStore in a temp dir and asserts every DAEMON_STORE_FILES entry exists afterwards and that no .redb file outside the set was created. That turns "the daemon opens all of them at bring-up" — currently a prose claim in the data_dir module doc, and the premise daemon_marker rests on — into a checked fact that fires the moment a fifth store appears.

Activity

  1. added
    area:cli
    kind:chore
    on Sep 20, 2026
  2. moved this from Backlog to In progress in deCDNon Sep 20, 2026
  3. moved this from In progress to Done in deCDNon Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:clikind:chore

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions