WIP: ci: Share qa-assets across GitHub Actions jobs

bitcoin/bitcoin: PR #36872

3 minor findings · 3 suggestions

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.

Findings

Link

[minor] · Shared asset preparation now gates matrix entries that never use it

A preparation failure now skips nine build-only or static-analysis matrix entries that never consume qa-assets, and successful runs make them restore an unused artifact.

Location: .github/workflows/ci.yml:415 (head).

Details and suggested fix

The job-level needs: test-assets and unconditional restore also cover IWYU, clang-tidy, 32-bit ARM, both macOS cross-builds, the three BSD cross-builds, and riscv32 bare metal. These entries disable unit tests and do not enable fuzz tests, so the base script never acquired qa-assets for them. If checkout, preparation, or upload fails, or preparation times out, the implicit success condition skips these unrelated checks. Move non-consuming entries into a separate matrix job without the prerequisite or restore step. Conditioning only the restore step cannot remove the static dependency. Actual consumers can retain the existing revision handoff and fail-without-download behavior.


Link

[minor] · Three-day asset retention blocks older failed-job reruns

By inspection, failed-job reruns after the three-day artifact expiry cannot restore qa-assets when preparation previously succeeded; a full workflow rerun is needed.

Location: .github/workflows/ci.yml:627 (head).

Details and suggested fix

GitHub's Re-run failed jobs leaves the successful test-assets prerequisite untouched. Once its artifacts expire, the unconditional download-artifact step cannot restore them, so a retried consumer fails before testing. Previously, direct acquisition did not depend on a retained qa-assets artifact. Set both artifacts' retention to cover the intended partial-rerun window; repository-default retention is an option if it is long enough. A full workflow rerun currently recovers, but repeats successful work and may select a newer qa-assets snapshot.


Link

[minor] · Standalone asset acquisition no longer refreshes or repairs existing files

Persistent standalone workspaces now reuse old script vectors or fail on malformed existing files; no current CI caller supplying a pre-existing file was found.

Location: test/download_utils.py:142 (head).

Details and suggested fix

With QA_ASSETS_DIR unset, an existing script_assets_test.json returns immediately if it parses as a JSON list. A malformed or truncated file instead raises before reaching the staged download, so retrying cannot repair it. Both Windows preparation scripts call this helper with workspace-relative destinations, and the base helper always attempted a download that could replace earlier content. Prepared Actions consumers bypass this branch, and the shell already reused existing directories. Preserve symlink rejection, but stage and validate a fresh download before replacing an existing regular file.


Optional improvements

Link

[suggestion] · Fuzz restoration retains the archive and duplicates source verification

Each fresh fuzz consumer retains the tar alongside two corpus trees and hashes the corpus three times, including two source-verification passes.

Location: test/download_utils.py:163 (head).

Details and suggested fix

The composite extracts and verifies the baseline but leaves $KIND.tar in place. download_fuzz_assets verifies that baseline again, copies it, and hashes the working copy. Delete the tar after successful restoration and omit the composite verification for fuzz inputs, retaining the helper's verification before copying and its post-copy check. This removes one stored archive and one full hashing pass without sacrificing standalone helper checks or the separate writable corpus. Runtime and runner disk headroom are unmeasured.


Link

[suggestion] · Manifest rejection paths lack negative tests

Normal CI exercises successful asset verification, but does not distinguish it from a verifier that accepts modified files or the wrong revision.

Location: test/download_utils.py:74 (head).

Details and suggested fix

The new integrity checks have no negative fixtures. Removing their rejection while preserving successful returns would leave normal workflow inputs passing, and the C++ script-vector test does not inspect manifests. Add a small offline test using a temporary Git repository with LICENSE and fixture asset directories. After checking successful preparation and verification, assert rejection of modified or extra files, symlinks, a missing manifest, a mismatched QA_ASSETS_REVISION, and an edited fuzz working copy. These cases exercise the documented fail-on-corruption guarantee without downloading qa-assets.


Link

[suggestion] · Prepared-mode rejection is retried as though acquisition failed

With prepared inputs and a differing existing working corpus, the shell retries a deterministic rejection ten times, adding about 196 seconds of backoff plus repeated hashing.

Location: ci/test/03_test_script.sh:63 (head).

Details and suggested fix

When QA_ASSETS_DIR is set, the helper performs only local verification and copying. An existing fuzz working corpus that differs from the manifest raises without changing it, so every retry repeats the same checks and failure. Corrupt restored artifacts normally fail earlier in the composite, and fresh CI workspaces normally lack an existing differing corpus, so this mainly affects persistent prepared workspaces. Apply CI_RETRY_EXE only when QA_ASSETS_DIR is empty. Prepared inputs would still fail without network fallback, while direct acquisition would retain retries.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

The script vectors originated as coverage-minimized results of extensive Taproot functional testing. Their author reported extracting vectors from 20,000 functional-test runs and reducing them to 105 cases using libFuzzer coverage tracking.

The downloaded JSON is substantive script-validation test material, not merely setup metadata. The pinned script_assets_tests consumer checks successful and failing spends across applicable consensus-flag combinations; changing its delivery affects access to that supplementary validation coverage.

Source 1

Issue #36814 proposed acquiring shared inputs once to reduce repeated external requests, give consumers identical inputs, and concentrate acquisition failures in preparation. It explicitly acknowledged that initial acquisition could still fail.

At the pinned base, shell jobs fetch the unit JSON or clone the fuzz corpus independently, while Windows has separate acquisition paths. The head introduces one preparation job and artifact handoffs, directly addressing this availability-versus-duplication tradeoff without eliminating the external dependency.

Source 1

An argument for improving the existing hosted CI emphasized contributor access: a contributor could run the tests with a GitHub account rather than needing admission to a platform-specific allow-list. Existing PR automation was also cited as a benefit.

This explains an incentive to improve distribution within the current workflow rather than treating hosting migration as a prerequisite. The head’s shared-input mechanism remains within GitHub Actions, while retaining direct acquisition for standalone scripts.

Source 1

Ralph's inferences

Freshness between runs and consistency within a run are separate goals. Recording a selected revision and checking file hashes can preserve a common snapshot for consumers without permanently fixing which upstream snapshot future runs select.

The head checks out qa-assets afresh, exports its revision, and verifies each restored file set against a manifest and the expected revision. This is best understood as snapshot agreement and transfer-integrity checking, rather than an independently maintained authentication anchor for upstream content. The historical proposal supplies the identical-input and recorded-revision premises; this distinction is an interpretation of the pinned implementation.

Source 1

Sharing test inputs introduces a distinction between a reusable baseline and job-local working state. Keeping those roles separate allows consumers to start from common inputs without making their subsequent workspace changes part of the shared baseline.

The head expresses this distinction through read-only container mounts and separate writable fuzz-corpus copies. The historical issue proposed extending shared acquisition to fuzz inputs, but the specific isolation rationale here is inferred from the pinned code, not attributed to that discussion.

Source 1

Unresolved disagreements

The inspected discussion does not resolve whether workflow-level redistribution is the appropriate response to the observed failures. One position favors reducing redundant requests and improving present-day determinism; another argues that upstream outages cannot be repaired by workflow changes and that an unreliable asset host should instead be reconsidered. The latter also disputes attributing HTTP 504 failures to curl.

This bounds the historical motivation: reducing independent acquisition attempts and ensuring common inputs is distinct from surviving an unavailable upstream host. These are competing scope and infrastructure positions, not findings about the current patch.

Source 1 · Source 2 · Source 3 · Source 4