8000 fix(ci): reuse verified Java artifacts across partial reruns by adityamukho · Pull Request #45 · project-minigraf/minigraf-java · GitHub
[go: up one dir, main page]

Skip to content

fix(ci): reuse verified Java artifacts across partial reruns - #45

Merged
adityamukho merged 3 commits into
mainfrom
fix/39-partial-ci-artifact-reuse
Dec 4, 2026
Merged

adityamukho merged 3 commits into
mainfrom
fix/39-partial-ci-artifact-reuse

Conversation

@adityamukho
@adityamukho adityamukho commented Dec 3, 2026 •
Copy link
Copy Markdown
Contributor

Problem

Partial CI retries advance github.run_attempt for rerun jobs, while successful producers retain their earlier artifact names. In #39, the macOS retry uploaded an attempt-5 artifact while the other six natives still had attempt-4 names, so assembly could not find the complete set. Consumer-only retries had the same problem with the JAR artifact.

Changes

  • Use stable ci names within a workflow run when no explicit suffix is supplied; permit replacement only for those CI package uploads.
  • Resolve ordinary and v2.x source refs to immutable SHAs once, and pass the retained resolver outputs to packaging, source tests and consumers.
  • Package each CI native binary with a manifest binding source/workflow commits, repository/run, target and Rust targets, dependency and normalized lockfile identity, filename, prefix, version and binary SHA-256.
  • Verify the complete seven-target set before modifying resources or starting JAR assembly. Mixed producer attempts are accepted only when every required identity matches.
  • Preserve explicit release preparation suffixes, immutable package uploads, binary-only release native archives, and the existing provenance/sealing schema. release.yml is unchanged.

Stable names avoid attempt-search selection logic. Manifest validation supplies the early failure for missing, stale, conflicting or corrupt inputs.

Review follow-up

The latest review accepted the implementation, documentation cleanup and original five-attempt hosted acceptance. Its remaining CI-recovery and rehearsal-tracking requests are addressed below. The changes also address the earlier review findings:

  • Both consumer JAR downloads now pass github-token; the maintenance package forwards an explicit suffix consistently.
  • Negative fixtures assert the intended diagnostic and preserve the real run-ID type.
  • The release fixture checks copied binary-only resources and actual JAR contents while faking only external commands.
  • Seven workflow-contract tests protect naming, overwrite, source pinning and suffix forwarding.
  • The policy documents immutable release-upload recovery and explicitly permits mixed floating toolchains for ordinary CI.
  • Both earlier commits were reworded without CI-skip directives, preserving their source trees.

After all retry acceptance completed, documentation-only commit e9772656155122b7e41884fd55b617489cf92ad1 removed the PR-specific merge checklist from the permanent guide and retained general workflow-version/expiry guidance. The final commit changes only .github/ci-artifacts.md; workflow, implementation and test files are unchanged from the tested head.

Validation

All functional hosted acceptance passed on PR head be194d63510ed62e55429abe72eaa90dddecdf66, using one run and four sequential individual-job retries. No push occurred between those attempts.

Attempt Selected work Jobs actually executed Result
1 Fresh run 37 Both packages, JAR inspection/rebuild comparison and all 12 consumers passed
2 Ordinary universal2 8 One native, JAR and six consumers passed; six other ordinary natives retained
3 Ordinary JAR assembly 7 JAR and six consumers passed; all seven ordinary natives retained
4 Ordinary Linux x86-64 consumer 1 Retained attempt-3 JAR consumed successfully; only its receipt replaced
5 v2.x Linux x86-64 consumer 1 Retained attempt-1 maintenance JAR consumed successfully; only its receipt replaced

GitHub creates new check-run IDs for retained results, so execution counts were verified from original execution timestamps and complete step histories, rather than job IDs alone.

Artifact and source evidence

  • Attempt 2 replaced ci-native-universal2 ID 15727507392 with 15743761270. Its manifest records producer attempt 2. The other 13 native artifact IDs and archive digests remained unchanged, including all six ordinary peers.
  • JAR download logs selected exactly that mixed-attempt set. All seven native bytes embedded in the JAR matched the corresponding manifest digests.
  • Ordinary dist-jar-ci IDs progressed 15731295695 → 15743407657 → 15744659620 in attempts 1–3. Distribution-file hashes were unchanged. Attempt 4 downloaded retained ID 15744659620.
  • The maintenance distribution retained ID 15730456124 throughout; attempt 5 downloaded it successfully. Both consumer-only attempts preserved both distribution artifacts and all 14 native artifact IDs/digests.
  • Original workflow and ordinary source SHA: 59702ed091abb4d865e2b21d6f9dfe926f106616 (the PR merge snapshot). Maintenance source SHA: 047ad05a01ab0b95544bc1953c2abf9c1d0fd1f2.
  • Every rerun checkout matched its original source/workflow SHA. The resolver retained its original execution and step history in all four retries.
  • Native archive and binary digests, exact manifest schemas/targets, dependency and normalized lockfile identity were independently checked. JAR distributions and representative consumer receipt file hashes were also checked before each overwrite.

Source-pinning limit: v2.x remained at the same commit during these attempts. Retained resolver output use is verified; a maintenance-branch advance between attempts was not directly exercised.

Fixture and release-isolation coverage

  • 36 targeted local tests passed after the initial review fixes: 17 artifact/retry tests, 7 workflow-contract tests and 12 existing release tests.
  • Fresh hosted release-fixtures passed both complete suites: 32 shared release tests and 78 Java tests.
  • Negative cases cover identity, target, digest, completeness, malformed manifests, unexpected keys and invalid producer attempts.
  • Python/YAML parsing and patch application checks passed.
  • Explicit preparation suffix selection, CI-only package overwrite, binary-only release archives and suffix 4 selection independently of the current attempt are covered by passing fixtures/contracts. release.yml is unchanged.

A hosted release rehearsal is tracked separately in #46; no release preparation, tagging or publishing was performed for this acceptance.

Current documentation-only head

CI on the current head e9772656155122b7e41884fd55b617489cf92ad1 is green: run 47147361590, attempt 2 completed with all 37 jobs successful.

Attempt 1 failed because three macOS jobs were cancelled before receiving a runner; all 20 jobs that executed passed. Re-run failed jobs recovered the run on the same head:

  • 17 jobs actually executed: three macOS jobs, both JAR assemblies and all 12 consumers. The 20 successful original jobs retained their execution timestamps and step histories.
  • All 24 original artifacts retained their IDs, digests, sizes and creation timestamps, including the 12 successful non-macOS natives and their 12 provenance artifacts.
  • Ordinary macOS artifact 15799570045 and maintenance macOS artifact 15797026849 were added with producer-attempt-2 manifests. Both passed independent target, identity and archive/binary digest checks.
  • Each JAR log selected exactly six retained attempt-1 natives plus its new macOS artifact. Both JAR inspection/rebuild checks and all 12 consumers passed.
  • Ordinary distribution 15799575587 and maintenance distribution 15800925095 were consumed by their respective source lines; representative consumer logs and provenance receipts were verified.
  • The source resolver did not run again. The recovered native/JAR and representative consumer checkouts match workflow/ordinary source 30dd3897280e31e692ac76c943475afe77b24a8d (this head's PR merge snapshot) and maintenance source 047ad05a01ab0b95544bc1953c2abf9c1d0fd1f2.

This also exercises partial-rerun reuse on both source lines after a real runner-allocation failure. The original five-attempt controlled acceptance above remains complete.

An already-started run retains the workflow and artifact protocol that started it. Start a fresh run after changing that protocol; expired or deleted inputs require rebuilding the affected producers.

Related audit

Read-only inspection found the same fallback in the other six bindings' main workflows: Node has the closest native-aggregation equivalent; C/Python have matrix-to-consumer gaps; WASM/Android/Swift have consumer-only retry gaps. Android also supplies the attempt fallback in its CI caller. Those repositories are outside this PR.

Closes #39.

@adityamukho adityamukho left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed af28e01 by reading the diff and the surrounding workflow/release code. I did not run the tests or any workflow. Findings were not independently verified.

I found no definite logic bug in the manifest record/verify code or the SHA pinning. One item to resolve before merging, the rest are minor:

  1. Important: [skip ci] is in the only commit's subject, so none of this workflow change has executed (the PR has no checks). The repo allows squash merges with COMMIT_MESSAGES and rebase merges; either can carry the marker to main and skip its push CI too. Fix: reword the commit without the marker, get a green fresh run, and do the partial-rerun acceptance list before merging.
  2. Pre-existing: release-suffixed uploads can block "Re-run failed jobs" (inline).
  3. Nits: toolchain missing from the identity, token-less dist-jar download, loose negative assertions, heavily mocked test, no test of the workflow wiring (inline).

— Claude (Opus 5.5), automated review via Claude Code

Comment thread .github/workflows/package.yml Resolved
Comment thread .github/java_release.py Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/test_java_ci_artifacts.py Resolved
Comment thread .github/test_java_ci_artifacts.py Resolved
Comment thread .github/workflows/package.yml Resolved
Pin source commits once, use stable CI artifact names, and validate the complete native set before JAR assembly. Preserve explicit release preparation suffixes and the existing sealing contract.

Add offline coverage for fresh and mixed-attempt native sets and provenance failures. Hosted acceptance and Claude review remain pending.

Refs #39.
Tighten negative diagnostics, exercise binary-only release assembly, and cover workflow artifact/source/overwrite contracts. Use explicit token lookup for both JAR consumers and forward the maintenance suffix consistently.

Document immutable release recovery and the ordinary CI policy allowing mixed floating toolchains. Hosted acceptance remains pending explicit authorization to lift the no-CI constraint; remove skip directives from all PR commits before merging.

Refs #39.
@adityamukho
adityamukho force-pushed the fix/39-partial-ci-artifact-reuse branch from cc91c94 to be194d6 Compare December 3, 2026 13:41
@adityamukho adityamukho left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on be194d6. I read the full fix diff. 17fa267 has the same tree as the previously reviewed af28e01 (ae5c5a2). I did not run anything locally; test results below are from the CI logs.

Earlier findings

  1. [skip ci]: resolved. Neither commit message carries it, and run 47118308653 is green on attempt 1, including both packages and all 12 consumer legs.
  2. Release upload conflict: resolved by documentation. I checked the pre-tag recovery advice against the code: the suffix comes from GITHUB_RUN_ATTEMPT when prepare runs, so "Re-run all jobs" does allocate a new one.
  3. Toolchain identity: resolved as an explicit policy that mixed toolchains are acceptable for CI.
  4. dist-jar downloads: both now pass github-token. The cross-attempt lookup itself is still unexercised (see below).
  5. Negative assertions: resolved. They match specific diagnostics, and run_id is now mutated as a string.
  6. Over-mocked assembly test: resolved. Only external commands are faked, and it checks copied resources and JAR contents.
  7. Workflow wiring: resolved by test_java_ci_workflows.py. It ran in release-fixtures (78 tests, OK).

Still open before merge: the partial-rerun acceptance. The run has only had attempt 1, so the behaviour #39 is about has not been exercised on hosted runners: a universal2-only retry, a JAR-only retry and a consumer-only retry.

Nit, new: the "Acceptance and merge gate" section of .github/ci-artifacts.md is mostly this PR's checklist ("must still exercise a fresh patched run", "pre-fix run") and goes stale on merge. It is already in the PR description; consider dropping it from the permanent doc.

No new correctness issues found.

— Claude (Opus 5.5), automated review via Claude Code

@adityamukho adityamukho left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining before merge (head be194d6, run 47118308653, attempt 1 green)

Re-run individual jobs in that same run, one at a time, waiting for each attempt to finish. GitHub also re-runs the jobs that depend on the selected one. Do not use "Re-run all jobs", and do not push in between, since a push starts a new run.

  • 1. Native only: re-run Package / Build native (universal2). Expect a new ID for ci-native-universal2, the other six native IDs unchanged, and JAR assembly and consumers green.
  • 2. JAR only: re-run Package / Assemble fat JAR. Expect all seven native IDs unchanged from step 1, a new dist-jar-ci ID, and consumers green.
  • 3. Consumer only: re-run one Consumer test leg from the ordinary build and one from the v2.x build. Expect dist-jar-ci and v2x-dist-jar-ci IDs unchanged from before this step, and both legs green.
  • 4. Source pinning: in each attempt, confirm Pin source commits for this run did not execute again and that the re-run jobs checked out the same source SHAs as attempt 1, including v2.x in step 3. If v2.x does not advance in the meantime, the "even if the maintenance branch advances" case is not directly exercised; say so when ticking it.
  • 5. Release suffix isolation: the PR description lists this as hosted acceptance but also excludes a release rehearsal. Either run a rehearsal, or move the item to a follow-up and rely on the contract tests for this PR.
  • 6. Optional nit: drop the "Acceptance and merge gate" section from .github/ci-artifacts.md. Do this after steps 1-4 if those results are to be kept against this run; the push will start a fresh CI run.

Attempt 1 artifact IDs for comparison:

Artifact ID
ci-native-universal2 15727507392
ci-native-x86_64-unknown-linux-gnu 15727183313
ci-native-aarch64-unknown-linux-gnu 15727148543
ci-native-x86_64-unknown-linux-musl 15727148151
ci-native-aarch64-unknown-linux-musl 15724629429
ci-native-x86_64-pc-windows-msvc 15724534576
ci-native-aarch64-pc-windows-msvc 15727871123
dist-jar-ci 15731295695
v2x-dist-jar-ci 15730456124

List current IDs after each attempt:

gh api --paginate "repos/project-minigraf/minigraf-java/actions/runs/47118308653/artifacts?per_page=100" \
  --jq '.artifacts[] | select(.name | test("native|dist-jar")) | [.name, .id] | @tsv' | sort

— Claude (Opus 5.5), automated review via Claude Code

Remove the PR-specific acceptance checklist from the permanent policy.
Keep the general guidance on workflow versions and expired artifacts.
Acceptance results remain recorded in the pull request.
@adityamukho adityamukho left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on e977265 and the hosted acceptance evidence.

New commit: changes only .github/ci-artifacts.md, removing the PR-specific section and keeping the general guidance. The nit is resolved; no new findings.

Acceptance on be194d6, run 47118308653: accepted. I checked the main claims against GitHub's API, job logs and the live artifacts, not only the supplied evidence package:

  • All five attempts are green and executed 37, 8, 7, 1 and 1 jobs. The source resolver ran only in attempt 1.
  • Attempt 2's JAR job downloaded six attempt-1 natives plus the replaced ci-native-universal2 (15743761270). This is the #39 scenario.
  • Attempt 3 reused all seven natives. Attempts 4 and 5 downloaded the retained dist-jar-ci (15744659620) and v2x-dist-jar-ci (15730456124).
  • All 14 current native binaries match their manifest SHA-256. The natives embedded in both current JARs match those manifests.
  • The Linux x86-64 consumer receipts in the package match the current distribution files in all five attempts' evidence (ordinary 1-4, v2.x 5).
  • The seven rerun jobs whose logs I read checked out the attempt-1 SHAs. I did not read the logs of the other rerun consumer legs.

Accepted limits, as the description states: v2.x did not advance between attempts, and the hosted release rehearsal is deferred. Please open an issue for the rehearsal if there isn't one.

Still open before merge: CI on the current head is red. Run 47147361590 ended in failure after the description was written, so its "pending" text is out of date. The three macOS jobs were never assigned a runner ("not acquired by Runner of type hosted even after multiple attempts"), so JAR assembly and all consumers were skipped. Every job that got a runner passed; this is not a code failure.

  • Use "Re-run failed jobs" on that run and get it green. The other 12 natives should be reused from attempt 1, which also exercises this fix on a real runner outage.
  • Update the "Current documentation-only head" section of the description with the result.

— Claude (Opus 5.5), automated review via Claude Code

@adityamukho adityamukho left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on the current-head recovery for e977265. I checked it against GitHub's API and the job logs, not only the supplied evidence package.

Both items from my previous review are resolved:

  • CI on the current head is green. Run 47147361590 attempt 2 shows 37/37 jobs successful. 17 jobs executed: the three previously unassigned macOS jobs, both JAR assemblies and all 12 consumers. The other 20, including the source resolver, were retained.
  • The release rehearsal is tracked in #46. Its acceptance steps cover the preparation-attempt vs workflow-attempt case and confirm that tagging and publishing stay skipped.

The recovery reused retained natives after a real runner outage:

  • The ordinary JAR job downloaded six attempt-1 natives plus the new ci-native-universal2 (15799570045). The v2.x JAR job did the same with v2x-ci-native-universal2 (15797026849). Both passed CI-native verification.
  • The Linux x86-64 consumers downloaded the new distributions, dist-jar-ci 15799575587 and v2x-dist-jar-ci 15800925095.
  • All four jobs checked out the merge snapshot 30dd389, whose parents are cdbb50a and e977265; the v2.x jobs also checked out 047ad05.

I did not download this run's distributions; the byte-level checks in my previous review apply to run 47118308653. The description is updated to match.

I have no outstanding findings. Branch advancement between attempts was not exercised, and the release rehearsal remains deferred to #46; both are recorded in the description.

— Claude (Opus 5.5), automated review via Claude Code

@adityamukho
adityamukho merged commit 45dd588 into main Dec 4, 2026
61 of 64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial CI reruns cannot find native JAR artifacts from earlier attempts

1 participant

0