feat(overlays): add overlay metadata and per-file overlay format (1/3)#249
Conversation
Add an optional [metadata] block on overlays (category, commits, bug links, upstreamable) declared inline in component config files. The metadata is documentation only and is excluded from component fingerprints, so editing it never invalidates build caches. Regenerate JSON schema; update reference docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d38d17d to
cf624a1
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds documentation-only overlay metadata plus a new “per-file overlay” document format (overlay-files) that lets a component load and append overlays from one or more TOML files, without affecting overlay application behavior or component fingerprints.
Changes:
- Added optional per-overlay
metadata(category/commits/bugs/upstreamable) and validation for it. - Added
overlay-fileson components and a loader that expands globs, parses overlay documents deterministically, stamps file-level metadata onto overlays, and resolvessourcerelative to the overlay file. - Updated fingerprint exclusions, config reference docs, JSON schema, and scenario snapshots.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| schemas/azldev.schema.json | Schema updates for overlay-files and overlay metadata. |
| scenario/snapshots/TestSnapshotsContainer_config_generate-schema_stdout_1.snap | Snapshot update reflecting regenerated schema output. |
| scenario/snapshots/TestSnapshots_config_generate-schema_stdout_1.snap | Snapshot update reflecting regenerated schema output. |
| internal/projectconfig/overlay.go | Adds ComponentOverlay.Metadata and validates it during overlay validation. |
| internal/projectconfig/overlay_metadata.go | Introduces OverlayMetadata/BugRef, category enum, cloning, and validation. |
| internal/projectconfig/overlay_metadata_test.go | Unit tests for metadata validation and overlay validation integration. |
| internal/projectconfig/overlay_file.go | Implements overlay-file parsing/loading, glob expansion, and metadata stamping. |
| internal/projectconfig/overlay_file_test.go | Unit tests for overlay-file loading behavior and ordering/deduplication. |
| internal/projectconfig/loader.go | Hooks overlay-file processing into config load before validation. |
| internal/projectconfig/fingerprint_test.go | Registers new fingerprint exclusions for overlay metadata and overlay-files. |
| internal/projectconfig/component.go | Adds OverlayFiles field and preserves it in WithAbsolutePaths. |
| docs/user/reference/config/overlays.md | Documents overlay metadata and the per-file overlay format. |
cf624a1 to
be5450a
Compare
be5450a to
9890d21
Compare
| return nil, fmt.Errorf("%w: %q", ErrOverlayFilesNoMatches, pattern) | ||
| } | ||
|
|
||
| sort.Strings(matches) |
There was a problem hiding this comment.
Not sure it matters, all files should have the same directory structure, but as written in the docs it should sort by basename.
There was a problem hiding this comment.
Thanks for catching this! Updated to align with the docs, sort files in filename lexicographic order.
9890d21 to
64b2ed9
Compare
Add ComponentConfig.OverlayFiles: a list of globs (relative to the component config file) that are matched at load time to discover per-file overlay documents. Each file declares a single [metadata] block plus an ordered list of [[overlays]]; the file-level metadata is stamped onto every overlay in the file. Matches are concatenated in declaration order and applied in filename order within each glob. Globs that match no files are surfaced as a configuration error. Per-overlay [metadata] is rejected inside an overlay file (the file-level metadata is the single source of truth). Relative source paths in overlay files are resolved against the overlay file's directory. OverlayFiles is excluded from the fingerprint because it affects only where overlays are sourced from, not their content. Regenerate JSON schema; update reference docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
64b2ed9 to
1516af2
Compare
reubeno
left a comment
There was a problem hiding this comment.
Generally looks pretty good to me -- just a few questions/comments.
| // Resolve per-component overlay file globs, stamping each | ||
| // file's [metadata] onto its overlays and appending them to the component before | ||
| // validation runs. | ||
| if err := applyOverlayFiles(fs, cfg, permissiveConfigParsing); err != nil { |
There was a problem hiding this comment.
This seems out-of-place as a special case in the toplevel loader function. Is there a way we could have done this closer to where the component / overlays are being resolved/loaded?
There was a problem hiding this comment.
I considered moving this closer to component resolution, but it would require passing permissiveConfigParsing into the merge/resolve path, which currently only works on already-decoded config structs. Daniel will clean up the loading stuff, and we can move this closer to component resolution then.
There was a problem hiding this comment.
I think it's worth making that change -- I see this as adding debt; I'm okay if you defer to a later PR, but my request is that you file a bug on it and assign to yourself ( or Daniel if he's willing to take it) to make sure this doesn't get forgotten.
This PR is the first of three-split out from the previous overlay-metadata PR (#242). It adds two related ways to document overlays without affecting how they're applied. The follow-ups will add component-group metadata (PR 2) and the
azldev component metadatacommand that consumes both (PR 3).What's new
Inline [metadata] block on overlays (commit 1)
Optional table on any overlay with:
Per-file overlay format via overlay-files (commit 2)
For logical changes that span multiple overlays (CVE backports, feature disablements, etc.), set overlay-files on a component to one or more globs. Each matched file declares a single file-level [metadata] block (stamped onto every overlay in the file) plus an ordered list of [[overlays]].
Files are loaded in filename order within each glob, globs concatenated in declaration order, duplicates de-duped. Per-overlay [metadata] is rejected inside an overlay file (file-level metadata is the single source of truth). Relative source paths resolve against the overlay file's directory. An empty glob match is a configuration error.
Notes
azldev component metadataconsumes this in a follow-up PR.