Skip to content

fix: verify release assets before replacement - #9

Merged
vmvarela merged 1 commit into
masterfrom
fix/release-asset-integrity
Oct 24, 2026
Merged

vmvarela merged 1 commit into
masterfrom
fix/release-asset-integrity

Conversation

@vmvarela

Copy link
Copy Markdown
Owner

What

Release asset reconciliation now proves content equality before replacing a destination asset:

  • Computes the source SHA-256 after download and validates any declared digest.
  • Keeps the fast path when both API digests are present. When a digest is missing, it hashes the destination only if sizes match, so unchanged assets keep their IDs.
  • Aborts before DELETE if the source or destination cannot be read or verified.
  • Decodes the upload response and rejects size or SHA-256 mismatches; non-2xx responses include up to 4 KiB of body.
  • Reports the dry-run Latest release by tag instead of a synthetic /releases/0.
  • Ignores local build outputs and documents the extra comparison download.

Why

Without API digests, every run deleted and re-uploaded identical assets. That changed asset IDs and URLs and reopened the window where a failed upload leaves the asset missing. Upload responses were also discarded, so a bad response could be reported as success.

Closes #7.

How tested

  • go test ./... — 26 tests pass.
  • go test -race ./...
  • go vet ./...
  • go build ./...
  • gofmt -l . and git diff --check clean.

New tests cover equal content without digests, same-size different content, a destination already matching by digest, destination read failure, upload metadata mismatches, malformed or empty upload responses, bounded error bodies, and dry-run output.

No real replication was run locally; CI exercises the digest path with the existing end-to-end fixture. Asset replacement remains non-atomic: a failed upload after DELETE can still leave the asset absent until a successful rerun.

Remaining work

None in this PR. Merge and v0.1.0 publication require separate approval.

Compare SHA-256 when API digests are missing, validate upload responses, and report the dry-run Latest by tag. Refs #7.
@vmvarela
vmvarela merged commit bbe03ae into master Oct 24, 2026
9 checks passed
@vmvarela
vmvarela deleted the fix/release-asset-integrity branch October 24, 2026 07:13
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.

Avoid unnecessary uploads for unchanged release assets without API digests

1 participant