feat(overlays): handle empty sections explicitly#208
Open
dmcilvaney wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds explicit “whole-spec” behavior for spec overlays when section is omitted, avoiding the previous ambiguity where an empty section could be interpreted as the global section (especially for append). This fits into the overlays system by making overlay targeting rules clearer, enforcing invalid field combinations at config-validate time, and updating schema/docs/snapshots accordingly.
Changes:
- Add
Spec.PrependLines/Spec.AppendLinesto insert lines at the very top/bottom of a spec file. - Update spec overlay application so
spec-prepend-lines/spec-append-lineswith nosectiontarget the whole file. - Tighten overlay validation to reject
packagewhensectionis omitted for whole-file-capable overlays, and update schema/docs/snapshots/tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| schemas/azldev.schema.json | Updates schema descriptions for section/package to document whole-file targeting and the package constraint. |
| scenario/snapshots/TestSnapshotsContainer_config_generate-schema_stdout_1.snap | Updates schema snapshot output to match new descriptions. |
| scenario/snapshots/TestSnapshots_config_generate-schema_stdout_1.snap | Updates schema snapshot output to match new descriptions. |
| internal/rpm/spec/edit.go | Adds whole-file prepend/append APIs on Spec. |
| internal/rpm/spec/edit_test.go | Adds unit tests covering new PrependLines/AppendLines behavior. |
| internal/projectconfig/overlay.go | Documents whole-file targeting semantics; adds validation rejecting package when section is omitted for applicable overlay types. |
| internal/projectconfig/overlay_test.go | Adds validation test cases for whole-file targeting + invalid package usage. |
| internal/app/azldev/core/sources/overlays.go | Routes empty-section prepend/append overlays to the new whole-file Spec methods. |
| internal/app/azldev/core/sources/overlays_test.go | Adds tests for applying whole-file prepend/append and whole-file search/replace behavior. |
| docs/user/reference/config/overlays.md | Documents whole-file targeting semantics and provides examples. |
Comment on lines
+210
to
+216
| // requireSectionIfPackageSet checks that, for overlays that may target either a single | ||
| // section or the entire spec file (indicated by omitting `section`), a `package` is only | ||
| // specified when a `section` is also specified. A package is always a sub-qualifier of | ||
| // a section, so specifying one without the other is meaningless. | ||
| requireSectionIfPackageSet := func() error { | ||
| if c.SectionName == "" && c.PackageName != "" { | ||
| return unexpectedField("package") |
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.
No description provided.