Skip to content

fix: skip rounded Scarf download observations - #254

Merged
easyhooon merged 1 commit into
mainfrom
fix/scarf-rounded-downloads
Oct 28, 2026
Merged

easyhooon merged 1 commit into
mainfrom
fix/scarf-rounded-downloads

Conversation

@easyhooon

@easyhooon easyhooon commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

When Scarf returns 2K/month, skip the observation without converting it to an exact count. Preserve the existing CSV and SVG byte-for-byte and report the unavailable exact count in Actions and Discord. Exact integer responses still update the series; malformed responses and network/HTTP errors still fail.

Pass the sampling status to Discord so a same-day retry cannot present an earlier observation as a successful new sample. Document the source review: public package endpoints returned 401, the legacy badge URL redirected to the homepage, and authenticated exports require separate access and scope/window validation.

Validation

  • python3 scripts/test-update-downloads.py: 11 tests passed.
  • python3 scripts/test-notify-discord.py: 5 tests passed.
  • SVG XML parsing and git diff --check passed.
  • Verified the data branch's 7 exact observations reproduce its SVG.
  • Ran the sampler against the live 2K/month response using copies of production files: exit 0, status=rounded, and identical CSV/SVG SHA-256 hashes.

Addresses the failure in workflow run https://github.com/easyhooon/dari/actions/runs/40451756299. No historical observations are changed.

Summary by CodeRabbit

  • Bug Fixes

    • Download history and charts are no longer updated with approximate counts from shortened badge values. A warning explains when an exact count is unavailable.
    • Discord summaries distinguish between unavailable counts and failed samples, avoiding stale same-day counts while continuing to report repository stars and installer statistics.
  • Documentation

    • Added guidance on download count reporting, badge limitations, and how same-day retries handle earlier exact samples.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 265cf09 and 057e24e.

Files selected for processing: 6
  • .github/workflows/downloads.yml
  • scripts/README-downloads.md
  • scripts/notify-discord.py
  • scripts/test-notify-discord.py
  • scripts/test-update-downloads.py
  • scripts/update-downloads.py

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

Walkthrough

The download updater now distinguishes exact badge counts from rounded values, preserves CSV and SVG history when counts are rounded, and emits sampling status. The workflow passes that status to Discord reporting, which marks rounded counts unavailable and failed samples explicitly while retaining repository statistics.

Changes: Download sampling and reporting

Layer / File(s) Summary
Classify badge values and record sample outcomes
scripts/update-downloads.py, scripts/test-update-downloads.py, scripts/README-downloads.md
The updater distinguishes rounded badge values from malformed responses. Rounded values skip CSV and SVG writes, while exact nonnegative integer counts are recorded. The updater writes status and an outcome message to workflow outputs when those environment variables are set. Tests cover rounded values, exact counts, malformed responses, network and HTTP errors, and workflow outputs. The README describes the sampling behavior and source constraints.
Pass sample status to Discord reporting
scripts/notify-discord.py, .github/workflows/downloads.yml, scripts/test-notify-discord.py, scripts/README-downloads.md
The workflow passes the Scarf status to the notification command, using failed when the status is unavailable. The notification reports rounded counts as unavailable and failed samples explicitly. Tests cover same-day samples and retained repository statistics. The README documents the status and retry behavior.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Scarf
  participant Updater as update-downloads
  participant Workflow as GitHub Actions workflow
  participant Notifier as notify-discord
  participant Discord
  Updater->>Scarf: Request badge redirect
  Scarf-->>Updater: Return exact or rounded badge value
  Updater-->>Workflow: Write observed or rounded status
  Workflow->>Notifier: Pass Scarf status
  Notifier->>Discord: Post status-specific sample summary
Loading
Merge Risk: Minimal · up to 057e2

The change is ready to merge after 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 with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: skipping rounded Scarf download observations.
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: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 12 functions across 4 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • 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.

@easyhooon
easyhooon merged commit 69cc72e into main Oct 28, 2026
5 checks passed
@easyhooon
easyhooon deleted the fix/scarf-rounded-downloads branch October 28, 2026 07:50
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