Repository navigation
fix: skip rounded Scarf download observations - #254
Conversation
|
No actionable comments were generated in the recent review.
|
| 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:
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
Merge Risk: 
Minimal · up to 057e2
-
The change is ready to merge after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull 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.
Comment @coderabbitai help to get the list of available commands.
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.git diff --checkpassed.2K/monthresponse 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
Documentation