envoyproxy / envoyproxy/toolshed
Remove legacy single-file changelog code paths
- Dominant language
- Python
- Stars
- 12
- Forks
- 24
- Avg merge
- 6h 37m
- Merged PRs (30d)
- 92
Description
## Background
The changelog moved from a single `changelogs/current.yaml` file to a per-entry directory layout (`changelogs/current//__.rst`). To keep the old layout working during the transition, a significant amount of legacy code was added that branches on `entries_layout` throughout `py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py`.
Now that the entries/directory layout is the standard, this legacy code is no longer needed and is the source of most of the current changelog issues. The `if self.entries_layout: ... else: ...` splits mean every method carries a dead legacy branch, complicating the logic and hiding bugs.
## Goal
Remove the legacy single-file changelog code paths and simplify the code to assume the entries/directory layout unconditionally.
## Scope
Legacy single-file code paths to remove/simplify in [`py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py`](https://github.com/envoyproxy/toolshed/blob/main/py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py):
- **Single-file constants/helpers**: `CHANGELOG_CURRENT_TPL`, `CHANGELOG_CURRENT_PATH`, `rel_current_path`, `current_path`, `current_tpl`.
- **`entries_layout` branching** — collapse the `if self.entries_layout: ... else: ...` splits (removing the legacy `else` branch) in:
- `AChangelog.data`
- `changelog_paths`
- `changelogs`
- `is_pending`
- `paths`
- `changes_for_commit`
- `write_current`
- `write_date`
- `write_version`
- Once no callers remain, consider whether the `entries_layout` property itself can be dropped.
In [`py/envoy.code.check/envoy/code/check/abstract/changelog.py`](https://github.com/envoyproxy/toolshed/blob/main/py/envoy.code.check/envoy/code/check/abstract/changelog.py):
- **`AChangelogStatus.check_legacy_current`** — the check that only exists to warn about the presence of the legacy `changelogs/current.yaml` file.
Update the associated tests in `test_abstract_project_changelogs.py` and `test_abstract_changelog.py` accordingly (including removing `test_changelogstatus_check_legacy_current`).
## Out of scope
The pre-1.23 RST changelog parsing (`LegacyChangelog`, `RST_CHANGELOG_URL_TPL`, `_is_rst_changelog`) is a separate legacy concern used when syncing/fetching old releases, and is **not** part of the single-file → directory transition. It should be left in place.
## Reference
Relevant code snippets:
**`current_path` / `current_tpl` (single-file):**
[changelog.py#L299-L309](https://github.com/envoyproxy/toolshed/blob/main/py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py#L299-L309)
**`write_current` legacy `else` branch:**
[changelog.py#L497-L508](https://github.com/envoyproxy/toolshed/blob/main/py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py#L497-L508)
**`write_version` legacy `else` branch:**
[changelog.py#L562-L564](https://github.com/envoyproxy/toolshed/blob/main/py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py#L562-L564)
**`check_legacy_current`:**
[abstract/changelog.py](https://github.com/envoyproxy/toolshed/blob/main/py/envoy.code.check/envoy/code/check/abstract/changelog.py)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.