Repository navigation
Add a nightly CI job preparing the changelog for the upcoming release - #111255
Conversation
The `NightlyChangelog` workflow runs daily. It generates the raw changelog entries for the pull requests newly merged into `master`, using `tests/ci/changelog.py` in the `style-test` container (the same way `create_release.yml` runs it), and inserts them into `CHANGELOG.md` as a marker-delimited block. Then it edits them following `.claude/skills/edit-changelog/SKILL.md` via the `codex` CLI (the same way the `Code Review` job runs it), integrating them into the in-progress release section. Generation and edit are two separate commits, mirroring the manual autogenerated-plus-edited commit pairs of past releases. The result is maintained on a per-release bot branch (`auto/changelog-X.Y`) with a draft pull request that the release manager finalizes at release time. The point up to which the changelog was generated is remembered as a `Changelog-generated-up-to:` trailer in the generate commits, so the next daily run continues from there. After `master` moves on to the next version, the previous cycle's branch gets a final catch-up, up to the `v*.1.1-new` tag that started the new cycle. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Workflow [PR], commit [48b7f45] Summary: ✅ AI ReviewSummaryThis PR adds a scheduled Findings
Final VerdictStatus: |
Fix three issues found in review: - Read the `Changelog-generated-up-to:` trailer only after fetching and checking out the bot branch (it was read before the fetch, when the remote-tracking ref does not exist in a fresh CI checkout, silently falling back to the cycle start tag and duplicating entries). The fetches now use explicit refspecs, because the CI checkout restricts `remote.origin.fetch` to the triggering ref, and `git log` for the trailer is strict. As an extra guard, `determine_from_ref` refuses to fall back to the cycle start tag when the branch already carries changelog content. - Reset the whole worktree to HEAD (`git reset --hard`) between edit attempts and on final edit failure, instead of restoring only `CHANGELOG.md`: a rejected edit may have modified other files, and they must not leak into the next attempt or the next processed version. - Push the bot branch with the GitHub App token and a cleared `http.extraheader` (the same pattern as praktika's workflow regeneration push) instead of the persisted `GITHUB_TOKEN`, whose pushes do not trigger workflow runs on the pull request. Co-Authored-By: Claude Fable 5 <[email protected]>
- `verify_edit` and the edit cleanup are now pinned to the generate commit SHA captured before the editing agent runs, instead of a mutable `HEAD`: the agent has git access, and a commit made by it must not bypass the only-`CHANGELOG.md`-changed verification or survive the reset (it previously could ride the push of the generate commit to the remote unverified). - `get_pr_states` and the `gh pr` commands are scoped to the base repository and filter out cross-repository pull requests: a fork PR with the same head branch name must not make the job think its own PR exists or was closed (which would suppress creating the real one or disable the cycle). - Commit the test suite as `ci/tests/test_changelog_nightly.py` (run by the CI Tests job), including regressions for both issues above, the restricted-refspec fetch behavior of the CI checkout, the state trailer round-trip, the reconciliation merge, and the fail-closed edit verification. Co-Authored-By: Claude Fable 5 <[email protected]>
…es deleted - `verify_edit` now requires previously integrated entries to survive the edit: a PR link may vanish from the in-progress section only when the processed raw block carries revert entries, at most one deletion per revert (the skill deletes an old entry only when a newly arrived revert cancels it, and follow-up merges keep all links). Previously only a full wipe was rejected. - The per-cycle skip decision is factored into `cycle_skip_reason` and gains a fail-closed rule: when PRs for the bot branch exist but the branch itself does not (deleting the branch auto-closes the PR), the cycle is skipped instead of silently recreating the branch from the cycle start against a deliberate human action. Co-Authored-By: Claude Fable 5 <[email protected]>
- `verify_edit` now also rejects untracked files created by the editing agent (against a pre-edit snapshot), and `_reset_worktree` removes them, so they can neither violate the only-`CHANGELOG.md` contract nor leak into the next attempt or cycle. The job's own scratch files under `ci/tmp` are gitignored and unaffected. - `reconcile_with_master` now runs for any existing changelog branch, not only the current cycle's, so the final catch-up of the previous cycle cannot push onto a stale branch when master's `CHANGELOG.md` changed in the meantime. Co-Authored-By: Claude Fable 5 <[email protected]>
`git check-ignore` fails there with the dubious-ownership error because the checkout belongs to another uid (and `safe.directory` cannot be set from the command line by design). Assert the invariant by reading `ci/.gitignore` instead. Co-Authored-By: Claude Fable 5 <[email protected]>
…e abort - `verify_edit` now also requires today's raw entries from the strict categories (everything except the junk sections the skill prunes: `NOT FOR CHANGELOG`, `NO CL ENTRY`, `Build/Testing/Packaging`) to survive into the edited file — an entry dropped by the agent would otherwise be lost forever, since the state trailer has already advanced past it. The same at-most-one-loss-per-revert allowance applies as for previously accumulated entries; membership is checked against the whole file because a PR merged into the previous release branch after the cycle start may already sit in a published section. - `_untracked_files` parses `git ls-files -z` NUL-delimited output, so an agent-created file name with spaces cannot break verification or the cleanup. - `reconcile_with_master` aborts the in-progress merge before propagating a structural-resolution failure, so one broken cycle cannot leave the repository mid-merge and poison the next cycle's checkout in the same run. Co-Authored-By: Claude Fable 5 <[email protected]>
Only bullets that are reverts (a `Revert "..."`/`Reverts #N`-shaped title, or a quoted `This reverts commit ...`) earn deletion credit — an entry merely mentioning reverts does not. Each revert is resolved to the PR it reverts via the `Reverts owner/repo#N` marker GitHub puts into revert PR bodies, and a disappeared entry must match a resolved original; only reverts without the marker (manual reverts, failed lookups) fall back to licensing one arbitrary deletion each. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Re the third round-6 finding (ignored untracked paths invisible to |
An entry disappearance must now be bound to a PR that a raw-block revert actually reverts (the `Reverts owner/repo#N` marker in the revert PR body); a revert without the marker or with a failed lookup no longer licenses an arbitrary deletion — verification fails closed instead, and the raw entries stay committed for the next run. Co-Authored-By: Claude Fable 5 <[email protected]>
The `NightlyChangelog` job has not updated ClickHouse#111720 since 2026-08-13: every run since then fails with RuntimeError: Failed to push auto/changelog-26.8 preceded by `HTTP 401: Bad credentials` from every `gh` call in the second half of the run. The GitHub App installation token is valid for an hour, and a run is much longer than that (1h12m to 1h43m in the last ten days). The job does try to refresh it before the editing attempts and before creating the pull request, but `GHAuth.auth` mints a token at most once per process unless `force` is set, so those calls have always been no-ops, and there was no refresh before the push at all. In the run of 2026-08-24 the token was minted at 02:50:30, the first `Bad credentials` appeared at 03:47:57, and the push failed at 04:32:17. Mint a fresh token in every step that talks to GitHub - `changelog.py`, each editing attempt, the revert resolution of the edit verification, the push, the pull request lookup, and the per-version processing - through a `refresh_gh_token` helper that passes `force=True`. What made the runs cross the one-hour mark is `prepare repository`: the CI checkout is shallow, and `git fetch --unshallow origin` pulled the trees and blobs of the entire history plus every branch, which took 30 to 36 minutes of each run. The job only walks the commit graph (the range from the cycle start tag to master), so fetch the commits without contents: `--filter=tree:0` against the master refspec only, the same way praktika unshallows the repository for its own jobs. The few old file versions the job does read are fetched lazily from the promisor remote. With the push working again, the raw entries land on the branch and the `Changelog-generated-up-to:` trailer advances, which also ends the loop where each night regenerated a bigger block than the night before (579 entries on 2026-08-24 instead of the usual ~50) and so took even longer. The editing step itself has been failing its own fail-closed verification since 2026-08-12 (`Entries disappeared in the edit without a matching revert`), which is a separate problem: that run finished inside the hour with a valid token. This change makes the raw entries reach the pull request again while that is investigated. Related: ClickHouse#111255 Related: ClickHouse#111220
…gelog-job Add a nightly CI job preparing the changelog for the upcoming release
Adds a scheduled (daily) CI workflow,
NightlyChangelog, that prepares and updates the changelog for the next (upcoming) release, so that at release time the changelog is already generated, edited, and reviewed incrementally instead of being produced in one big batch.Every day the job:
mastersince the previous run, usingtests/ci/changelog.pyinside theclickhouse/style-testcontainer (the same invocation ascreate_release.yml), and inserts them intoCHANGELOG.mdas a block delimited by HTML-comment markers, as one commit..claude/skills/edit-changelog/SKILL.mdvia thecodexCLI (the same agent invocation as theCode Reviewjob), integrating them into the in-progress release section (### <a id="..."></a> ClickHouse release X.Y, FIXME (in progress)), as a separate commit — so the raw and the edited state stay individually reviewable, mirroring the manual autogenerated-then-edited commit pairs of past releases.The result is maintained on a per-release bot branch (
auto/changelog-X.Y) posted as a draft PR ("Prepare changelog for X.Y") associated with the upcoming release. The point up to which the changelog was generated is remembered as aChangelog-generated-up-to:trailer in the generate commits, and each daily run continues from that point. The first run of a cycle starts from thevX.Y.1.1-newtag that marks the cycle start onmaster.Details:
mastermoves on to the next version (release branch cut), the previous cycle's branch gets a final catch-up up to the newv*.1.1-newtag, and a fresh branch/PR is started for the new version.CHANGELOG.mdchanges under the open branch (e.g. the previous release's changelog lands), the job mergesmasterand resolves the expected conflict structurally by re-inserting the in-progress section on top of master's file; any other conflict fails the job for manual resolution.CHANGELOG.mdchanged, the markers are gone, the in-progress section and its table-of-contents line exist, previously accumulated entries did not vanish, and the sections of already-released versions are byte-identical; otherwise it resets to the generate commit, which is still pushed so the raw entries stay visible in the draft PR and are picked up by the next run.FIXMEplaceholders), reviews, marks ready.Tested locally: 37 checks covering the
CHANGELOG.mdtext manipulation against the real file, the git flow (state-trailer round-trip, push idempotence, reconcile/structural-merge scenarios) in a scratch repository, and the edit verification; plus a realtests/ci/changelog.pydry run over the last two days ofmaster(85 entries) fed through the insertion pipeline.python3 -m praktika yamlregenerates the committed workflow YAML byte-identically.Changelog category (leave one):
Version info
26.7.1.1307(included in26.7and later)