Repository navigation
fix(ci): pin API file commits to checkout revisions - #2031
Merged
Merged
Conversation
gerchowl
force-pushed
the
bugfix/2028-commit-action-base-sha
branch
from
November 4, 2026 05:43
d1c6ab8 to
05217f5
Compare
This was referenced Nov 4, 2026
gerchowl
added a commit
that referenced
this pull request
Nov 6, 2026
## Description #2031 added a `Record checkout SHA` step (`CHECKOUT_SHA=$(git rev-parse HEAD)`) right after `actions/checkout` and before `Set up devkit toolchain`. In a `container:` job, git refuses the workspace as "dubious ownership" (exit 128) until `setup-devkit-toolchain` marks it a `safe.directory`. That broke the 1.19.0-rc4 smoke test (Prepare Release run 42151390302). This PR takes the SHA from `actions/checkout`'s documented `commit` output, so no git call is needed. Release blocker for 1.19.0 (#2033). ## Type of Change - [x] `fix` -- Bug fix - [x] `test` -- Adding or updating tests ### Modifiers - [ ] Breaking change (`!`) -- This change breaks backward compatibility ## Changes Made - **15 captures that directly follow `actions/checkout`** (devkit `.github/workflows`: prepare-release ×2, prepare-release-extension, prepare-hotfix, release, abandon-release, sync-issues, update-nixpkgs, update-nixpkgs-unstable; consumer `assets/workspace/.github/workflows`: prepare-release ×2, prepare-hotfix, release-core, abandon-release, sync-issues): - The checkout step gets `id: checkout`. - The capture reads `CHECKOUT_SHA: ${{ steps.checkout.outputs.commit }}` through `env:`. Nothing is interpolated into `run:`. - It fails closed (`::error::`, exit 1) when the output is empty. - The step id `checkout-state`, the output `sha`, every `BASE_SHA` consumer and the `Require pinned commit base` guards are unchanged. - `actions/checkout@3d3c42e5` (v7.0.1) declares `outputs.commit` in its `action.yml`. `src/git-source-provider.ts` sets it from `git log -1 --format=%H` after checkout. - **3 captures left on `git rev-parse` on purpose**: the extension's dev fallback (`dev-checkout-state`) and sync-main-to-dev in both trees. - Each follows a later manual `git checkout` step, so HEAD is no longer the commit `actions/checkout` reported, and that output would be the wrong base. - They run after the toolchain/safe-directory setup. The new ordering scan proves this for the container job. - **New guard `tests/test_workflow_checkout_sha.py`** scans every workflow in both trees: - In every job with a `container:` key, no `run:` step may invoke git before the step that sets `safe.directory`. That step is `./.github/actions/setup-devkit-toolchain`, whose "Configure in-container toolchain env" step runs `git config --global --add safe.directory "$GITHUB_WORKSPACE"`; the test asserts that line exists. - Every `Record checkout SHA` after `actions/checkout` must read that step's `commit` output, use no git and fail closed when it is empty. - Anything else must follow a manual git checkout. - It checks that the scan is not vacuous: at least 20 container jobs and exactly 18 captures. - **#2031/#2028 replay tests** (`test_commit_action_base_sha.py`, `test_abandon_release.py`) now seed the checkout `commit` output. The fail-closed tests check that an empty output stops the job with exit 1 (git-based captures still surface git's exit code). - `docs/RELEASE_CYCLE.md` documents the capture rule and the reason for the exception. ## Changelog Entry Under `## [1.19.0] - TBD` → `### Fixed` (release branch): - **Record checkout SHAs without git in container jobs** ([#2055](#2055)) - Take the API commit base from `actions/checkout`'s `commit` output, so Prepare Release, Prepare Hotfix, Release and Sync Issues no longer fail with "dubious ownership" (exit 128) in `devcontainer`/`both` mode. - Fail closed when the checkout reports no commit; a static guard rejects any container job that runs git before its `safe.directory` setup. ## Testing - [x] Tests pass locally (touched suites only; CI runs the rest) - [ ] Manual testing performed (describe below) ### Manual Testing Details - RED on base (commit `test(ci): ...`): `pytest tests/test_workflow_checkout_sha.py` gave 20 failed and 23 passed, exit 1. The failures were 5 container jobs running git before safe.directory (consumer prepare-hotfix:prepare, prepare-release:prepare and :rollback, release-core:finalize, sync-issues:sync) and 15 captures. - GREEN: the new guard plus `test_commit_action_base_sha.py` and `test_abandon_release.py` gave 181 passed, exit 0. - All 63 non-container, non-nix test files that read these workflows (scaffold drift/pin and workflow shape suites included) gave 2365 passed and 4 skipped, exit 0. ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly - [x] I have updated `CHANGELOG.md` (release section, per release-branch fix) and pasted the entry above - [x] My changes generate no new warnings or errors - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published ## Additional Notes Targets `release/1.19.0`, not `dev`: it fixes the 1.19.0 release candidate. After merge, the next RC smoke run is the end-to-end proof. Refs: #2055
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
Pin all API file commits to the revision used to compute their files. Concurrent updates now cause a non-fast-forward failure instead of silently replacing newer changelog entries or generated files. Both devkit and consumer workflows use fail-closed SHA capture immediately after the relevant checkout.
Type of Change
fix-- Bug fixtest-- Adding or updating testsci-- CI/CD pipeline changesModifiers
!)Changes Made
BASE_SHAfor all 16 previously unprotected calls; retain the two protected abandon-release calls.Every
vig-os/commit-actioncall under both workflow trees was audited. No moving-head exemptions are needed.Dmeans.github/workflows/;Cmeansassets/workspace/.github/workflows/.Changelog Entry
Fixed
Testing
09e7ef49745e02438937aa45c732e8e84b5cd884, includingTest Summary;gh pr checks 2031 --watchexited 0.Manual Testing Details
RED first (round 1): new replay tests produced 32 failures and 4 passes (exit 1); baseline tests produced 2 failures (exit 1). Round 2: rollback and capture-contract tests produced 6 failures and 56 passes (exit 1), including the rejected-freeze overwrite. Round 3: consumer rollback, exact freeze output/visibility and runtime guard tests produced 45 failures and 79 passes (exit 1). Tests were committed before implementation.
GREEN:
uv run --with pytest-xdist pytest tests/test_commit_action_base_sha.py tests/test_prepare_rollback_concurrency.py tests/test_abandon_release.py tests/test_workflow_prepare_extension.py tests/test_workflow_prepare_hotfix.py tests/test_workflow_prepare_sync_guard.py tests/test_workflow_sync_checkout.py tests/test_workflow_sync_autoresolve.py tests/test_workflow_sync_watermark.py tests/test_workflow_model.py tests/test_release_core.py tests/test_release_rollback_guard.py tests/test_release_prepare_bundle.py tests/test_release_time_changelog.py -n 4 --basetemp="$HOME/.cache/devkit-pytest/2028-r3-targeted2"— 357 passed, exit 0.Replay tests execute every capture, advance the local Git head, and verify the API base still resolves to the original SHA. A failing Git stub returns 17: every capture fails with that code, emits no output, and prevents the following sentinel step from executing. Tests reject the extension’s wrong-checkout mutant and a narrowed capture condition for all 18 callers, demonstrating skipped captures resolve to an empty base. Prepare rollback replays cover rejected freeze with concurrent changes, landed freeze with unchanged dev, and landed freeze followed by another change in both copies; the consumer also covers failure before the freeze. Removing the consumer empty-freeze guard produced 2 failures and 2 passes (exit 1); the original workflow was restored. Every runtime guard is replayed with empty and nonempty input. The sync-issues future-output capture mutant skips capture, then fails at the real runtime guard when sync later produces changed files, in both copies. Workflow model tests cover gitflow and trunk rendering. Required commit hooks run inside
nix develop.The checkout rollback baseline remains safe: any failure before a confirmed freeze skips restoration, a confirmed freeze identifies the run’s own write, a later dev update fails the exact-SHA guard, and BASE_SHA rejects races after that guard. A missing freeze output after an ambiguous API failure deliberately leaves restoration to manual recovery.
Checklist
CHANGELOG.mdin the[Unreleased]sectionAdditional Notes
A moved target fails the API update; it does not automatically recompute generated files. Rerun from a fresh checkout after reviewing the failed phase and partial release state. No workflows were dispatched. No changes to
assets/workspace/CHANGELOG.md.Refs: #2028