Skip to content

Conversation

@sinspired
Copy link

@sinspired sinspired commented Oct 8, 2025

  1. 8b2d5ad Supports direct download assets through GitHub Proxy
  2. 496a584 Add support for 386 architecture

Summary by CodeRabbit

  • New Features

    • Expanded architecture support: 32-bit Intel (“386”) now also recognizes “i386”, “x86”, and “x86_32”.
  • Bug Fixes

    • Improved reliability when downloading release assets that contain direct HTTPS links, with clearer errors when no valid direct URL is available.
  • Tests

    • Added test coverage for the new 32-bit Intel architecture aliases, including universal-target scenarios.
  • Documentation

    • Updated repository/module references and README badges to the new project namespace.

@coderabbitai
Copy link

coderabbitai bot commented Oct 8, 2025

Walkthrough

Adds "386" architecture aliases ("i386", "x86", "x86_32") to arch expansion and related tests. Adds a bypass in GitHub asset download to directly GET asset URLs that contain multiple "https://" prefixes; otherwise retains the GitHub API path. Updates module/import paths and documentation references to github.com/sinspired/....

Changes

Cohort / File(s) Summary of edits
Arch alias expansion
arch.go, arch_test.go
Add handling for arch == "386" to append aliases "i386", "x86", "x86_32" to additionalArch; extend tests to cover default and universalArch == "all" scenarios.
GitHub asset download bypass
github_source.go
Add conditional bypass when AssetURL contains multiple https://: select direct URL (AssetID or ValidationAssetID), perform direct HTTP GET with request/response status checks, return body or errors (including ErrAssetNotFound if no URL). Retain existing API-based path otherwise.
Module & import path updates
go.mod, cmd/..., update/..., internal/..., path.go, updater.go, source.go, update_test.go, internal/path_test.go
Change module declaration and all relevant imports from github.com/creativeprojects/go-selfupdategithub.com/sinspired/go-selfupdate; adjust related CLI/go-get examples and tests to new repo path. No API signature changes.
Docs and READMEs
README.md, cmd/detect-latest-release/README.md, cmd/get-release/README.md, doc.go
Update badge links, example links, and documentation references to use github.com/sinspired/... paths and adjusted go-get commands.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant GS as GitHubSource.DownloadReleaseAsset
  participant GH as GitHub Releases API
  participant HTTP as Direct HTTP Server

  Caller->>GS: DownloadReleaseAsset(params)
  alt AssetURL contains multiple "https://"
    note right of GS #EEE8D5: Bypass GitHub API (new path)
    GS->>GS: Pick direct download URL (AssetID or ValidationAssetID)
    alt URL found
      GS->>HTTP: HTTP GET download URL
      HTTP-->>GS: Response (status/body)
      alt Status 200 OK
        note right of GS #D6EAF8: Return response body (caller closes)
        GS-->>Caller: io.ReadCloser (body)
      else Non-OK status
        GS-->>Caller: error (status)
      end
    else No suitable URL
      GS-->>Caller: ErrAssetNotFound
    end
  else Normal path
    note right of GS #F3E6FF: Use GitHub Releases API (existing path)
    GS->>GH: Request asset download via API
    GH-->>GS: Asset stream / redirect handled
    GS-->>Caller: io.ReadCloser (body)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A rabbit taps its paw with glee,
386 hops join i386, x86, x86_32 with me.
When links get doubled, we fetch the stream,
Tests nod approval, module names gleam.
Nibble bytes, ship on—hooray for the team! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately reflects the two primary changes introduced by the pull request, namely adding direct download support through the GitHub proxy and enabling 386 architecture support. It is concise, written as a single sentence, and directly tied to the actual modifications. A teammate reviewing history will understand the key additions without ambiguity. Therefore, it meets the criteria for clarity and relevance.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 496a584 and e418e29.

📒 Files selected for processing (16)
  • README.md (1 hunks)
  • cmd/detect-latest-release/README.md (2 hunks)
  • cmd/detect-latest-release/main.go (1 hunks)
  • cmd/detect-latest-release/update.go (1 hunks)
  • cmd/get-release/README.md (1 hunks)
  • cmd/get-release/main.go (1 hunks)
  • cmd/source.go (1 hunks)
  • doc.go (1 hunks)
  • go.mod (1 hunks)
  • internal/path_test.go (1 hunks)
  • path.go (1 hunks)
  • update.go (1 hunks)
  • update/apply.go (1 hunks)
  • update/doc.go (3 hunks)
  • update_test.go (1 hunks)
  • updater.go (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • doc.go
  • README.md
  • update/apply.go
  • path.go
🧰 Additional context used
🧬 Code graph analysis (1)
update_test.go (1)
package.go (1)
  • UpdateTo (27-36)
🪛 markdownlint-cli2 (0.18.1)
cmd/get-release/README.md

6-6: Dollar signs used before commands without showing output

(MD014, commands-show-output)

🔇 Additional comments (12)
cmd/get-release/README.md (1)

6-6: LGTM!

The installation path has been correctly updated to reflect the new module location.

cmd/get-release/main.go (1)

16-17: LGTM!

The import paths have been correctly updated to match the new module location.

internal/path_test.go (1)

6-6: LGTM!

The import path has been correctly updated to reflect the new module location.

update/doc.go (1)

12-12: LGTM!

The documentation examples have been correctly updated to reference the new module path across all three occurrences (lines 12, 52, and 88).

go.mod (1)

1-1: LGTM!

The module path has been correctly updated. This change is the foundation for all the import path updates across the codebase.

update_test.go (1)

193-193: LGTM!

The test URL has been correctly updated to maintain consistency with the new module namespace. The test continues to validate error handling for non-existing repositories.

cmd/source.go (1)

8-8: LGTM!

The import path has been correctly updated to reflect the new module location.

cmd/detect-latest-release/README.md (1)

1-1: LGTM!

The documentation has been correctly updated to reference the new module path across all occurrences (lines 1, 6, and 15), including the pkg.go.dev link, installation command, and example repository reference.

cmd/detect-latest-release/update.go (1)

9-9: LGTM: Import path updated consistently.

The import path has been correctly updated to reflect the new module path.

cmd/detect-latest-release/main.go (1)

10-11: LGTM: Import paths updated consistently.

Both the main package and cmd subpackage imports have been correctly updated to the new module path.

updater.go (1)

8-8: LGTM: Internal package import updated correctly.

The internal package import path has been correctly updated to match the new module path.

update.go (1)

13-14: Old module paths fully replaced. Verified no remaining references to "github.com/creativeprojects/go-selfupdate" in code, go.mod/go.sum, or documentation.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
github_source.go (2)

114-122: Minor formatting: Add spaces after colons in error messages.

For consistency with error formatting conventions, add spaces after colons.

 		req, err := http.NewRequestWithContext(ctx, http.MethodGet, downloadUrl, http.NoBody)
 		if err != nil {
-			return nil, fmt.Errorf("failed to create download request:%w", err)
+			return nil, fmt.Errorf("failed to create download request: %w", err)
 		}

 		resp, err := http.DefaultClient.Do(req)
 		if err != nil {
-			return nil, fmt.Errorf("download failed:%w", err)
+			return nil, fmt.Errorf("download failed: %w", err)
 		}

97-102: Fix comment threshold mismatch and improve proxy detection heuristic.

  • Update the comment to match the code’s > 1 check:
    - // If the AssetURL contains more than 2 "https://", it means it's using a GitHub Proxy service.
    + // If the AssetURL contains more than one "https://", it means it's using a GitHub Proxy service.
  • Replace the substring count with a stricter URL check (e.g. parse and validate the host or path) to avoid false positives.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7d55b9 and 496a584.

📒 Files selected for processing (3)
  • arch.go (1 hunks)
  • arch_test.go (1 hunks)
  • github_source.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
github_source.go (1)
errors.go (1)
  • ErrAssetNotFound (13-13)
🔇 Additional comments (2)
arch_test.go (1)

26-27: LGTM!

The test cases correctly validate the new 386 architecture support with proper aliases ("i386", "x86", "x86_32") and universal architecture handling.

arch.go (1)

30-32: LGTM!

The 386 architecture handling follows the established pattern and includes appropriate aliases commonly used for 32-bit x86 binaries.

@sinspired
Copy link
Author

I need it in my project.

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 22.58065% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.92%. Comparing base (d7d55b9) to head (e418e29).

Files with missing lines Patch % Lines
github_source.go 14.29% 23 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
- Coverage   77.07%   75.92%   -1.15%     
==========================================
  Files          28       28              
  Lines        1435     1466      +31     
==========================================
+ Hits         1106     1113       +7     
- Misses        279      302      +23     
- Partials       50       51       +1     
Flag Coverage Δ
unittests 75.92% <22.58%> (-1.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant