Add areas.yaml validation to changelog checker (file integrity + entry prefix mapping)#4560
Closed
Copilot wants to merge 3 commits into
Closed
Add areas.yaml validation to changelog checker (file integrity + entry prefix mapping)#4560Copilot wants to merge 3 commits into
areas.yaml validation to changelog checker (file integrity + entry prefix mapping)#4560Copilot wants to merge 3 commits into
Conversation
✅ Deploy Preview for nifty-bassi-e26446 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Agent-Logs-Url: https://github.com/envoyproxy/toolshed/sessions/a96d7d5b-dcd6-4bfa-a7e8-352da24fd61d Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Agent-Logs-Url: https://github.com/envoyproxy/toolshed/sessions/a96d7d5b-dcd6-4bfa-a7e8-352da24fd61d Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add validation for areas.yaml in changelog migration
Add May 18, 2026
areas.yaml validation to changelog checker (file integrity + entry prefix mapping)
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.
This change adds the missing
changelogs/areas.yamlvalidation path for per-entry changelogs, while preserving back-compat for branches that do not haveareas.yaml. It validates both the registry itself and entry filename area prefixes against that registry.Checker behavior: validate
areas.yamlcontent once per status runAChangelogChangesChecker.check_areas_file()to enforce:titledetection (one error per duplicated title)[a-z0-9_\\-/]+changelogs/areas.yamlcontext and include offending keys/titles.Checker behavior: validate entry filename area prefix
check_entry_filename()now checks<area>__<slug>.rstarea membership inareas.yamlwhen areas are configured.areas.yamlis absent (areas map is empty), behavior remains the previous non-empty-area check only.Wiring in base utils for optional areas registry
CHANGELOG_AREAS_PATHandChangelogAreasDict.AChangelogs.areas_pathand cachedAChangelogs.areas:ChangelogErrorAChangelogCheck.changes_checkernow receives bothsectionsandareas.Status aggregation integration
AChangelogStatus.errorsnow includescheck_areas_file()output.Interfaces/tests updated for new contract
areasand checker areas-file validation hook.py/envoy.base.utils/tests/test_abstract_project_changelogs.pypy/envoy.code.check/tests/test_abstract_changelog.pypy/envoy.code.check/tests/test_checker.pyOriginal prompt
Background
As part of the per-entry changelog migration (see envoy#45093 and the plan in toolshed#4499), envoy is introducing a new file
changelogs/areas.yamlwhich is the canonical registry of "areas" (the filename prefix in per-entry changelog files likechangelogs/current/<section>/<area>__<slug>.rst).areas.yamlhas the same shape as the existingchangelogs/sections.yaml:Right now nothing reads or validates this file. The parser in
py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py::AChangelog.get_data_from_entriesderivesareafrom the filename stem and stuffs it straight into the entry dict, andAChangelogChangesChecker.check_entry_filenameinpy/envoy.code.check/envoy/code/check/abstract/changelog.pyonly checks that the area part is non-empty.We want to add basic validation in the existing changelog checker (
envoy.code.check) — keep the scope tight: just validate the file and the entry-prefix↔area mapping.Scope (this PR)
Add validation to
AChangelogChangesCheckerinpy/envoy.code.check/envoy/code/check/abstract/changelog.py. The validation should only fire whenchangelogs/areas.yamlis present (back-compat: release branches that don't have this file must not start failing). Detection: file exists, OR equivalently — sinceareas.yamlonly makes sense alongside the per-entry layout — gate on the_entries_layoutindicator already exposed onAChangelogs. Prefer file-present detection (areas_path.exists()) so that the check is independent of whether any entries have actually been written yet.Three checks to add
areas.yamlcontent — no duplicate titlesareas.yamlhas atitle:field.title.changelogs/areas.yaml: Duplicate title 'foo' used by areas: bar, bazareas.yamlcontent — valid title characterstitlemust match the regex^[a-z0-9_\-/]+$(lowercase ascii letters, digits, underscore, hyphen, forward slash). Anchored, non-empty.changelogs/areas.yaml: Invalid title '<title>' for area '<key>' (must match [a-z0-9_\-/]+).All entry filename area-prefixes must map to an area key in
areas.yamlchangelogs/current/<section>/<area>__<slug>.rstfile, after the existing non-empty-area check, look upareain the loadedareas.yamlmapping.<path>: Invalid area '<area>'. Valid areas come from changelogs/areas.yamlcheck_entry_filenameflow (return error string, accumulated incheck_entry_files).Wiring
CHANGELOG_AREAS_PATH = "changelogs/areas.yaml"constant alongside the existingCHANGELOG_SECTIONS_PATHinpy/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py. Also add aChangelogAreasDicttyping entry parallel toChangelogSectionsDictinpy/envoy.base.utils/envoy/base/utils/typing.py(find whereChangelogSectionsDictlives — same shape:Dict[str, Dict[str, str]]with atitlekey).areascached property andareas_pathproperty onAChangelogs(parallel tosections/sections_path). Loading semantics:areas_pathdoes NOT exist → return an empty dict (orNone; pick whichever makes the downstream check cleanest — empty dict is fine and means "no validation registered"). Do NOT raise.ChangelogError(mirror the existingsectionsbehaviour forReaderError).areasintoAChangelogChangesChecker.__init__alongsidesections(updateAChangelogCheck.changes_checkercached_property in the same file to pass it through).AChangelogChangesChecker, storeself.areas. Add the three checks above. The twoareas.yamlcontent checks should run once per check session (not per-entry); add a method likecheck_areas_file(self) -> tuple[str, ...]that returns the title-uniqueness + title-charset + key-charset errors, and hook it into the existing entry-files error aggregation inAChangelogStatus.errors(it should only run whenself.areasis non-empty, and probably only for the current version — same gating ascheck_entry_files).check_entry_filenameto look up area inself.areaswhenself.areasis truthy. Whenself.areasis empty (file absent), preserve current behaviour (just non-empty check).Tests
Add tests in
py/envoy.code.check/tests/test_abstract_changelog.pyandpy/envoy.base.utils/tests/test_abstract_project_changelogs.pycovering:This pull request was created from Copilot chat.