Skip to content

Tracking: typed config — centralized validation, single source of defaults, no silent coercions #215

Description

@erskingardner

Root cause

Configuration correctness is enforced ad hoc, in three scattered ways, so misconfiguration fails silently at runtime instead of loudly at load:

  1. Two sources of defaults: every field has a set_default(...) in base_config_builder() (src/config.rs:579-661) and a serde default_* fn — the serde ones are dead on the production load path, so the pairs can silently drift ([LOW] Config defaults are duplicated between base_config_builder set_default(...) and serde default_* fns (which are dead for the load path) — silent drift risk #171).
  2. Free-form primitives for constrained values: logging.format/logging.level are Strings matched at runtime with silent fallthrough arms (src/main.rs init_logging), health.bind_address is an unparsed String, relay URLs are Vec<String> with validation only for the clearnet list, cache/concurrency sizes are plain usize.
  3. Silent coercions far from load: zero/invalid values are "fixed" inside constructors where the operator can't see it — RateLimiter::new swaps max_entries = 0 for 100k (src/rate_limiter.rs:191), the dedup cache does the same (src/nostr/events.rs:511), event_processing_permits clamps (src/main.rs:166) while an oversized value panics in Semaphore::new.

Each member issue is one instance of "config that lies": a value the operator sets that either does nothing, does something else, or detonates later.

Refactor design

Members

In-flight PRs

Sequencing

Wave 1; fully parallel (config.rs + constructor signatures only). The rate-limit admission tracker consumes this tracker's typed NonZeroUsize configs, so it starts after this lands (soft dependency).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions