Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3454616467
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ($release->isUnreleased()) { | ||
| continue; | ||
| } | ||
|
|
||
| array_splice($releases, $index, 0, [$target]); |
There was a problem hiding this comment.
Preserve release ordering when inserting published sections
withRelease() always inserts a new published release before the first published entry, regardless of semantic version or date, so backfilling an older version (for example adding 1.5.0 after 2.0.0) reorders the document to make the older release appear newest. In ChangelogManager::inferNextVersion(), getLatestPublishedRelease() then uses that misplaced section as the bump base, producing incorrect next versions and compare-link chains for subsequent renders.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Updated
ChangelogDocument::withRelease()so new published releases are inserted based on ordering logic instead of always being inserted before the first published section; this preserves newest-first ordering and prevents backfilled older versions from becoming the “latest” published release. src/Document/ChangelogDocument.phpL80-L122 - Added
shouldInsertBeforePublishedRelease()to centralize insertion precedence using semantic-version comparison first (withv/Vnormalization), then date comparison fallback when versions are not semver-like. src/Document/ChangelogDocument.phpL190-L207 - Updated existing test expectations to reflect preserved newest-first ordering and added a regression test proving backfilled older versions stay behind newer published ones while
getLatestPublishedRelease()remains correct. tests/Document/ChangelogDocumentTest.phpL35-L54 tests/Document/ChangelogDocumentTest.phpL116-L131
Testing
- ❌
vendor/bin/phpunit tests/Document/ChangelogDocumentTest.php(failed becausevendor/bin/phpunitis not present before dependency install). ⚠️ composer install --no-interaction --prefer-dist(blocked by network/proxy restriction: Packagist fetch failed withcurl error 56/CONNECT tunnel failed, response 403).
Also completed follow-up workflow items:
- Committed changes on the branch with message:
Fix published release insertion ordering. - Created a new PR via
make_prtitled:[changelog] Preserve published ordering when adding releases.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3064c5c415
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $releases[] = new ChangelogRelease(self::UNRELEASED_VERSION); | ||
| $releases[] = $promoted; | ||
|
|
There was a problem hiding this comment.
Insert promoted releases in semantic order
When promoteUnreleased() runs, it always appends the promoted release immediately after the Unreleased section ($releases[] = $promoted) instead of placing it relative to existing published versions. If you promote into an older version while newer published releases already exist (for example promoting 1.4.0 when 2.0.0 is present), the document order becomes incorrect, and downstream logic that relies on the first published section as “latest” (e.g., getLatestPublishedRelease() / next-version inference / compare-link generation) will operate on the wrong base release.
Useful? React with 👍 / 👎.
| $currentVersion ??= $document->getLatestPublishedRelease()?->getVersion() ?? '0.0.0'; | ||
| [$major, $minor, $patch] = array_map(intval(...), explode('.', $currentVersion)); |
There was a problem hiding this comment.
Strip leading v/V before inferring next version
inferNextVersion() splits and integer-casts the raw version string without normalizing prefixes, so a valid changelog version like v1.2.3 is parsed as major 0 (intval('v1')), producing incorrect bumps such as 0.1.0. This is inconsistent with the document ordering logic (which already trims v/V) and causes wrong inferred versions whenever prefixed versions are present or passed via --current-version.
Useful? React with 👍 / 👎.
| private function resolveTag(ChangelogRelease $release): string | ||
| { | ||
| return 'v' . $release->getVersion(); | ||
| } |
There was a problem hiding this comment.
Avoid double-prefixing tags for v-prefixed versions
resolveTag() unconditionally prepends v to the stored release version, so versions already containing a prefix (e.g., v1.2.0) produce vv1.2.0 in compare/release URLs. In repositories that keep prefixed versions in the changelog, this generates broken reference links at the bottom of the rendered markdown.
Useful? React with 👍 / 👎.
Summary
Bootstrap the new
fast-forward/changelogpackage as a standalone changelog domain and CLI runtime. The package now owns its changelog document model, parser, renderer, manager, globalchangelogexecutable, and the first reusable commands for entry authoring, version resolution, promotion, and release-note rendering.Changes
CHANGELOG.mdTesting
composer validate --strictvendor/bin/phpunitphp bin/changelog list --rawchangelog:entry,changelog:resolve-version,changelog:promote, andchangelog:render-release-notesin a temporary directoryCloses #1