You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add the half-year activity scale to the API - #1658
#1657 (merged) added a half-year activity scale (half, 26 weeks) for web profiles 30 days to 6 months old, and kept it out of the API. This PR adds half to the API.
This PR stays a draft until the app and TUI developers confirm they handle half.
Important
For app and TUI developers:GET /api/v1/users/{handle} can return "scale": "half" when the earliest commit the viewer can see (or the signup date, if there's none) is more than 30 days and up to 26 weeks old. Its buckets are daily, from a Sunday through today: 26 week columns, 176–182 buckets depending on the weekday. Drawing it like year works. All other ages are unchanged.
For a profile whose first visible commit is about 2 months old:
The API test now expects half, with 180 buckets starting on Sunday 2026-04-19, for a profile whose first visible commit is two months old.
KNOWLEDGE_BASE.md: the signed API section now says a profile's activity graph covers the same range as the web (24 hours, 7 days, 30 days, 6 months, or a year).
Full composer test:unit, test:lint, test:types and test:type-coverage before the rebase: all passed. Pest 6515/6515 with 100% line coverage, Node unit tests 331/331, and 100% type coverage.
Hosted CI: waiting for a maintainer to approve workflows
Independent review (read-only, by someone other than the implementer) of the API change: Code: PASS, no blockers. Visual: N/A, because no frontend or web files changed. Non-blocking note: $scales is now only passed by a unit test, and it's kept deliberately.
Limitations: apps and TUIs that don't handle half may fail to draw the graph for profiles 30 days to 6 months old, hence the draft status for this PR.
I will check with the app and TUI developers that they know about this before taking the PR out of draft, because most of the apps I've seen would handle this badly right now. The checklist above shows which apps have been fixed.
Draft PRs are not automatically reviewed by default.
Trigger a manual review
To automatically review draft PRs, update your CodeRabbit configuration:
reviews:
auto_review:
drafts: true
No actionable comments were generated in the recent review.
Walkthrough
Activity scale selection now includes a half-year window. The API can return that scale for activity within its range. The frontend renders half-year activity as a week grid, with updated summaries and month labels.
Changes: Half-year activity scale
Layer / File(s)
Summary
Half-year scale selection and API behavior app/Enums/ActivityScale.php, app/Queries/UserActivityQuery.php, app/Http/Requests/ShowSiteActivityRequest.php, tests/Feature/Controllers/Api/UserControllerTest.php, tests/Feature/Controllers/SiteActivityControllerTest.php, tests/Unit/Queries/UserActivityQueryTest.php
The scale and query support half-year windows and configurable candidate scales. The site request still accepts only Day, Week, Month, or Year. Tests cover scale selection, returned activity buckets, and request validation.
dev-null-sh/dev-null.sh#1657: Adds the half-year grid on web profiles; this PR adds API support for the same scale.
Suggested reviewers:xheaven, jubianchi
Merge Risk: Low · previous review e1a8b
The API now returns a new "half" activity scale for profiles between 30 days and 6 months old. Any app or TUI client that does not recognise it may fail to draw the activity graph for those profiles. Confirm client support before merging; the web profile is already handled.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat: add the half-year activity scale to the API" matches the main change. The diff adds the Half case to ActivityScale, extends the query and the API profile response so profiles 30 days …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check
Explanation
The title "feat: add the half-year activity scale to the API" matches the main change. The diff adds the Half case to ActivityScale, extends the query and the API profile response so profiles 30 days to 26 weeks old return the half scale, and adds the matching tests. The title names the feature and the surface it touches, so it describes the primary change without listing files.
Finishing Touches
Generate unit tests (beta)
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.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#1657 (merged) added a half-year activity scale (
half, 26 weeks) for web profiles 30 days to 6 months old, and kept it out of the API. This PR addshalfto the API.This PR stays a draft until the app and TUI developers confirm they handle
half.Important
For app and TUI developers:
GET /api/v1/users/{handle}can return"scale": "half"when the earliest commit the viewer can see (or the signup date, if there's none) is more than 30 days and up to 26 weeks old. Its buckets are daily, from a Sunday through today: 26 week columns, 176–182 buckets depending on the weekday. Drawing it likeyearworks. All other ages are unchanged.For a profile whose first visible commit is about 2 months old:
"activity": { - "scale": "year", // 371 daily buckets, 2025-11-16 → 2026-11-21 + "scale": "half", // 182 daily buckets, 2026-05-24 → 2026-11-21 "buckets": [{ "date": "2026-05-24", "count": 0 }, …] }Apps & TUI compatibility checklist
The goal is to make sure apps don't crash or show unexpected output when the API starts returning the new
halfscale.Changes
Api\UserController@showdrops thescales:argument feat: show a half-year activity grid on profiles under six months old #1657 added, so the API picks from the same scales as the web profile (ActivityScale::FITTING).half, with 180 buckets starting on Sunday 2026-04-19, for a profile whose first visible commit is two months old.KNOWLEDGE_BASE.md: the signed API section now says a profile's activity graph covers the same range as the web (24 hours, 7 days, 30 days, 6 months, or a year).Validation
productionwith feat: show a half-year activity grid on profiles under six months old #1657 merged:tests/Feature/Controllers/Api/UserControllerTest.phpandtests/Unit/Queries/UserActivityQueryTest.php, 45/45 passed. PHPStan: no errors.composer test:unit,test:lint,test:typesandtest:type-coveragebefore the rebase: all passed. Pest 6515/6515 with 100% line coverage, Node unit tests 331/331, and 100% type coverage.$scalesis now only passed by a unit test, and it's kept deliberately.halfmay fail to draw the graph for profiles 30 days to 6 months old, hence the draft status for this PR.I will check with the app and TUI developers that they know about this before taking the PR out of draft, because most of the apps I've seen would handle this badly right now. The checklist above shows which apps have been fixed.