Skip to content

chore(config)!: migrate config file format from YAML to TOML#37

Merged
chaliy merged 1 commit into
mainfrom
claude/maint-config-toml-t0rOv
May 17, 2026
Merged

chore(config)!: migrate config file format from YAML to TOML#37
chaliy merged 1 commit into
mainfrom
claude/maint-config-toml-t0rOv

Conversation

@chaliy
Copy link
Copy Markdown
Owner

@chaliy chaliy commented May 17, 2026

What

Breaking change: migrate the config file format from YAML to TOML and drop serde_yaml.

  • Replace serde_yaml = "0.9" with toml = "1.1" in Cargo.toml.
  • Rename Config::from_yamlConfig::from_toml; parser switches to toml::from_str.
  • Config::from_file and the --config CLI flag are unchanged — only the file contents differ.
  • Convert the two bundled sample configs (benchmarks/config/benchmark.yaml, chaos.yaml) to .toml.
  • Update inline test fixtures, the README config block, the architecture spec, the load-test skill, the CLI help text, and benchmarks/run-benchmark.sh.
  • Add a CHANGELOG entry with a migration guide.

Why

serde_yaml is published as 0.9.34+deprecated and the upstream dtolnay/serde-yaml repo is archived. Every successor fork is stale (latest releases as of today, 2026-05-17):

Crate Last release Status
serde_yaml (current) 0.9.34+deprecated Archived
serde_yml 2024-08-25 21 months stale; contentious history
serde-yaml-ng 2024-05-26 24 months stale
serde_norway 2024-12-21 17 months stale
toml 2026-04-01 Active — Cargo team, 4 releases in last 30 days

LLMSim's config is a flat, typed, commented dict — exactly TOML's sweet spot. We use zero YAML-specific features (anchors, merges, multi-doc, …), so the migration is mechanical. TOML is also the idiomatic Rust ecosystem config format.

How

  • Source change is a one-function rewrite (Config::from_toml); everything else is fixture/doc conversion.
  • All four inline test strings were translated YAML→TOML one-to-one.
  • Smoke-tested the built binary with --config benchmarks/config/benchmark.toml --port 8888: /health, /openai/v1/chat/completions, /openai/v1/models all respond correctly with the TOML-configured latency=fast, target_tokens=100.

Migration for existing users

- # config.yaml
- server:
-   port: 8080
- response:
-   generator: "lorem"
-   target_tokens: 100
- models:
-   available:
-     - "gpt-5"
-     - "gpt-4o"
+ # config.toml
+ [server]
+ port = 8080
+
+ [response]
+ generator = "lorem"
+ target_tokens = 100
+
+ [models]
+ available = ["gpt-5", "gpt-4o"]

Rules: section:[section], key: valuekey = value, quote strings, YAML lists → TOML arrays. See benchmarks/config/*.toml for full working examples.

Risk

  • Medium, surfaced clearly. This is a breaking change for any user with an existing config.yaml. Mitigations:
    • Project is 0.2.x (pre-1.0), so breaking changes are within semver allowance.
    • CHANGELOG includes a side-by-side migration snippet.
    • The --config flag name is unchanged — only the file format moves.
    • Conversion is mechanical and small (typical user configs are ~10-20 lines).

Checklist

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings (clean on rustc 1.95)
  • cargo test (166 passed)
  • Smoke test with --config benchmarks/config/benchmark.toml
  • No serde_yaml references remain outside CHANGELOG explanation
  • README, architecture spec, CLI help, and load-test skill updated

BREAKING CHANGE: The configuration file format moves from YAML to TOML.

Why
- serde_yaml ships as 0.9.34+deprecated and the upstream repo is
  archived. Every successor fork (serde_yml, serde-yaml-ng,
  serde_norway) has had no release in 1.5+ years.
- The toml crate is actively maintained by the Cargo team (releases
  in the past month) and is the idiomatic Rust config format.
- LLMSim's config is a flat, typed, commented dict — exactly TOML's
  sweet spot. We used no YAML-specific features (anchors, merges,
  multi-doc, etc.), so the migration is mechanical.

Changes
- Replace `serde_yaml = "0.9"` with `toml = "1.1"` in Cargo.toml.
- Rename `Config::from_yaml` to `Config::from_toml` and parse with
  `toml::from_str`. `Config::from_file` and the `--config` CLI flag
  are unchanged (only the file contents differ).
- Convert the two bundled sample configs:
  - benchmarks/config/benchmark.yaml -> benchmark.toml
  - benchmarks/config/chaos.yaml     -> chaos.toml
  and point `benchmarks/run-benchmark.sh` at the new paths.
- Update inline test fixtures in `src/cli/config.rs` and
  `tests/integration_test.rs` to TOML.
- Update README, AGENTS-adjacent docs, the architecture spec, the
  load-test skill, and the CLI help text to reference `config.toml`.
- Add a CHANGELOG entry with a migration guide.

Migration for existing users
- Replace `section:` with `[section]`
- Replace `key: value` with `key = value`
- Quote strings and convert YAML lists to TOML arrays
- See benchmarks/config/*.toml for a working before/after example
@chaliy chaliy merged commit 7d9a0dc into main May 17, 2026
11 checks passed
@chaliy chaliy deleted the claude/maint-config-toml-t0rOv branch May 17, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant