stratum-node-config 0.1.0-alpha.4

Versioned stratum.toml schema, comment-preserving editor, semantic validator, change preview and public-config hash for Stratum nodes
Documentation
# stratum-node-config

> [!WARNING]
> **Pre-release (`0.1.0-alpha`).** The API, the `stratum.toml` schema and the
> public-hash encoding may change before 0.1.0. Nothing built on it has been
> deployed yet.

The configuration library of a [Stratum](https://github.com/DreamLab-AI/stratum)
node. It works on text and values only: no filesystem, network, clock,
environment or secret resolution.

- **One schema table.** Every field of `stratum.toml` has a dotted path, a
  type (string, ranged integer, boolean, enum, list of strings or secret
  reference), a default, a description and an apply class (`live`,
  `restart`, `redeploy`). Validation, the commented seed document, the typed
  accessors, the public view and the JSON served by a schema endpoint are
  all derived from that one table.
- **Semantic validation.** Parsing reports every error, not just the first:
  syntax, a missing or unsupported `schema_version`, unknown keys, wrong
  types, out-of-range values, field rules (loopback listen address, HTTPS
  origin, absolute paths, age recipients) and cross-field conflicts.
- **Preview.** A list of `{path, value}` changes becomes, without side
  effects, the edited TOML (comments and key order preserved), a unified
  diff, a change list in schema order with secret references redacted, each
  change's apply class, the strictest class overall, and the validation
  errors of the result.
- **Membership and pod limits.** `membership.max_tenants`,
  `membership.invitations_enabled`, `membership.invitation_ttl_secs`,
  `limits.max_pod_body_bytes`, `limits.admission_requests_per_minute` and
  `limits.min_pod_free_bytes`, all applied live, with typed accessors.
- Step 3a fields: `membership.removal_grace_days` (default 30, 0 allowed;
  the node floors the grace at 120 seconds) and `limits.pod_bytes_per_tenant`
  (default 10 GiB, 0 means no limit), both applied live, with
  `Config::removal_grace` and `Config::is_over_quota`.
- **Public hash.** SHA-256 over a documented canonical encoding of the
  effective configuration with secret-reference fields removed, prefixed
  with a hash-format version.

## Example

```rust
use stratum_node_config::{preview, schema, ApplyClass, Change, ConfigDocument};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let seed = schema().seed_text();
    let before = ConfigDocument::parse(&seed)?;

    let p = preview(&seed, &[
        Change::new("node.name", "alpha"),
        Change::new("limits.max_body_bytes", 65_536),
    ])?;
    assert!(p.errors().is_empty());
    assert_eq!(p.strictest_apply_class(), Some(ApplyClass::Restart));
    println!("{}", p.diff());

    let after = p.into_document().ok_or("edit should be valid")?;
    assert_eq!(after.config().max_body_bytes(), 65_536);
    assert!(after.config().listen_address().ip().is_loopback());
    assert_ne!(after.public_hash(), before.public_hash());
    Ok(())
}
```

## Minimum supported Rust version

1.89.

## Licence

AGPL-3.0-only. See [LICENSE](LICENSE).