Skip to content

Avoid unnecessary uploads for unchanged release assets without API digests #7

Closed

Description

@vmvarela

Problem

sameAsset deliberately refuses to infer equality from file size. When either API digest is absent, an unchanged asset is uploaded again on every run.

Acceptance criteria

  • Use a trustworthy content comparison, such as streaming SHA-256 of both assets, without loading complete binaries into memory.
  • Keep the fast path when both API digests are present.
  • Never treat equal sizes, names or timestamps as proof of equal content.
  • Bound network operations and preserve read-only dry-run behavior.
  • Cover same-size/different-content, missing digest on either side, read failure and interrupted verification.
  • Document the extra download cost and ensure repeated runs preserve asset IDs when bytes match.

Deferred from #3; no persistent cache or state branch is required by this issue.

Additional scope for v0.1.0

  • Validate the upload response: size must match the local file, SHA-256 is compared when the API returns one, malformed responses fail, and non-2xx bodies are included up to 4 KiB.
  • Report a dry-run Latest by tag instead of a synthetic /releases/0 URL.
  • Ignore local build outputs /gh-replicate and /gh-replicate.exe.

The SHA-256 computed for the source is reused for the upload check, so this adds no extra download.

Activity

  1. added
    enhancement
    on Oct 24, 2026
  2. vmvarela commented on Oct 24, 2026

    @vmvarela
    OwnerAuthor

    Implementation plan for v0.1.0:

    1. Compute the source SHA-256 after download and validate it against the declared digest.
    2. Keep the fast path when both API digests exist. Otherwise replace only when sizes differ, or when an equal-sized destination download hashes differently. Any download or verification error aborts before DELETE.
    3. Decode the upload response and reject size/digest mismatches; include a bounded error body.
    4. Add unit tests for equal content without digests, same-size different content, truncated destination, upload metadata failures, and dry-run output.
    5. Update the README limits and add the build output ignore rules.

    Validation: go test ./..., go vet ./..., go build ./..., gofmt -l ., plus CI on the PR.

  3. vmvarela commented on Oct 24, 2026

    @vmvarela
    OwnerAuthor

    Implemented in #9 at 582dbaa. All nine CI checks pass. Merge and publication remain gated on explicit approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions