Skip to content

test(download): cover release URL, status error redaction, private fallthrough - #1694

Merged
skevetter merged 2 commits into
mainfrom
maintenance/test-coverage-cycle-2026-10-25
Oct 25, 2026
Merged

skevetter merged 2 commits into
mainfrom
maintenance/test-coverage-cycle-2026-10-25

Conversation

@skevetter

@skevetter skevetter commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds pkg/download/download_fetch_test.go (183 lines, test-only, 1 file). Table tests for:

  • releaseURL (latest and tagged release).
  • HTTPStatusError.Error (with body, without body, userinfo redacted).
  • File error path against an httptest server: 403 response, credentials must not appear in the error.
  • fetchGithubPrivateRelease fall-through: 200 skips the resolver, non-GitHub path skips it, resolver error and empty credential fall through.

Why

pkg/download was 15.3% covered. Userinfo in download URLs must not reach error text, since errors are logged. Mutation check: removing sanitizeURL from HTTPStatusError.Error turns both redaction tests red; reverted afterwards.

Found bug (not fixed here)

releaseURL double-escapes tags containing /. release/1.0 yields .../releases/tags/release%252F1.0: url.PathEscape produces %2F, then url.URL.String() escapes the %. The slash case is left out of this PR because it is test-only and would be red. Needs a product fix in pkg/download/download.go.

Validation

  • go test -race -count=3 ./pkg/download/...: ok.
  • mise run cli:format: clean. mise run cli:lint:ci: 0 issues.
  • mise run cli:test (go run ./hack/ci unit): fails in hack/sign_commit (temp repo commit exits 128 under global commit.gpgsign=true), pkg/agent/delivery and pkg/driver/microsandbox (cancellation timing). None import pkg/download. Not re-run on main.

CodeRabbit CLI

coderabbit review --agent --fresh --committed: completed, 0 findings, 1 file reviewed.

Auto-merge

Not enabled. Draft only; not for merge until reviewed.

Next

Fix releaseURL tag escaping, then add the slash-tag case. HTTP paths in githubAPIGetJSON, fetchGithubReleaseAssetID, and downloadGithubAsset stay untested: they call the shared client and hardcode api.github.com, so a seam is needed.

Summary by CodeRabbit

  • Tests
    • Expanded coverage for GitHub release downloads, including release URL handling, HTTP error messages, credential privacy, and fallback behavior for private releases.

@skevetter skevetter added the test-coverage Unit test coverage (maintenance bot) label Oct 25, 2026
@netlify

netlify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 8dba003
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6adda5c1eba0b597dade79dc

@netlify

netlify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 8dba003
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6adda5c1a99d20b6b4924042

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63275917-2b97-4cfa-afd0-1eb6007570b5
Commits

Reviewing files that changed from the base of the PR and between b447f4c and 8dba003.

Files selected for processing: 1
  • pkg/download/download_fetch_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The change adds tests for GitHub release URL construction, HTTP status errors, credential redaction, and private-release fetch fallthrough.

Changes: Download Fetch Tests

Layer / File(s) Summary
Release URLs and HTTP errors
pkg/download/download_fetch_test.go
Tests cover latest and tagged release URLs, status error messages with and without response bodies, and credential redaction in errors returned by File.
Private-release fetch fallthrough
pkg/download/download_fetch_test.go
Tests verify that public assets and non-release paths skip credential resolution, while resolver errors and empty credentials call the resolver once.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: Minimal · up to 8dba0

No merge-blocking issue is established by this review; the change is ready for normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is concise, follows Conventional Commits format, and accurately summarizes the added download tests for release URLs, status-error redaction, and private-release fall-through.
Description check Passed The description clearly explains the test coverage, motivation, known unfixed bug, validation results, and remaining coverage gaps. It does not include the template's explicit type-of-change, AI-assis…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the test coverage, motivation, known unfixed bug, validation results, and remaining coverage gaps. It does not include the template's explicit type-of-change, AI-assistance, checklist, or issue-reference sections, but the main required change and verification details are present.

Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@skevetter
skevetter marked this pull request as ready for review October 25, 2026 08:16
@skevetter

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@mergify

mergify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@skevetter
skevetter merged commit f006fb6 into main Oct 25, 2026
114 checks passed
@skevetter
skevetter deleted the maintenance/test-coverage-cycle-2026-10-25 branch October 25, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l test-coverage Unit test coverage (maintenance bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant