Skip to content

Stop entries-layout changelog date IO on changelogs/current.yaml#4578

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/migrate-changelog-layout
Draft

Stop entries-layout changelog date IO on changelogs/current.yaml#4578
Copilot wants to merge 2 commits into
mainfrom
copilot/migrate-changelog-layout

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 20, 2026

Envoy is moving to per-entry changelogs under changelogs/current/<section>/<area>__<slug>.rst; in that mode, current.yaml should no longer be read or written for in-flight changelog state. This change removes entries-layout dependence on changelogs/current.yaml date persistence while keeping legacy single-yaml layout behavior intact.

  • Entries-layout parsing now derives date in-memory

    • AChangelog.get_data_from_entries no longer accepts/reads a yaml path.
    • Returned changelog data always uses date: "Pending" for in-flight entries changelogs.
  • Entries-layout pending state now follows project dev mode

    • AChangelogs.is_pending now returns self.project.is_dev when _entries_layout is true.
    • Legacy path still checks release_date == "Pending".
  • No more current.yaml writes in entries-layout lifecycle

    • write_current: only ensures current_dir_path exists.
    • write_date: remains precondition-guarded, then no-ops in entries-layout.
    • write_version: reads entries-only data, stamps data["date"] = self.datestamp, writes frozen <version>.yaml, then resets changelogs/current/ directory.
  • Commit path set corrected for entries-layout

    • changes_for_commit no longer adds CHANGELOG_CURRENT_PATH for release/dev when _entries_layout is true.
    • CHANGELOG_CURRENT_DIR_PATH remains included for entries-layout.
  • Test updates

    • Updated unit tests for get_data_from_entries signature and semantics (date == "Pending").
    • Updated entries-layout tests for is_pending, write_current, write_date, write_version, and changes_for_commit.
    • Added integration-style test showing entries-layout works with no changelogs/current.yaml: parse current changelog, derive pending from dev mode, no-op write_date, and freeze <old>.yaml with datestamp.
# entries-layout freeze path
data = self.changelog_class.get_data_from_entries(self.current_dir_path)
data["date"] = self.datestamp
version_file.write_text(self.dump_yaml(data))
shutil.rmtree(self.current_dir_path)
self.current_dir_path.mkdir()
Original prompt

Background

In envoyproxy/envoy we're migrating the changelog layout from a single changelogs/current.yaml to a per-entry directory layout under changelogs/current/<section>/<area>__<slug>.rst (context: envoyproxy/envoy#45093 and envoyproxy/envoy#45095).

The medium-term goal is to remove changelogs/current.yaml entirely. Today, the toolshed changelog code in py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py uses current.yaml for two things:

  1. As a sentinel that identifies "the current changelog" (being addressed in a separate PR — out of scope here).
  2. As the store for the release date field (Pending or a formatted date).

There is a previous attempt at the date relocation in #4577 which introduced a new changelogs/current/.date file. That approach is being abandoned in favour of this PR. Do not build on or rebase against that PR. It should be closed after this lands.

Insight motivating this PR

The on-disk date field doesn't need to exist as a persisted in-flight value at all:

  • Pending is just a synonym for "the project is in dev mode" — and VERSION.txt already tells us that via self.project.is_dev.
  • The actual release date is only meaningful at the moment the in-flight changelog is frozen into changelogs/<version>.yaml during the dev() lifecycle step. At that moment we can compute it (self.datestamp) and inject it into the dumped yaml.
  • Between release() and the next dev() there's no need to persist the date anywhere — release() already returns it in its result dict for logging/commit purposes.

So we can drop the date persistence entirely in entries-layout mode. No .date file. No current.yaml writes. current.yaml becomes immediately removable on the envoy side after this lands.

Goal

In entries-layout mode (_entries_layout true), the toolshed code MUST NOT read or write changelogs/current.yaml for any purpose. The date is derived from project state at use time, never persisted in-flight, and stamped into the frozen <version>.yaml only at freeze time.

The legacy single-yaml layout (no changelogs/current/ directory) MUST be completely unaffected — same reads, writes, and commit set as today.

Required changes

py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py

AChangelog.get_data_from_entries

Currently reads date from a yaml file at yaml_path. Change to:

  • Drop the yaml_path argument entirely (or default it to None and ignore it — pick whichever is cleanest given call sites).
  • The date in the returned ChangelogDict is always "Pending". This is correct by construction: this method is only called for the in-flight changelog, and the in-flight changelog is by definition pending.
  • Continue reading the per-entry .rst files from entry_dir as today.

Update the signature and adjust all call sites (notably AChangelog.data in AChangelog).

AChangelogs.is_pending

Currently routes through await self[self.current].release_date == "Pending". Replace with a direct check in entries-layout mode:

@async_property
async def is_pending(self) -> bool:
    if self._entries_layout:
        return self.project.is_dev
    return (
        await self[self.current].release_date
        == "Pending")

AChangelogs.write_current

Currently in entries-layout branch:

self.current_path.write_text("date: Pending\n")
self.current_dir_path.mkdir(parents=True, exist_ok=True)

Change to:

self.current_dir_path.mkdir(parents=True, exist_ok=True)

No yaml write. Non-entries branch unchanged.

AChangelogs.write_date

Currently in entries-layout branch:

self.current_path.write_text(f"date: {date}\n")

Change to: in entries-layout mode, this is a no-op (the method body returns immediately). The date is not persisted in-flight; it will be stamped into the frozen file by write_version.

Important: keep the is_pending precondition check at the top of the method. In entries-layout mode that check now consults self.project.is_dev via the updated is_pending. We still want it to error if called inappropriately. (In practice release() calls write_date before write_version, while still in dev mode, so is_pending is true. Good.)

Non-entries branch unchanged.

AChangelogs.write_version

Currently in entries-layout branch:

data = self.changelog_class.get_data_from_entries(
    self.current_path, self.current_dir_path)
version_file.write_text(self.dump_yaml(data))
self.current_path.write_text("date: Pending\n")
shutil.rmtree(self.current_dir_path)
self.current_dir_path.mkdir()

Change to:

data = self.changelog_class.get_data_from_entries(self.current_dir_path)
# Stamp today's date into the freeze. The freeze captures the moment
# `dev()` is run; for entries-layout mode this is the ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit e95bf1c
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/6a0db081f016fc00088dfa38
😎 Deploy Preview https://deploy-preview-4578--nifty-bassi-e26446.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Migrate changelog layout to per-entry directory structure Stop entries-layout changelog date IO on changelogs/current.yaml May 20, 2026
Copilot finished work on behalf of phlax May 20, 2026 13:03
Copilot AI requested a review from phlax May 20, 2026 13:03
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.

2 participants