Repository navigation
feat: derive promote-release cleanup pattern from the configured pre-release format - #1802
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 anyDEVKIT_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 featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
packages/vig-utils/src/vig_utils/release_version.py): new publicPreReleaseFormat.list_pattern(tag_prefix, version) -> str, built on the samere.escape/placeholder-substitution machinery as the existing_regexhelper (factored out into a shared_pattern_body) — no second placeholder parser. Unlike_regex's internal named group,list_patternemits a plain POSIX ERE ((0|[1-9][0-9]*),[0-9]{8}): the pattern is handed to external tools (jqtest(),grep -Ein the cleanup job), and GNUgrep -Eneither expands\dnor correctly parses(?:...)— verified directly against the real binaries, not assumed. New CLI moderelease-version --list-pattern --version --format --tag-prefixprints the anchored regex and reads no stdin;--kindis no longer unconditionally required.assets/workspace/.github/workflows/promote-release.yml(not a synced copy — it's an original file served directly to consumers):resolve-toolchainre-exposesprerelease-format; the cleanup job'sPATTERNnow comes fromrelease-version --list-pattern, replacing the hardcoded jqgsub-built regex and the${RC_BASE}-rc*git-ls-remote glob (now${RC_BASE}-*filtered throughgrep -E "$PATTERN"). The pattern reaches jq via--arg pat, never string-built into the filter. The existing "no GitHub Release" guard is unchanged.docs/DOWNSTREAM_RELEASE.md..github/workflows/promote-release.ymlstays on literalrc{N}— it sets noDEVKIT_PRERELEASE_FORMAT, and its cleanup additionally prunes per-arch GHCR-rcN-<arch>tags that a format-generic matcher would not cover.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 otherrcmention is either documentation/example text or already generic (release-versiondriven, candidate discovery overX.Y.Z-*).Changelog Entry
Testing
just test)Manual Testing Details
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).test_image.py/test_integration*per repo convention — they fail locally against a lagging:devimage):2391 passed, 1 skipped.just precommit(prek run --all-files) green across bothassets/workspaceand root hook groups.re):grep -E(GNU grep 3.12, the actual binary on the job'sPATH) andjq test()— this caught a real bug ((?:...)/\dare PCRE-only and GNUgrep -Emis-parses them) before it reached CI;list_patternnow emits plain POSIX ERE instead.Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
docs/DOWNSTREAM_RELEASE.mdupdated 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 nojust docsregeneration was needed.Refs: #1749