Skip to content

Use changelogs/current/ as entries-layout current sentinel (without dropping current.yaml parsing)#4570

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/migrate-changelog-sentinel
Draft

Use changelogs/current/ as entries-layout current sentinel (without dropping current.yaml parsing)#4570
Copilot wants to merge 4 commits into
mainfrom
copilot/migrate-changelog-sentinel

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

In entries-layout repos, changelog discovery still depended on changelogs/current.yaml to identify the in-flight version. This change switches current-version discovery to changelogs/current/ while intentionally preserving current.yaml as the current changelog parse path (for date handling in the follow-up PR).

  • AChangelogs current discovery (entries-layout only)

    • paths now uses current_dir_path instead of appending current_path when _entries_layout is true.
    • changelog_paths now derives current directly from project.version.base_version and maps it to current_dir_path, while still loading historical versions from changelogs/*.*.*.yaml.
    • Legacy single-yaml behavior is unchanged.
  • Preserve current changelog parse path

    • In entries layout, current changelog detection no longer relies on current.yaml.
    • The instantiated current AChangelog still receives current_path (changelogs/current.yaml) as its _path, so existing get_data_from_entries(..., yaml_path=...) behavior remains intact.
  • envoy.code.check messaging update

    • Updated duplicate-current error text to remove the assumption that current.yaml is the sole current representation.
    • Message now describes changelogs/<version>.yaml coexisting with changelogs/current/ for the in-flight changelog.
  • Test updates

    • Added/updated tests for entries-layout paths and changelog_paths behavior.
    • Added coverage for current-changelog instance path selection in entries layout.
    • Updated exact expected duplicate-current error string.
# entries-layout branch
if self._entries_layout:
    historical_paths = self.project.path.glob(CHANGELOG_PATH_GLOB)
    current_version = _version.Version(self.project.version.base_version)
    return {
        **{self._version_from_path(path): path for path in historical_paths},
        current_version: self.current_dir_path,
    }
Original prompt

Background

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

The medium-term goal is to remove changelogs/current.yaml entirely. Right now the toolshed changelog code in py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py still depends on current.yaml in two distinct ways:

  1. As the sentinel that identifies "the current changelog" — it's appended to paths, and _version_from_path special-cases path.stem == "current" to mean "use the project version".
  2. As the store for the release date (Pending / May 19, 2026).

This PR addresses (1) only. The date relocation is a follow-up PR.

Goal

Make changelogs/current/ (the directory) the sole sentinel for the in-flight version in entries-layout mode, so the yaml file is no longer required to identify which version is "current". The yaml file may still be read for date — that's PR 2's problem.

Scope (entries-layout only)

All behavioral changes below MUST be gated on _entries_layout being true. Repos still on the single-yaml layout (no changelogs/current/ directory) MUST be completely unaffected.

Required changes

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

In AChangelogs:

  • paths (currently appends self.current_path unconditionally): when _entries_layout is true, do NOT append self.current_path. The current version's "path" should be represented by self.current_dir_path instead. Non-entries layout: unchanged.

  • changelog_paths / _version_from_path: in entries-layout mode, derive the current version directly from self.project.version.base_version rather than parsing it from path.stem == "current". One way:

    • Build changelog_paths as {historical versions from *.*.*.yaml glob} ∪ {current_version: current_dir_path} when _entries_layout.
    • Leave the non-entries path unchanged so path.stem == "current" keeps working there.
    • _version_from_path can keep its current behavior; the entries-layout branch just doesn't need it for the current entry.
  • AChangelog.path (used by get_data / get_data_from_entries): for the current changelog in entries-layout mode, path should still point at current.yaml for now (so date reading in get_data_from_entries keeps working until PR 2). Only the discovery of "which version is current" stops depending on the yaml file's existence. Concretely: _path passed to the current Changelog instance in entries mode should remain current_path (the yaml), even though it was discovered via the directory. This keeps PR 1 a pure refactor of discovery.

py/envoy.code.check/envoy/code/check/abstract/changelog.py

  • The check_version error message currently reads:

    "Duplicate current version file. Only current.yaml should exist for the current version ({version})"

    Update wording so it does not assume current.yaml is the sole representation. Suggested:

    "Duplicate current version file. A changelogs/{version}.yaml exists alongside the in-flight current changelog ({version})"

    The underlying duplicate_current detection logic does not need to change — it just compares the changelog's version against the project version. Only the user-facing string needs updating.

Tests

Update / add tests as needed. Key spots:

  • py/envoy.base.utils/tests/test_abstract_project_changelogs.py
    • Any test that asserts paths includes current_path unconditionally needs an entries-layout variant where it instead includes current_dir_path.
    • Tests for changelog_paths / _version_from_path should cover the entries-layout branch.
  • py/envoy.code.check/tests/test_abstract_changelog.py
    • test_changelogstatus_check_version asserts the exact error string — update to match the new wording.

Add at least one new test exercising the entries-layout discovery path so it doesn't regress.

Non-goals (explicitly out of scope)

  • Do not move the date out of current.yaml. get_data_from_entries should keep reading date from yaml_path for now.
  • Do not change write_current / write_date / write_version / is_pending / changes_for_commit behavior. They still touch current.yaml. PR 2 will address those.
  • Do not remove CHANGELOG_CURRENT_PATH, current_path, or rel_current_path. Still in use.
  • Do not touch CHANGELOG_URL_TPL — historical synced changelogs continue to live at current.yaml on tagged refs.
  • Do not change behavior for repos without a changelogs/current/ directory.

Acceptance criteria

  • Removing changelogs/current.yaml from an envoy checkout that has a changelogs/current/ directory still allows toolshed to:
    • enumerate changelogs and identify the current version
    • buil...

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Update changelog sentinel to use directory layout Use changelogs/current/ as entries-layout current sentinel (without dropping current.yaml parsing) May 19, 2026
Copilot AI requested a review from phlax May 19, 2026 14:06
@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 145a912
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/6a0c6a415ec8840008222a13
😎 Deploy Preview https://deploy-preview-4570--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 finished work on behalf of phlax May 19, 2026 14:12
@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 4a2a7b9
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/6a0c6d191174220008412eaf
😎 Deploy Preview https://deploy-preview-4570--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.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 149ad70
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/6a0c6e1161d18e0008495ca2
😎 Deploy Preview https://deploy-preview-4570--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.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 25c8e55
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/6a0c6e45db942e000825cf3b
😎 Deploy Preview https://deploy-preview-4570--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.

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