Skip to content

feature: source file load from subtree#48

Merged
asadijabar merged 4 commits into
mainfrom
feature/sourcefile-load-from-subtree
Mar 4, 2026
Merged

feature: source file load from subtree#48
asadijabar merged 4 commits into
mainfrom
feature/sourcefile-load-from-subtree

Conversation

@Azhovan
Copy link
Copy Markdown
Owner

@Azhovan Azhovan commented Mar 4, 2026

What

Add Root support to sourcefile.Options so 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.ErrRootNotFound
  • sourcefile.ErrRootNotMap
  • sourcefile.ErrInvalidRoot

Plus 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 that sourcefile should handle directly.

Type

  • Fix
  • Feature
  • Docs
  • Performance
  • Breaking change

Testing

# Commands you ran
gofmt -w sourcefile/file.go sourcefile/file_test.go
go test ./sourcefile
go test ./...
make ci

closes #47

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.Options with Root and 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 Root behavior and new error types; expand .gitignore entries 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.

Comment thread sourcefile/file.go Outdated
Comment thread sourcefile/file_test.go Outdated
@asadijabar asadijabar force-pushed the feature/sourcefile-load-from-subtree branch from bfedcf1 to 5290b1f Compare March 4, 2026 11:32
@asadijabar asadijabar requested a review from Copilot March 4, 2026 15:08
@asadijabar asadijabar changed the title Feature/sourcefile load from subtree feature: source file load from subtree Mar 4, 2026
@asadijabar asadijabar merged commit 97a6b1e into main Mar 4, 2026
8 checks passed
@github-actions github-actions Bot deleted the feature/sourcefile-load-from-subtree branch March 4, 2026 15:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread sourcefile/file_test.go
Comment thread sourcefile/file.go
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.

sourcefile load from a subtree

3 participants