Skip to content

Avatar url#8

Merged
PranavU-Coder merged 5 commits into
masterfrom
avatar-url
Jun 5, 2026
Merged

Avatar url#8
PranavU-Coder merged 5 commits into
masterfrom
avatar-url

Conversation

@PranavU-Coder

@PranavU-Coder PranavU-Coder commented May 22, 2026

Copy link
Copy Markdown
Owner

Please describe the changes this PR makes and why it should be merged:

Status and versioning classification:

  • Code changes have been tested locally
  • Typings don't need updating

Summary by CodeRabbit

  • Bug Fixes

    • Fixed avatar caching so avatars refresh reliably when local cache expires.
  • Chores

    • Application version bumped to 1.0.5 and published to AUR, Homebrew, and Scoop manifests.
    • Updated bundled vendored Python dependencies to newer versions for improved security and compatibility.

@PranavU-Coder PranavU-Coder self-assigned this May 22, 2026
@PranavU-Coder PranavU-Coder added the enhancement New feature or request label May 22, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in hubFetching May 22, 2026
@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@PranavU-Coder, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 47 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2c7786a7-132d-40c9-b8ca-2a3ac989959c

📥 Commits

Reviewing files that changed from the base of the PR and between 07c1b39 and d883db0.

📒 Files selected for processing (1)
  • .github/workflows/build.yml
📝 Walkthrough

Walkthrough

Bumps the project to v1.0.5, adds a manual release trigger and release SHA/tag extraction in GitHub Actions with a Scoop updater job, refreshes AUR/Homebrew/Scoop manifests and bundled resources, and simplifies avatar cache refresh to re-download when stale without URL-change checks.

Changes

Version 1.0.5 Release and Package Manager Updates

Layer / File(s) Summary
Core version declaration
pyproject.toml
Project version updated from 1.0.3 to 1.0.5.
GitHub Actions release workflow and Scoop updater
.github/workflows/build.yml
Adds workflow_dispatch with version input, replaces build step labels with uv sync/uv run pyinstaller, computes release tag and SHA256 from downloaded artifact, publishes release, and adds update-scoop job that patches and pushes bucket/hubfetch.json.
Package manager manifests
contrib/aur/PKGBUILD, contrib/homebrew/homebrew.rb, contrib/scoop/hubfetch.json
AUR pkgver and sha256sums updated; Homebrew formula bumped to 1.0.5 and several bundled Python resources refreshed; Scoop manifest reworked for v1.0.5 with updated URL/hash and metadata shape changes.

Avatar Cache Refresh Simplification

Layer / File(s) Summary
Avatar cache refresh behavior
hubfetch/cache.py
ensure_avatar no longer reads cached avatar_url; returns on fresh avatar_last_checked, otherwise attempts unconditional _download_avatar, updates meta.json only on successful download, and returns the on-disk avatar only if present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped a patch from three to five,
Brought manifests and workflow back alive,
When avatars grow old and gray,
I fetch anew — no URL delay.
Cheers from a rabbit, nimble and spry!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Avatar url' is vague and does not clearly convey the main changes, which include version bumps (1.0.3 → 1.0.5), workflow updates, dependency refreshes, and avatar caching logic modifications. Consider a more descriptive title that better summarizes the primary change, such as 'Release v1.0.5 with avatar caching improvements' or 'Bump to v1.0.5 and refactor avatar URL handling'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch avatar-url

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
hubfetch/cache.py (1)

66-66: ⚡ Quick win

Replace the inline profane comment with neutral rationale.

Line 66 uses profanity; please swap it for a short professional note describing why unconditional refresh is intentional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hubfetch/cache.py` at line 66, Replace the profane inline comment "turns out
GitHub avatar urls don't change so fuck this shit honestly" in hubfetch/cache.py
with a short, neutral rationale explaining that GitHub avatar URLs are stable so
an unconditional refresh is intentional (e.g., "GitHub avatar URLs are stable;
skip conditional refresh to simplify caching"). Update the comment near the
existing avatar/cache logic to briefly state the reason for the unconditional
refresh and maintain professional tone.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build.yml:
- Around line 7-12: The workflow defines workflow_dispatch.inputs.version but
the release step (softprops/action-gh-release@v2) doesn't use it, so the action
falls back to github.ref_name; update the release step to pass the user-provided
input as the tag by setting the action input tag_name to the dispatch input (use
github.event.inputs.version), e.g. add tag_name: ${{ github.event.inputs.version
}} (and optionally use the same input for name/release_name) so the created
release uses the chosen version.

In `@contrib/scoop/hubfetch.json`:
- Line 8: The Scoop manifest contains an empty "hash" field which disables
integrity validation; compute the correct SHA256 of the distributed hubfetch.exe
(the released binary referenced by the manifest) and replace the empty string in
the "hash" JSON property with that hex SHA256 value so the manifest's "hash"
entry contains the correct checksum for hubfetch.exe.

In `@hubfetch/cache.py`:
- Around line 67-70: The code updates cache metadata (meta.update and _save_json
with META_FILE) immediately after calling _download_avatar(current_avatar_url,
dest), which means a failed download still marks avatar_last_checked and
suppresses retries; change this so the metadata is only updated when
_download_avatar succeeds: wrap the download call to detect success (either by
its return value or by catching exceptions from _download_avatar), log or handle
the failure without touching meta, and only perform meta.update({"avatar_url":
current_avatar_url, "avatar_last_checked": now}) and _save_json(META_FILE, meta)
when the download completed successfully (referencing _download_avatar,
meta.update, _save_json, META_FILE, avatar_last_checked, current_avatar_url).

---

Nitpick comments:
In `@hubfetch/cache.py`:
- Line 66: Replace the profane inline comment "turns out GitHub avatar urls
don't change so fuck this shit honestly" in hubfetch/cache.py with a short,
neutral rationale explaining that GitHub avatar URLs are stable so an
unconditional refresh is intentional (e.g., "GitHub avatar URLs are stable; skip
conditional refresh to simplify caching"). Update the comment near the existing
avatar/cache logic to briefly state the reason for the unconditional refresh and
maintain professional tone.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ec8396da-cb32-41cd-9d7a-90354103e2e6

📥 Commits

Reviewing files that changed from the base of the PR and between 4152869 and f824a51.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • .github/workflows/build.yml
  • contrib/aur/PKGBUILD
  • contrib/homebrew/homebrew.rb
  • contrib/scoop/hubfetch.json
  • hubfetch/cache.py
  • pyproject.toml

Comment thread .github/workflows/build.yml Outdated
Comment thread contrib/scoop/hubfetch.json Outdated
Comment thread hubfetch/cache.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
.github/workflows/build.yml (1)

58-81: ⚡ Quick win

Consider adding error handling and validation to the Scoop update job.

The update-scoop job runs unconditionally after the release job succeeds, but it doesn't validate that:

  1. The jq patch succeeded
  2. The modified JSON is valid
  3. There are actual changes to commit (git commit will fail if nothing changed)
♻️ Proposed improvements
       - name: Patch hubfetch.json
         run: |
           TAG="${{ needs.release.outputs.tag }}"
           jq --arg ver "${TAG#v}" \
              --arg url "https://github.com/PranavU-Coder/hubfetch/releases/download/${TAG}/hubfetch.exe" \
              --arg sha "${{ needs.release.outputs.sha256 }}" \
              '.version=$ver | .architecture."64bit".url=$url | .architecture."64bit".hash=$sha' \
              bucket/hubfetch.json > tmp.json && mv tmp.json bucket/hubfetch.json
+          # Validate the patched JSON
+          jq empty bucket/hubfetch.json

       - run: |
           git config user.name "github-actions[bot]"
           git config user.email "github-actions[bot]`@users.noreply.github.com`"
           git add bucket/hubfetch.json
-          git commit -m "update hubfetch to ${{ needs.release.outputs.tag }}"
+          # Only commit if there are changes
+          git diff --staged --quiet || git commit -m "update hubfetch to ${{ needs.release.outputs.tag }}"
           git push
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build.yml around lines 58 - 81, The update-scoop job's
Patch hubfetch.json step should add explicit error handling and validation:
ensure the jq patch command (invoked in the "Patch hubfetch.json" step) exits
successfully and aborts the job if it fails, validate the resulting JSON (e.g.,
run jq . on the produced bucket/hubfetch.json to confirm it's well-formed) and
only attempt git add/commit/push if there are actual changes (check with git
diff --quiet or git status to skip the commit when nothing changed); modify the
commands around the jq invocation and the git commit block to perform these
checks and bail out with a clear error if validation fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build.yml:
- Line 50: Check for the existence of the Windows artifact before computing its
hash: wrap the sha256sum invocation for "artifacts/hubfetch.exe" in a
conditional that tests the file (e.g., using a POSIX test like [ -f
"artifacts/hubfetch.exe" ]) and only run the echo "sha256=..." >>
"$GITHUB_OUTPUT" when the file exists; if missing, either skip writing the
output or write a safe fallback value so the workflow step does not fail. Target
the step that currently runs echo "sha256=$(sha256sum artifacts/hubfetch.exe |
awk '{print $1}')" and add the existence check around that command.
- Around line 47-49: The TAG selection currently favors github.ref_name and
unquotes template expansions, causing wrong tags for manual dispatch and a
template-injection risk; change logic to prefer the workflow_dispatch input when
present (set TAG to github.event.inputs.version if non-empty, otherwise to
github.ref_name) and always quote the expanded expressions to avoid injection
(use quoted expansions for TAG and when writing to GITHUB_OUTPUT), referencing
the TAG variable, github.event.inputs.version, github.ref_name and GITHUB_OUTPUT
from the diff.
- Around line 69-74: The job is injecting GitHub expression values into the
shell unquoted; assign them to quoted shell variables (e.g. TAG and SHA) using
TAG="${{ needs.release.outputs.tag }}" and SHA="${{ needs.release.outputs.sha256
}}", then reference the variables in the jq call with quoted expansions (e.g.
--arg ver "${TAG#v}" --arg url "https://.../${TAG}/hubfetch.exe" --arg sha
"${SHA}"), so all template expansions are protected from shell word-splitting
and injection.
- Line 80: The commit command embeds the output directly which can lead to
template/argument injection; update the git commit invocation (the line
containing git commit -m "update hubfetch to ${{ needs.release.outputs.tag }}")
to safely quote and terminate options, e.g. include the tag inside single quotes
within the message and add -- to end options: git commit -m "update hubfetch to
'${{ needs.release.outputs.tag }}'" -- so the tag is treated as data, not
shell/cli input.

---

Nitpick comments:
In @.github/workflows/build.yml:
- Around line 58-81: The update-scoop job's Patch hubfetch.json step should add
explicit error handling and validation: ensure the jq patch command (invoked in
the "Patch hubfetch.json" step) exits successfully and aborts the job if it
fails, validate the resulting JSON (e.g., run jq . on the produced
bucket/hubfetch.json to confirm it's well-formed) and only attempt git
add/commit/push if there are actual changes (check with git diff --quiet or git
status to skip the commit when nothing changed); modify the commands around the
jq invocation and the git commit block to perform these checks and bail out with
a clear error if validation fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ded8b28-5c3f-419a-90d6-4db1b815e409

📥 Commits

Reviewing files that changed from the base of the PR and between f824a51 and 07c1b39.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • .github/workflows/build.yml
  • contrib/aur/PKGBUILD
  • contrib/homebrew/homebrew.rb
  • contrib/scoop/hubfetch.json
  • hubfetch/cache.py
  • pyproject.toml
✅ Files skipped from review due to trivial changes (1)
  • pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (1)
  • hubfetch/cache.py

Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml Outdated
@PranavU-Coder

Copy link
Copy Markdown
Owner Author

I don't have the patience to deal with these bullshit rate limits, go fuck yourself @coderabbitai

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@PranavU-Coder I'm genuinely sorry for the frustration — rate limit interruptions during a review are really disruptive, and I completely understand why that's aggravating. No hard feelings on my end.

If there's anything I can help with on this PR — the avatar URL caching changes, the workflow updates, or anything else — just let me know when you're ready. I'm here to help. 🐇

(´• ω •`) ♡

@PranavU-Coder
PranavU-Coder merged commit 997e3b3 into master Jun 5, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in hubFetching Jun 5, 2026
@PranavU-Coder
PranavU-Coder deleted the avatar-url branch June 5, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant