Repository navigation
fix(release): handle plan-limited rulesets during promotion - #2002
Merged
Merged
Conversation
gerchowl
force-pushed
the
bugfix/1851-promote-rules-403
branch
from
November 3, 2026 10:10
7e96c3a to
5d2200a
Compare
gerchowl
force-pushed
the
bugfix/1851-promote-rules-403
branch
from
November 3, 2026 10:59
7db5ab6 to
f27d031
Compare
10 of 11 tasks
gerchowl
added a commit
that referenced
this pull request
Nov 3, 2026
…#2009) ## Description Carry the six reviewed #2002 commits into `release/1.18.2` to fix promotion on plan-limited repositories. Ruleset requirements remain authoritative; only a recognized plan-limit 403 uses the configurable approval fallback. Count distinct, current-head approvals and keep retry diagnostics out of API responses. ## Type of Change - [x] `fix` -- Bug fix - [x] `test` -- Adding or updating tests - [x] `ci` -- CI/CD pipeline changes ### Modifiers - [ ] Breaking change (`!`) ## Changes Made - Cherry-pick with attribution, in order: `f64c773136`, `6456ab9844`, `80dc0ab1bf`, `2e9f2fff65`, `048f98e005`, `f27d031bdb`. Verified against `gh pr view 2002 --json commits`; no merge or sync commits carried. - Carry exactly four test-infrastructure files from `48ea8d5e`: `tests/github_expression.py`, `tests/workflow_replay.py`, `tests/test_github_expression.py`, and `tests/test_workflow_replay.py`. Both implementations and the replay unit tests remain byte-identical to dev. Also carry the unchanged test-only CI prerequisite from `d14b03fe`: fetch tag `1.18.0` before replay tests in `.github/actions/test-project/action.yml`. No infrastructure changelog entries carried. - Omit exactly eight dev-only cases: `test_shipped_workflows[False-fork]`, `[False-same-repo]`, `[False-push]`, `[True-fork]`, `[True-same-repo]`, `[True-push]`, `test_workflow_mutations[fork]`, and `test_workflow_mutations[reusable]`. They require dev-only runner-class outputs and fork routing absent from this release branch. They return when the next regular release from dev lands. The reusable mutation also raises the same ValueError without mutation on this branch, so it was vacuous; remove it and the now-unused traversal helper. Every helper-behavior test is retained; no conditional skips or synthetic dev fixtures. - Exclude `DEVKIT_CI_LANE_SIZES` when resolving the toolchain key-list conflict. Put the changelog under `[1.18.2] - TBD` and regenerate the `.devcontainer` mirror. Keep the consumer root changelog template as the blank skeleton required by its existing smoke-deploy tests. ## Changelog Entry The hotfix-specific brief requires `[1.18.2] - TBD` instead of Unreleased: - **Promote releases on plan-limited private repositories** ([#1851](#1851)) - Stop retrying only rulesets plan-limit HTTP 403 responses and require one approval by default in both promote gates. - Count distinct current-head approvals from each reviewer's latest APPROVED, CHANGES_REQUESTED, or DISMISSED review, ignoring COMMENTED and PENDING and excluding the PR author; keep host retry diagnostics out of API responses. - Add `DEVKIT_RELEASE_REQUIRED_APPROVALS` for the 403 fallback; solo consumers can set 0, while real ruleset requirements retain precedence. ## Testing Latest combined check: 434 passed, exit 0: ```text nix develop -c uv run --with pytest-xdist pytest tests/test_promote_rules_fallback.py tests/test_vig_os_manifest.py tests/test_scaffold_drift.py tests/test_promote_release.py tests/test_github_expression.py tests/test_workflow_replay.py tests/test_flake_pin_lockstep.py tests/test_install_direnv_host.py tests/test_changelog_unreleased_typos.py tests/test_release_time_changelog.py -n 2 --basetemp=$HOME/.cache/devkit-pytest/1851-carry-r4 ``` Rebased onto `d1888f82` (`origin/release/1.18.2`, including #2008). Preserve both carry entries under one `### Fixed` list and regenerate the changelog mirror. All 16 checks are green on `ce50566e792c05113421c052c635ba5ab67a6820`, including Test Summary ([CI run](https://github.com/vig-os/devkit/actions/runs/41629525265)). `gh pr checks 2009 --watch` exited 0. - [x] Targeted tests pass locally (364 passed, exit 0): ```text nix develop -c uv run --with pytest-xdist pytest tests/test_promote_rules_fallback.py tests/test_vig_os_manifest.py tests/test_scaffold_drift.py tests/test_promote_release.py tests/test_github_expression.py tests/test_workflow_replay.py -n 2 --basetemp=$HOME/.cache/devkit-pytest/1851-carry-r3 ``` - Pre-change proof: initial fallback/manifest tests produced 18 failures and 37 passes (exit 1) before implementation. - Before the authorized omissions, helper tests produced 7 dev-shape failures and 208 passes (exit 1). - Follow-up replay and scaffold-drift tests: 48 passed, exit 0 (`nix develop -c uv run --with pytest-xdist pytest tests/test_scaffold_drift.py tests/test_workflow_replay.py -n 2 --basetemp=$HOME/.cache/devkit-pytest/1851-carry-r3-final`). - Targeted BATS smoke-deploy checks: 3 passed, exit 0 (`nix develop -c bats --filter 'smoke deploy (preserves|bootstraps)' tests/bats/init-workspace.bats`). - Initial CI exposed release history in the consumer skeleton (BATS/integration) and the missing `1.18.0` tag prerequisite (project tests). Restore the blank skeleton and carry dev's tag-fetch step; both root causes are addressed without changing helper behavior. - `git diff --check` and byte comparison of both helper implementations against `origin/dev`: exit 0. - All commits made in `nix develop` with hooks enabled. Cherry-pick attribution retained above the final `Refs:` line as required by commit validation. ### Manual Testing Details Reviewed all carried runtime files against `origin/dev`; differences are release-baseline features intentionally outside this carry: | File | Every remaining difference from dev | | --- | --- | | `release-required-approvals.sh` | None; byte-identical. | | `promote-release.yml` | Existing legacy resolve runner variable and root sparse checkout; no `.devkit-resolve` path/working-directory or runner-class inputs/outputs; existing hosted downstream job runners. Approval behavior matches dev. These belong to #1860, #1863 and the runner-class changes. | | `setup-devkit-toolchain/action.yml` | Retry helper matches dev. Existing host Nix setup lacks dev's ambient configuration preservation/validation, credential masking, extended experimental features and collision-safe export delimiter (#1907). | | `resolve-toolchain/action.yml` | Approval knob logic matches dev. Existing resolver lacks dev's runner-class inputs/outputs/environment/context, lane handling, diagnostics and migration, plus sparse-checkout working-directory support (#1860, #1927 and runner-class work). No dev-only lane-size key carried. | | `.vig-os` template | Approval knob matches dev. Only existing runner documentation and omitted lane-size settings differ; #1856 is now in the base. | | `init-workspace.sh` | Approval knob read/preserve/write logic matches dev. Existing differences concern Rust tool configs, language seeding/preview/notices and Rust flake detection (#1496, #1831); untracked-upgrade preflight and shared gitignore helpers (#1826); managed security/commit documentation (#1910); runner-lane validation and legacy key/hook migration (#1927, #1929). #1856 is now in the base. | ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] Documentation updated where required - [x] CHANGELOG updated under the explicitly required hotfix section - [x] Tests prove the fix and pass locally - [x] Required test infrastructure included ## Additional Notes Target is `release/1.18.2`. No merge or release dispatch is part of this carry. Container and nix-eval suites are left to CI, as required by the carry brief. Isolated local pytest directories are removed after use. Refs: #1851
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
Fix release promotion on private repositories whose GitHub plan returns the plan-limit HTTP 403 (
Upgrade to GitHub Pro) for branch rulesets. Both scaffold approval gates stop retrying that response and require one approving review by default.Type of Change
fix-- Bug fixtest-- Adding or updating testsModifiers
!) -- This change breaks backward compatibilityChanges Made
Upgrade to GitHub Proends retries immediately; rate-limit, permission, SAML, and other errors retain retries and fail on exhaustion. Host retry diagnostics go to stderr, preserving API stdout after a transient error.DEVKIT_RELEASE_REQUIRED_APPROVALS, a validated non-negative integer preserved through scaffold upgrades and resolved into both gates. Empty defaults to 1; solo consumers can set 0. The knob applies only to the 403 fallback; real ruleset counts retain precedence and classic protection remains enforced at merge time.reviewDecision == null.-eq 0to-lt "$REQUIRED_APPROVALS": a successful rules lookup can require more than one approval, so accepting just one when GitHub has no review decision would under-enforce the returned ruleset.Changelog Entry
Fixed
DEVKIT_RELEASE_REQUIRED_APPROVALSfor the 403 fallback; solo consumers can set 0, while real ruleset requirements retain precedence.Testing
Command:
uv run --with pytest-xdist pytest tests/test_promote_rules_fallback.py tests/test_promote_release.py tests/test_vig_os_manifest.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/1851-r3.Manual Testing Details
Regression RED: the replay suite exited 1 with eight failures when COMMENTED or PENDING followed APPROVED, then tests were committed separately. GREEN: all three targeted suites passed (145 tests, exit 0). The cases also confirm APPROVED → COMMENTED → CHANGES_REQUESTED refuses promotion on both jobs and paths. Only APPROVED, CHANGES_REQUESTED, and DISMISSED participate in selecting each reviewer's latest state; comments and pending reviews preserve the prior state.
Replay uses the scaffold's actual host retry helper and covers primary/secondary rate-limit, integration-permission, and SAML 403s; non-403 errors containing the plan message; duplicate reviewers, withdrawn/dismissed reviews, older heads, author exclusion, and distinct current-head reviewers. An earlier isolated HTTP 403 → HTTP 4 mutation was caught by the HTTP 401 assertion in both jobs.
Checklist
CHANGELOG.mdin theUnreleasedsection (and pasted the entry above)Additional Notes
No merge or workflow dispatch performed. Container and Nix evaluation suites are left to CI per repository process.
Refs: #1851