Skip to content

config: single source of truth for example/default configs #1402

Closed

Description

@thiras

Problem

The node/CLI config schema is currently written out in full in at least five independent, partially-divergent places. There's no single source of truth, so every schema change (new key, renamed section) has to be mirrored by hand across all copies — and some copies have already drifted stale.

Enumeration of the divergent copies:

  1. crates/cli/src/commands/config.rs — const DEFAULT_CONFIG: &str (~L415-564). The canonical, fully-commented template written by decdn config init. Covers every section.
  2. examples/configs/arbitrum-sepolia.toml + examples/configs/arbitrum-sepolia-client.toml — concrete Arbitrum Sepolia testnet values (real genesis addresses, MUST-EDIT markers). Separate hand-maintained copies of the node + client schema subsets.
  3. crates/e2e/src/node.rs — fn render_config() (~L554-604) builds a full node.toml via format!. Another full copy used by the e2e harness.
  4. crates/cli/tests/config_validate.rs — VALID_CONFIG / MISSING_RPC / MULTI_ERROR fixture strings + sample_resolved() struct literal.
  5. adr/012-client.md (~L172-199) — a client "Default configuration" block that is stale: it uses [network] rpc_url, [bootstrap], [keys] iroh_key_path/eth_keystore_path, [cache] probe_cache_* — key/section names that no longer match the real schema (e.g. rpc_url lives under [blockchain]). This one actively contradicts DEFAULT_CONFIG.

Additional smaller config snippets exist in CHANGELOG.md (origin migration + S3/R2/MinIO examples), adr/011-content-takedown.md ([content] denylist), and various node reload/sighup tests — those are illustrative and lower priority.

Why this matters

Per the workspace SoT rule, divergence like adr/012-client.md is exactly the failure mode we try to avoid: a doc that contradicts the implementation. Each new config knob today is a "touch 5 sites" chore, and it's easy to miss one.

Proposed direction (to be brainstormed)

Establish DEFAULT_CONFIG (or a shared example asset it's derived from) as the single source, and have the other copies either derive from it or be verified against it:

  • Examples (examples/configs/*.toml): add a test that parses each example file through the real config resolver, so a schema change that breaks an example fails CI instead of silently drifting.
  • e2e render_config(): consider generating from DEFAULT_CONFIG (parse → override the fields the harness needs → re-serialize) rather than maintaining a parallel format! template.
  • adr/012-client.md: fix the stale block now (or replace it with a link to the canonical example), independent of the larger refactor.
  • Optionally: a round-trip test asserting DEFAULT_CONFIG itself parses + validates (guards the canonical copy).

Exact mechanism is open — the goal is that there is one place to edit and everything else is checked against it.

Acceptance criteria

  • A single canonical source for the example/default config is identified/established.
  • Example config files under examples/configs/ are validated against the real schema in CI.
  • The stale adr/012-client.md config block is corrected or replaced with a pointer to the canonical example.
  • Adding a new config knob no longer requires hand-editing multiple full-config copies (or, where copies must remain, CI catches drift).

Activity

  1. added
    design:consistency
    rust
    area:cli
    on Jul 22, 2026
  2. self-assigned this
    on Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:clidesign:consistencyrust

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions