Share the AUR notifier and the Nix hash classifier between their callers
Two pieces of logic each existed twice, and in both cases only one copy would
have been fixed. Both are consequences of my own earlier changes.
Label-based dedup, in both AUR paths
#607 was opened by release.yml, not the manual recovery workflow — its body
("Publishing [v0.8.1]…") is release.yml's wording, not aur-publish.yml's
("Recovery publish of…"). The canonical #602 was already open; I had retitled it,
and both files dedupe with --search "in:title $TITLE", so the lookup missed
and filed a duplicate. Fixing only the manual workflow leaves the automatic
release path opening another one on the next failure.
scripts/notify-issue.sh now searches open issues by the aur-publish
label — which survives retitling, reassignment and rewording — comments on the
match, or creates with the label. Both workflows call it.
It fails closed
The old lookup was ... 2>/dev/null || true. That makes a rate limit, a
permissions gap and a GitHub outage indistinguishable from "no open issue", and
the very next line files one. Four branches, each pinned by a test:
| Lookup result | Behaviour |
|---|---|
| errors | file nothing, exit 2, annotation retained |
| zero matches | create one issue, carrying the label |
| exactly one | comment on it |
| more than one | refuse to guess, exit 3, file nothing |
Both workflows emit their ::error:: annotation regardless of what the notifier
did, so when it fails closed the failure is still visible on the run.
Extract the Nix classifier so tests can reach it
The nix-build job from #606 triggers on go.mod/go.sum, so every weekly
dependabot Go bump will fail it — a dependency change invalidates vendorHash
and dependabot will not update it. The job should fail. The defect is that it
failed as a raw nix dump with no remedy, and being an inline run: block, no
test could reach it. Its path filter also omitted .github/workflows/test.yml,
so a PR editing the job would skip the job it edited.
scripts/nix-build-check.sh runs the build, replays nix's diagnostics either
way, propagates the build's real exit status (no || true), and emits the
corrected sha256-… plus make update-nix-hash — but only when both the
fixed-output diagnostic and an SRI-shaped value are present.
That guard is scripts/extract-nix-vendor-hash.sh, shared with
update-nix-flake.sh rather than copied into it. Two production classifiers
that can drift is one too many when the one that drifts is the one that writes
into nix/package.nix. Fixture tests pin the helper; separate wrapper tests pin
exit propagation, diagnostic replay, annotation rendering, and that a successful
build is not trusted until the binary it produced actually runs.
Considered and rejected: narrowing the filter to drop go.sum. It would still
have caught v0.8.0's Go-toolchain drift (go.mod's go directive plus
flake.lock) but would stop catching a stale vendorHash — the second v0.8.0
defect.
Verification
bin/ciexit 0;make lint-actionsclean (actionlint + zizmor).- 31 BATS tests green across the three new suites and the existing
update_nix_flake.bats, which now routes through the shared classifier. - Mutation-checked, not just green: reverting the lookup to
|| truefails
exactly the fail-closed test, and loosening the SRI pattern to[^[:space:]]+
fails exactly the two shape tests. Nothing else moved. - The live notify path was dry-run against real GitHub with writes stubbed — it
resolves to labelled #602 and takes the comment branch, so it will not open
a third issue. - This PR changes
test.yml, so thenix-buildjob running here is itself the
proof that the widened path filter works. - A temporary wrong-
vendorHashcommit will demonstrate the::error::
rendering once, then be removed before review.
The aur-publish label has been created and applied to #602, so the label path
is live before this merges.
Summary by cubic
Share the AUR failure notifier and the Nix vendorHash classifier across workflows to remove duplicate logic, prevent duplicate issues, and make CI failures actionable with the correct hash and remedy.
-
Bug Fixes
- AUR issue dedup now keys on the
aur-publishlabel viascripts/notify-issue.sh. - Notifier fails closed on lookup errors or multiple matches (files nothing; exits non‑zero). Both workflows still emit their
::error::annotation and propagate the notifier’s status.
- AUR issue dedup now keys on the
-
Refactors
- Extracted vendorHash classifier to
scripts/extract-nix-vendor-hash.shand wired it intoscripts/nix-build-check.shandscripts/update-nix-flake.sh. nix-buildjob now runsscripts/nix-build-check.sh: replays nix logs, preserves real exit status, annotates with the correctedsha256-…andmake update-nix-hashonly on a fixed‑output mismatch with an SRI hash, verifies the built binary runs, and errors if nix prints no store path.- Widened
test.ymlpath filter to include Nix and script paths (incl. this file). Added BATS tests for the notifier, classifier, and build wrapper.
- Extracted vendorHash classifier to