feature: source file load from subtree#48
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Root support to sourcefile so consumers can load configuration from a dot-path subtree (e.g., hub.msa) and flatten keys relative to that subtree, with typed/inspectable errors for root resolution failures.
Changes:
- Extend
sourcefile.OptionswithRootand implement subtree resolution + new typed root errors. - Add tests covering successful subtree loading, typed root error cases, and missing-file behavior with
Root. - Update docs to describe
Rootbehavior and new error types; expand.gitignoreentries for Go/editor artifacts.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
sourcefile/file.go |
Implements Options.Root, adds root-specific sentinel errors, and resolves/validates the requested subtree before flattening. |
sourcefile/file_test.go |
Adds coverage for subtree loading and root error conditions, plus missing-file behavior when Root is set. |
docs/configuration-sources.md |
Documents Root usage and the new typed root errors. |
.gitignore |
Broadens ignored patterns for Go build/coverage outputs and common editor/OS artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bfedcf1 to
5290b1f
Compare
asadijabar
approved these changes
Mar 4, 2026
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
Rootsupport tosourcefile.Optionsso file sources can load from a dot-path subtree (for example,hub.msa) and flatten keys relative to that subtree.Also add typed root errors:
sourcefile.ErrRootNotFoundsourcefile.ErrRootNotMapsourcefile.ErrInvalidRootPlus tests and docs updates for the new behavior.
Why
Many deployments keep multiple component configs in one file. Without
Root, each component must build a custom source/transformer to extract its section, which duplicates logic thatsourcefileshould handle directly.Type
Testing
closes #47