Skip to content

Add a ConfigStore interface#17968

Open
rasmusrygaard wants to merge 1 commit intomainfrom
dev/rasmus/config_store
Open

Add a ConfigStore interface#17968
rasmusrygaard wants to merge 1 commit intomainfrom
dev/rasmus/config_store

Conversation

@rasmusrygaard
Copy link
Copy Markdown
Contributor

Add a ConfigStore interface for reading config files. By default we'll back this with a local-only implementation, which I'll add in a follow-up

@rasmusrygaard rasmusrygaard force-pushed the dev/rasmus/config_store branch from ce0a0d2 to 6e9afdf Compare April 15, 2026 18:25
Copy link
Copy Markdown
Contributor

@wiltzius-openai wiltzius-openai left a comment

Choose a reason for hiding this comment

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

How are we going to handle typing of the config documents? Will there be specific config file loaders that have schemas knowing what fields they expect etc, and we'll hand them a ConfigStore to do the actual byte fetching?

I had originally imagined this interface would have more structured config knowledge in it rather than a generic loader, but if those exist elsewhere and this is only meant to abstract away whether its loaded from filesystem or somewhere else it seems reasonable.

use crate::ConfigStoreResult;
use crate::ReadConfigDocumentParams;

/// Storage-neutral reader for path-addressed config documents.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

are all implementations going to be path-addressed? are we going to invent some special path namespacing to make them generic (rather than fs paths)?


/// Byte span for a config document parse error.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ConfigDocumentErrorSpan {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

interesting that we need structured byte span ranges for errors, I'd have guessed that could be represented simply in an error string

@rasmusrygaard
Copy link
Copy Markdown
Contributor Author

The code parses these values into ConfigToml. I guess we could also parse into that type instead of the raw document? It would just require updating more code that reads these values to use the parsed type when merging, right now we can just merge toml values together

@wiltzius-openai
Copy link
Copy Markdown
Contributor

Huh -- I had assumed we want to decide value precedence on more of a case by case basis rather than using a general toml merge, but I haven't examined how this works today. Fine w/ me if this is simpler and works.

@rasmusrygaard
Copy link
Copy Markdown
Contributor Author

the other thing that's helpful about the toml merges is that presence can be 1/ not set 2/ set to none/default 3/ set to some value. We mostly have Option types in ConfigToml which means we can only track 1 and 3 without having Option<Option<...>>

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.

2 participants