Repository navigation
feat(upgrade): report a failed devkit upgrade as a tracking issue - #1535
Merged
Merged
Conversation
A failed devkit-upgrade leaves no artifact in the consumer repo today: the adoption branch only reaches the remote in the publish step, so a resolve, scaffold or in-shell-commit failure is visible only as a red scheduled run (live: vig-os/org-config run 32002045870). Two suites, both red: - tests/test_workflow_devkit_upgrade.py pins the wiring — a separate result-gated `report` job (a step-level `if: failure()` cannot survive a job-level abort), an issues-scoped best-effort mint kept off the upgrade job's token, marker-based lookup before create, close-on-success, and the resolve outputs the alert names. - tests/bats/devkit-upgrade-alert.bats executes the rendered `run:` blocks against a stub `gh` (the release-mirror-fold idiom) to cover the branching the structural pins cannot: create vs comment vs close, an unrelated open issue, an unresolved target, and the missing-grant degradation. Refs: #1530
A failed run left no artifact in the consumer repo: the adoption branch only reaches the remote in the publish step, so a resolve, scaffold or in-shell-commit failure showed up only as a red scheduled run, and the pin then stopped moving (live: vig-os/org-config run 32002045870, stuck on 1.9.0). The new `report` job files ONE tracking issue per repo, comments on that same issue on every repeat failure, and closes it on the next fully green run. It is not a revert of #1405: that removed the SUCCESS-path adoption issue, where the bot PR is already the artifact; this covers the failure path, where by construction there is none. The rejected alternative stands rejected — nothing half-applied is pushed, per #1308. Design decisions: - A separate `needs: upgrade` job rather than a late `if: failure()` step. A step never runs once the job itself is aborted (the 30-minute timeout, a lost runner), which is one of the silent failures being closed. Keying both legs on `needs.upgrade.result` covers a resolve-step failure (malformed pin, missing DEVKIT_VERSION) for free and stays quiet on a cancelled run. - The issues grant is a SEPARATE, `continue-on-error` mint, not an extra `permission-issues: write` on the upgrade job's token. create-github-app-token fails the mint when it requests a permission the installation lacks, and this App has needed no Issues grant since #1405, so adding it to the primary mint would turn every green upgrade red on an org that has not re-granted it. Reporting may never break the path it reports on: without the grant both legs emit a warning and exit 0. - De-duplication keys on an HTML body marker, so the title can stay version-free — a failure on a different target finds the same open issue and no title goes stale. `gh issue list` reads the REST index, not the eventually-consistent search index. - The failing step name comes from the run's own job records via the default token (`actions: read`), so no per-step instrumentation has to be kept in sync. Versions come from the resolve step, promoted to job outputs, with `current` published before anything below it can fail. - Closing on ANY green run, including the "already current" and DEVKIT_AUTO_UPGRADE=false no-ops: the workflow ran end to end, so the recorded failure no longer reproduces, and an opted-out consumer should not keep an open alert. Org action required: grant Issues (write) to the devkit-upgrade App installation. Until then the upgrade path is unchanged and reporting is a warning. Refs: #1530
…ilure A job-level if without a status-check function gets an implicit success() gate, so the report job was skipped on exactly the failed runs it exists to report. !cancelled() preserves the intended silence on cancelled runs while letting both the failure and success legs evaluate. The structural test now pins the status function alongside the result checks. Refs: #1530
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.
Summary
Implements the failure alert from #1530: today a failed
devkit-upgraderun leaves no artifact in the consumer repo (the remote ref only appears in the late Publish step), so a broken upgrade fails silently every week — observed live at org-config run 32002045870.reportjob in the scaffolddevkit-upgrade.yml, gated!cancelled() && (needs.upgrade.result == 'failure' || == 'success')— a separate job rather than a late step so a job abort (timeout, lost runner) still reports, and resolve-step failures are covered for free. Silent on cancelled runs.chore(devkit): automated devkit upgrade is failing) so a different target on the next failure lands in the same issue. Body carries the run URL, the failing step (read from the run's own job records viaactions: read), and pinned vs target version (unknownwhen resolve itself died). Lookup via directgh issue list, not the eventually-consistent search index. No label dependency.permission-issues: writetoken withcontinue-on-error—create-github-app-tokenfails a mint requesting an ungranted permission, so putting it on the primary mint would turn green upgrades red. All report steps are best-effort: without the grant the leg degrades to a::warning::and the upgrade path behaves exactly as today. (Both org installations ofvigos-devkit-upgradealready haveissues: writeaccepted, verified via API — so this fires for real from day one.)Review caught and fixed one real bug in the initial implementation: the job-level
iflacked a status-check function, so the implicitsuccess()gate would have skipped the report job on exactly the failed runs it exists for — now!cancelled()-gated and pinned by test.Rollout note: consumers get this one train after it ships (the cron runs the workflow from their base branch).
Test plan
tests/test_workflow_devkit_upgrade.py: 26 passed (7 new structural pins: result-gated job, issues-only mint, marker + list-before-create, version-free title, env plumbing, close leg,!cancelled()gate; TDD red first: 7 failed)tests/bats/devkit-upgrade-alert.bats(new): 9/9 — executes the extractedrun:blocks against a stubgh(create vs comment vs close branching, unknown-target, missing-grant no-ops)bats tests/bats/init-workspace.bats257/257;release-mirror-fold-lint.bats4/4 (typos + actionlint over the full render, both models)prek run --all-filesexit 0 (verified independently of the implementation run)Closes #1530