Skip to content

libs/dyn/convert: suppress "unknown field" warnings for anchor containers#5975

Merged
pietern merged 8 commits into
mainfrom
suppress-list-anchor-warnings
Jul 21, 2026
Merged

libs/dyn/convert: suppress "unknown field" warnings for anchor containers#5975
pietern merged 8 commits into
mainfrom
suppress-list-anchor-warnings

Conversation

@pietern

@pietern pietern commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Bundle validation already suppresses "unknown field" warnings for standalone YAML anchors, but still warns when anchors are grouped inside a list or map, the common pattern of collecting reusable blocks under an x-* key:

x-anchors:
  - &a { name: foo }
  - &b { name: bar }

This adds a recursive isAnchorContainer check so a non-empty sequence or map whose elements are all anchors (or all anchor containers) is treated the same as a standalone anchor and does not trigger the warning. Empty containers and containers with any non-anchor element still warn as before. The unknown field is dropped from the normalized output regardless; only the spurious warning is suppressed.

This pull request and its description were written by Isaac.

pietern added 5 commits July 20, 2026 11:12
…ners

Bundle validation already suppresses "unknown field" warnings for
standalone YAML anchors, but still warns when anchors are grouped inside
a list or map, the common pattern of collecting reusable blocks under an
x-* key:

x-anchors:
  - &a { name: foo }
  - &b { name: bar }

This adds a recursive isAnchorContainer check so a non-empty sequence or
map whose elements are all anchors (or all anchor containers) is treated
the same as a standalone anchor and does not trigger the warning. Empty
containers and containers with any non-anchor element still warn as
before. The unknown field is dropped from the normalized output
regardless; only the spurious warning is suppressed.

Co-authored-by: Isaac
Co-authored-by: Isaac
The suppression does not depend on the x-* prefix, so use plain keys.

Co-authored-by: Isaac
Co-authored-by: Isaac
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 286272a

Run: 29731030706

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 227 1122 4:34
💚​ aws windows 4 4 229 1120 6:42
💚​ aws-ucws linux 4 4 314 1039 5:03
💚​ aws-ucws windows 4 4 316 1037 8:00
💚​ azure linux 4 4 227 1121 4:15
💚​ azure windows 4 4 229 1119 6:49
💚​ azure-ucws linux 4 4 316 1036 5:21
💚​ azure-ucws windows 4 4 318 1034 7:24
💚​ gcp linux 4 4 226 1123 4:00
💚​ gcp windows 4 4 228 1121 9:05
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 10 slowest tests (at least 2 minutes):
duration env testname
8:40 gcp windows TestAccept
6:44 aws-ucws windows TestAccept
6:23 azure windows TestAccept
6:18 aws windows TestAccept
6:16 azure-ucws windows TestAccept
2:58 azure linux TestAccept
2:56 gcp linux TestAccept
2:53 azure-ucws linux TestAccept
2:52 aws linux TestAccept
2:51 aws-ucws linux TestAccept

Comment thread libs/dyn/convert/normalize.go
pietern added 3 commits July 21, 2026 15:55
The acceptance test only exercised the no-warning path. Extend it to also
cover a container nested inside a container and a mixed container that holds a
non-anchor element (which is reported as an unknown field), documenting the
rationale for not suppressing the mixed case.

Co-authored-by: Isaac
Remove the parenthetical about x-* keys from the isAnchorContainer doc
comment and rename the unit test's unknown field from x-thing to thing, so
neither uses the x- prefix.

Co-authored-by: Isaac
@pietern
pietern enabled auto-merge July 21, 2026 14:20
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 1365452

Run: 29838319195

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws-cli-is linux 4 4 314 1045 4:17
💚​ aws-cli-is windows 4 4 316 1043 6:02
💚​ azure-cli-is linux 4 4 314 1044 4:32
💚​ azure-cli-is windows 4 4 316 1042 6:11
🟨​ gcp-cli-is linux 3 1 4 313 1046 7:59
🟨​ gcp-cli-is windows 3 1 4 315 1044 9:31
8 interesting tests: 4 SKIP, 3 KNOWN, 1 RECOVERED
Test Name aws-cli-is linux aws-cli-is windows azure-cli-is linux azure-cli-is windows gcp-cli-is linux gcp-cli-is windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🟨​K 🟨​K
🟨​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 🟨​K 🟨​K
🟨​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 🟨​K 🟨​K
Top 3 slowest tests (at least 2 minutes):
duration env testname
5:09 azure-cli-is windows TestAccept
4:44 gcp-cli-is windows TestAccept
4:05 aws-cli-is windows TestAccept

@pietern
pietern added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit 195c987 Jul 21, 2026
28 checks passed
@pietern
pietern deleted the suppress-list-anchor-warnings branch July 21, 2026 14:55
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.

4 participants