Add one-shot changelog migration script for per-entry layout#45092
Draft
Copilot wants to merge 4 commits into
Draft
Add one-shot changelog migration script for per-entry layout#45092Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Agent-Logs-Url: https://github.com/envoyproxy/envoy/sessions/048e4cab-8f6a-43dc-aa23-7ba23335c567 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Agent-Logs-Url: https://github.com/envoyproxy/envoy/sessions/048e4cab-8f6a-43dc-aa23-7ba23335c567 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add conversion script for changelog migration
Add one-shot changelog migration script for per-entry layout
May 15, 2026
6a9c64b to
d027405
Compare
Post-migration toolshed expects a single `changelogs/changelogs.yaml` config file containing both `sections:` and `areas:` keys, rather than separate `sections.yaml` and `areas.yaml` files. Update the migration script to: - Read existing `changelogs/sections.yaml` and fold its content under `sections:` in the new `changelogs/changelogs.yaml`. - Place the discovered areas under `areas:` in the same file. - Remove the now-redundant `changelogs/sections.yaml` after writing. See: envoy.base.utils.abstract.project.changelog.CHANGELOG_CONFIG_PATH (= `changelogs/changelogs.yaml`) in envoyproxy/toolshed.
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 PR adds a pre-migration converter so we can transform the legacy monolithic
changelogs/current.yamlinto per-entry changelog files when ready, without switching the repo layout now. It produces per-entry.rstfiles, a generatedareas.yaml, and rewritescurrent.yamlto date-only form.Migration script (
tools/changelogs/migrate_to_per_entry.py)changelogs/current.yamlchangelogs/sections.yamlchangelogs/current/<section>/<area_encoded>__<slug>.rstchangelogs/areas.yamlchangelogs/current.yamlwith onlydate: ...datevalue (including non-Pendingvalues).Per-entry filename generation
/→~(supports nested areas).changetext:--2,-3, ...Entry content handling
changeblock content as-is (no reflow)..rst.area/changeentries.Generated
areas.yamlareavalues observed incurrent.yaml.Focused unit coverage (
tools/changelogs/migrate_to_per_entry_test.py)areas.yamlshape, and date preservation.Original prompt
Context
We're preparing to migrate Envoy's changelog from a single
changelogs/current.yamlfile to a per-entry layout underchangelogs/current/<section>/<area>__<slug>.rst. The toolshed-side work is tracked in envoyproxy/toolshed#4499 (plan:plans/per-entry-changelog-4498.md).This PR does not flip the layout. It only adds a one-shot conversion script that we'll use when we're ready to migrate. Landing this in advance is much safer than building the script under time pressure during the actual migration. The script may not even be merged — that's fine. The point is to have a reviewed, tested artifact ready to run.
What to build
Add a Python script at
tools/changelogs/migrate_to_per_entry.pythat converts the legacy single-file changelog into the per-entry layout.Inputs
changelogs/current.yaml(existing format — see current.yaml)changelogs/sections.yaml(canonical section list — see sections.yaml)Outputs
changelogs/current/<section>/<area_encoded>__<slug>.rst— one file per entry.<section>is the YAML key (e.g.bug_fixes,new_features,minor_behavior_changes).<area_encoded>is the entry'sarea:field with/replaced by~(e.g.extensions/filters/http/oauth2→extensions~filters~http~oauth2). All current entries incurrent.yamluse simple single-segment areas, but the script MUST handle nested ones.<slug>is auto-generated from the entry'schange:text:., or first 60 chars, whichever is shorter).-, strip leading/trailing-.-2,-3, … to disambiguate. Deterministic ordering based on appearance order incurrent.yaml.change:block, written as-is (preserve the existing RST/multiline formatting; do NOT reflow).change:block. End the file with a single trailing newline.changelogs/current.yaml— rewritten to contain only:(Preserve the
date:value from the original file if it isn'tPending— though in practice it always is during dev.)changelogs/areas.yaml— new file, generated from the set ofarea:values seen acrosscurrent.yaml. Format mirrorssections.yaml:Areas listed alphabetically, one per line, value empty (allow optional
title:/description:later).Important: If
changelogs/areas.yamlalready exists when the script runs, MERGE: keep existing entries, add any new ones discovered incurrent.yaml, and emit a warning to stderr listing the added areas. Do not silently overwrite a hand-edited file.CLI
--project-pathdefaults to the repo root (auto-detect by walking up from script location untilchangelogs/current.yamlis found).--dry-runprints what would be written without touching the filesystem. List each output file with byte count and the first line of content.--forceoverwrites existingchangelogs/current/directory. Without--force, refuse to run ifchangelogs/current/already exists and is non-empty.current.yaml, malformed entry missingarea:orchange:, etc.).Validation the script must perform before writing anything
current.yaml(other thandate) is present insections.yaml.area:(string) andchange:(string) fields.area:does not contain~(would clash with the encoding) — fail with a clear error if so.area:does not contain__(would clash with the separator).If any validation fails, print all failures (not just the first) and exit nonzero without writing anything.
Tests
Add
tools/changelogs/migrate_to_per_entry_test.py(pytest) covering:current.yamlwith a couple of sections and entries (including one with a nested area likeextensions/filters/http/oauth2), run ...This pull request was created from Copilot chat.