Skip to content

Commit ce2f4ee

Browse files
felickzCopilot
andauthored
fix(release): stop patch-release-me double-bumping ql/hotspots (#175)
`ql/hotspots/` is deliberately excluded from `.release.yml`'s "CodeQL Pack Versions" location (added in #158/d0b969e: it's a separate package published by its own manual workflow_dispatch, not part of the per-language pack family) - yet it kept getting bumped in lockstep with every release anyway (most recently 0.2.4 -> 0.3.0 in PR #173, and 0.2.1 -> 0.2.4 in PR #169 before that). Root cause, confirmed by running the exact pinned patch-release-me image locally with --debug against both a minimal repro and a full copy of this repo's real qlpack.yml files: 1. patch-release-me ships its own hardcoded default location for the "CodeQL" ecosystem, literally named "CodeQL Packs" (see its src/defaults.yml), matching **/qlpack.yml with only `excludes: [/.codeql/]`. Our own custom location was named "CodeQL Pack Versions" - a different name - so patch-release-me's config loader (src/config.rs) adds its built-in default *alongside* ours instead of treating ours as an override (it only skips adding the default when a location with the exact same `name` already exists). The built-in default has no idea about our `ql/hotspots/` exclude, so it bumps that file regardless. 2. Our own location's pattern (`^version:\s*{version}$`) has never actually matched anything, on any pack, since the day it was anchored in d0b969e - the `^`/`$` anchor to the whole file, not each line, without a `(?m)` multiline flag, and `version:` is never the literal first/last byte of a real multi-line qlpack.yml. All real bumping has silently been done by the built-in default this whole time, which is exactly why our exclude never took effect. Fix (both verified together, locally, against all 28 real qlpack.yml files in this repo with their actual LF line endings): - Rename our location to exactly "CodeQL Packs" so patch-release-me's default-merge logic skips adding its own conflicting built-in default instead of running both. - Add the `(?m)` flag so the anchor actually works per-line, keeping the original anti-partial-match protection (e.g. bumping "0.2.2" from correctly matching inside "0.2.20") while working at all. Verified: all 20 real packs bump correctly, `ql/hotspots/qlpack.yml` stays untouched, `.release.yml` itself still bumps. Also documents this in CONTRIBUTING.md's "Cutting a release" section so the location's name/pattern requirements aren't silently broken again by a future edit. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent ebc1924 commit ce2f4ee

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎.release.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ excludes:
99
- "/codeql_home/" # only present when run alongside update-codeql-version.yml, which downloads the CLI here
1010

1111
locations:
12-
- name: "CodeQL Pack Versions"
12+
- name: "CodeQL Packs" # must match patch-release-me's built-in default location name for the "CodeQL" ecosystem (see defaults.yml upstream) - otherwise BOTH run, and the built-in one bumps every qlpack.yml with no knowledge of our excludes below
1313
paths:
1414
- "**/qlpack.yml"
1515
excludes:
1616
- "ql/hotspots/"
1717
patterns:
18-
- '^version:\s*{version}$'
18+
- '(?m)^version:\s*{version}$' # (?m) is required: without it ^/$ anchor to the whole file, not each line, so this would never match a real multi-line qlpack.yml
1919
- name: "CodeQL Configurations"
2020
paths:
2121
- "configs/*.yml"

‎CONTRIBUTING.md‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,23 @@ supported way to bump `.release.yml`:
305305
[`42ByteLabs/patch-release-me`][patch-release-me] tool, which reads `.release.yml`'s current
306306
`version:`, computes the bump, and opens a PR that:
307307
- bumps `.release.yml`'s `version:` to the new value, and
308-
- patches **every** matching pack's own `version:` field to match (the "CodeQL Pack Versions"
308+
- patches **every** matching pack's own `version:` field to match (the "CodeQL Packs"
309309
location in `.release.yml`, added in [#158][pr-158] — this is what makes `.release.yml` a real
310310
lever over publishing today, not just a changelog label), and
311311
- writes a `prerelease: true|false` field into `.release.yml` reflecting the `prerelease` input
312312
(default `false`/unchecked, i.e. a full release) - see the note below.
313+
314+
> [!IMPORTANT]
315+
> `ql/hotspots/` is deliberately excluded from that "CodeQL Packs" location (it's a separate
316+
> package published by its own manual `workflow_dispatch`, not part of the per-language pack
317+
> family - see `.github/workflows/hotspots.yml`). That location's `name:` **must stay exactly
318+
> `"CodeQL Packs"`**, matching `patch-release-me`'s own built-in default location for the
319+
> `CodeQL` ecosystem - if it's ever renamed, the built-in default silently reactivates
320+
> alongside it and re-bumps `ql/hotspots/qlpack.yml` regardless of the exclude, since the
321+
> built-in default doesn't know about it. Its pattern also needs the `(?m)` multiline flag
322+
> (`(?m)^version:\s*{version}$`) - without it, `^`/`$` anchor to the whole file rather than each
323+
> line and the pattern silently never matches anything. Both were real, live bugs discovered
324+
> while landing the CodeQL 2.22.4/v0.3.0 bump (see PR #173).
313325
- [ ] Review and merge that PR like any other.
314326
- [ ] Merging it is what changes `.release.yml` on `main`, which auto-triggers
315327
[`publish.yml`][publish-workflow] for a real batch publish: every pack whose version actually

0 commit comments

Comments
 (0)