Skip to content

feat: derive promote-release cleanup pattern from the configured pre-release format - #1802

Merged
c-vigo merged 6 commits into
devfrom
feature/1749-prerelease-format-tag-cleanup
Oct 1, 2026
Merged

c-vigo merged 6 commits into
devfrom
feature/1749-prerelease-format-tag-cleanup

Conversation

@c-vigo

@c-vigo c-vigo commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Description

Promote-release's best-effort cleanup pruned only <prefix>X.Y.Z-rc[0-9]+ candidate tags. Since #1746 a repo can publish candidates in any DEVKIT_PRERELEASE_FORMAT (e.g. alpha.{N}), and those tags were never cleaned up — the cleanup pattern is now derived from the resolved format instead of hardcoded.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • vig-utils (packages/vig-utils/src/vig_utils/release_version.py): new public PreReleaseFormat.list_pattern(tag_prefix, version) -> str, built on the same re.escape/placeholder-substitution machinery as the existing _regex helper (factored out into a shared _pattern_body) — no second placeholder parser. Unlike _regex's internal named group, list_pattern emits a plain POSIX ERE ((0|[1-9][0-9]*), [0-9]{8}): the pattern is handed to external tools (jq test(), grep -E in the cleanup job), and GNU grep -E neither expands \d nor correctly parses (?:...) — verified directly against the real binaries, not assumed. New CLI mode release-version --list-pattern --version --format --tag-prefix prints the anchored regex and reads no stdin; --kind is no longer unconditionally required.
  • Scaffold assets/workspace/.github/workflows/promote-release.yml (not a synced copy — it's an original file served directly to consumers): resolve-toolchain re-exposes prerelease-format; the cleanup job's PATTERN now comes from release-version --list-pattern, replacing the hardcoded jq gsub-built regex and the ${RC_BASE}-rc* git-ls-remote glob (now ${RC_BASE}-* filtered through grep -E "$PATTERN"). The pattern reaches jq via --arg pat, never string-built into the filter. The existing "no GitHub Release" guard is unchanged.
  • Policy: a tag from a previously configured format (a mid-series format switch) is intentionally left alone — only tags matching the CURRENTLY configured format are ever matched/deleted. Documented in the step comment and in docs/DOWNSTREAM_RELEASE.md.
  • Scope: scaffold copy only. Devkit's own .github/workflows/promote-release.yml stays on literal rc{N} — it sets no DEVKIT_PRERELEASE_FORMAT, and its cleanup additionally prunes per-arch GHCR -rcN-<arch> tags that a format-generic matcher would not cover.
  • Swept the rest of the scaffold (release-core.yml, release.yml, release-extension.yml, devkit-upgrade.yml, plugins/devkit/skills/*, abandon/prepare workflows) for any other hardcoded candidate-tag match the format change should have touched — found none; every other rc mention is either documentation/example text or already generic (release-version driven, candidate discovery over X.Y.Z-*).

Changelog Entry

### Changed

- **Promote-release cleanup matches the configured pre-release format**
  ([#1749](https://github.com/vig-os/devkit/issues/1749))
  - The scaffolded `promote-release.yml` cleanup job used to prune only
    `-rc*` candidate tags, so a repo on a non-default
    `DEVKIT_PRERELEASE_FORMAT` (e.g. `alpha.{N}`, #1746) never got its
    candidate tags cleaned up. The match is now derived from the resolved
    format via the new `release-version --list-pattern` CLI mode
    (`PreReleaseFormat.list_pattern` in vig-utils), reusing the format's
    existing `re.escape`/placeholder machinery rather than a second parser
  - A tag from a *previously* configured format (a mid-series switch) is
    intentionally left alone; the existing "no GitHub Release" guard is
    unchanged
  - Scope: the scaffold copy only. Devkit's own
    `.github/workflows/promote-release.yml` stays on literal `rc{N}` -- it
    sets no pre-release format and its cleanup also prunes per-arch GHCR
    `-rcN-<arch>` tags, which a format-generic matcher would not cover

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

  • TDD throughout: RED commits for vig-utils unit/CLI coverage and for the workflow-shape pin test, each followed by a GREEN implementation commit.
  • uv run pytest packages/vig-utils -q — 717 passed.
  • uv run pytest tests/test_promote_release.py -q — 33 passed (incl. 5 new pin tests for [FEATURE] promote-release: generalise candidate tag cleanup to the configured pre-release format #1749).
  • Full repo suite (excluding the known-stale test_image.py/test_integration* per repo convention — they fail locally against a lagging :dev image): 2391 passed, 1 skipped.
  • just precommit (prek run --all-files) green across both assets/workspace and root hook groups.
  • Validated the generated pattern against the REAL consumer tools directly (not just Python's re): grep -E (GNU grep 3.12, the actual binary on the job's PATH) and jq test() — this caught a real bug ((?:...)/\d are PCRE-only and GNU grep -E mis-parses them) before it reached CI; list_pattern now emits plain POSIX ERE instead.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

docs/DOWNSTREAM_RELEASE.md updated in two places (monotonicity-gate note, promote "Cleanup" step) to describe the format-derived match instead of the old hardcoded -rc*; docs/templates/ has no corresponding template for this file so no just docs regeneration was needed.

Refs: #1749

c-vigo added 6 commits October 1, 2026 15:59
RED for #1749: promote-release's cleanup job needs an anchored tag regex
derived from the configured pre-release format instead of a hardcoded
-rc[0-9]+. Covers the default rc{N} format (equivalent to today's cleanup
match), alpha.{N}, a {YYYYMMDD} format, tag-prefix/version escaping, the
no-named-group constraint (jq test()/grep -E reject Python's (?P<name>...)),
and the --list-pattern CLI mode (no stdin, --kind not required).

Refs: #1749
GREEN for #1749. list_pattern(tag_prefix, version) builds on the same
re.escape/placeholder machinery as the existing _regex helper (factored
into _pattern_body), but with an unnamed counter group so the result can
be handed verbatim to jq test()/grep -E, neither of which accepts
Python's (?P<name>...) syntax.

The CLI gains --list-pattern: given --version/--format/--tag-prefix it
prints the anchored regex and exits without reading stdin; --kind is no
longer unconditionally required.

Refs: #1749
RED for #1749: resolve-toolchain must re-expose prerelease-format, the
cleanup job must read it, derive its match via
`release-version --list-pattern`, carry the pattern into jq through
--arg (never string-built into the jq program), and drop the former
hardcoded -rc[0-9]+ / -rc* match. Scaffold copy only -- devkit's own
promote-release.yml is out of scope (module docstring explains why).

Refs: #1749
GNU grep -E (the real consumer in the cleanup job, not the sandbox's
ugrep) warns on and mis-parses (?:...) non-capturing groups, and does not
expand \d at all -- verified directly against the actual grep -E and jq
binaries, not assumed. list_pattern now emits a plain (...) group and
[0-9]/[0-9]{8}, which jq's Oniguruma test() parses identically. Added
subprocess tests that run the real grep -E and jq test() instead of only
Python's re module.

Refs: #1749
…ed format

GREEN for #1749. resolve-toolchain now re-exposes prerelease-format;
the cleanup job's PATTERN comes from
`release-version --list-pattern --version --format --tag-prefix`
(release-version is already on PATH via setup-devkit-toolchain, called
bare as release-core.yml already does), replacing the hardcoded
`^<prefix>X\.Y\.Z-rc[0-9]+$` jq construction and the `${RC_BASE}-rc*`
git ls-remote glob (now `${RC_BASE}-*` filtered by PATTERN through
`grep -E`). The pattern reaches jq via `--arg pat`, never string-built
into the filter.

A tag from a PREVIOUSLY configured format (mid-series switch) is left
alone -- only tags of the currently configured format are ever matched,
and the existing "no GitHub Release" guard is unchanged.

Scope: the scaffold copy only. Devkit's own
.github/workflows/promote-release.yml stays on literal rc{N}: it sets no
DEVKIT_PRERELEASE_FORMAT and its cleanup additionally prunes per-arch
GHCR `-rcN-<arch>` tags, which a format-generic matcher would not cover.

Refs: #1749
Non-testable (docs/changelog) -- skips TDD. DOWNSTREAM_RELEASE.md's
monotonicity-gate note and the promote "Cleanup" step both described the
old hardcoded -rc* match; both now describe the format-derived match and
the previous-format-is-left-alone policy. CHANGELOG Unreleased/Changed
gets the user-visible entry; sync-manifest mirrors both into their
assets/workspace copies.

Refs: #1749
@c-vigo
c-vigo merged commit eca0ee8 into dev Oct 1, 2026
15 checks passed
@c-vigo
c-vigo deleted the feature/1749-prerelease-format-tag-cleanup branch October 1, 2026 16:32
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.

1 participant