Skip to content

[codex] Switch configuration system to TOML#218

Merged
Bathtor merged 6 commits intokompics:masterfrom
Bathtor:codex/issue-187-toml-proposal
Apr 14, 2026
Merged

[codex] Switch configuration system to TOML#218
Bathtor merged 6 commits intokompics:masterfrom
Bathtor:codex/issue-187-toml-proposal

Conversation

@Bathtor
Copy link
Copy Markdown
Contributor

@Bathtor Bathtor commented Apr 12, 2026

Summary

  • switch Kompact's configuration loading from HOCON to TOML
  • replace the parser-exposed config tree with Kompact-owned Config and ConfigValue types
  • add a path-aware fallible lookup API while keeping indexing as a panicking convenience API
  • update examples and docs to explicit TOML filenames and TOML syntax

Motivation

Rust support for HOCON is not in a good state, while TOML is well-supported and already familiar to Rust users. Since Kompact is still pre-1.0, this change intentionally takes the breaking API clean-up now instead of carrying parser-specific design constraints forward.

API Changes

  • KompactSystem::config() and ComponentContext::config() now return &Config
  • Config is now the public top-level document type; ConfigValue represents a single parsed value
  • config["a"]["b"] still works, but it is now a panicking convenience API, just like standard Rust indexing
  • fallible access is now config.get("a") for a top-level key and config.select("a.b") for dotted paths; both return a ConfigLookup that keeps the full accessed path for better error messages
  • typed config-entry reads are now config.read(&ENTRY) and config.read_or_default(&ENTRY) instead of get and get_or_default
  • durations and byte sizes remain available through as_duration() and as_bytes(), and TOML datetimes are preserved via as_datetime()
  • set_config_value(...) now injects directly into the overlay config instead of relying on parser-specific string snippets

Config Semantics

  • multiple config sources are merged hierarchically: nested tables merge recursively and later sources win
  • when the later source changes the value kind, it replaces the earlier value entirely, matching the permissive behaviour we had before with HOCON
  • TOML syntax replaces HOCON syntax, so values with units are written as strings such as "100 ms" and "128KiB"

Files And Examples

  • the user-facing example file is now app_settings.toml
  • the test fixture in core/src/lib.rs is now test_settings.toml
  • the local configuration guide now documents the difference between panicking indexing and the new fallible lookup API

Validation

  • cargo fmt --all
  • cargo test --workspace --no-run
  • cargo test --workspace

Fixes #187

Copy link
Copy Markdown
Contributor Author

@Bathtor Bathtor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think overall we stayed very close to HOCON API, which admittedly reduces breaking changes, but I think we there are places where we can and simply should do better and accept a bit more breakage at this point. It'll only be more painful later.

Copy link
Copy Markdown
Contributor Author

@Bathtor Bathtor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more comments, then it's ready.

Copy link
Copy Markdown
Contributor Author

@Bathtor Bathtor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple new comments.

@Bathtor Bathtor marked this pull request as ready for review April 14, 2026 08:03
@Bathtor Bathtor merged commit 5760708 into kompics:master Apr 14, 2026
23 checks passed
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.

Replace hocon configuration library

1 participant