krz/hutch-stats

Server-side utility for calculating contributions for sourcehut users. contributions server sourcehut stats

Commit 911804f719

911804f7192aa0ffade946c342696764e4d30ad7

parent: 90e61ed3e8

Verified · cmc

cmc <hello@cleberg.net> · 2026-04-12 00:41 UTC

chore: update docs

Layout: unified · split

API.md +4 −5
@@ -44,8 +44,8 @@ Contribution ranges:
4444
4545- Contribution read endpoints return zero-filled days, so clients do not need to patch missing dates.
4646- Public contribution reads also register the actor for background indexing. A first lookup may therefore return an empty graph while the scheduler catches up.
47- Incremental indexing and historical backfill are separate. An actor can be recently indexed without being fully backfilled yet.
48- The service prioritizes a recent visible history window first, then continues deep-history backfill afterward.
47- Incremental indexing and one-year backfill are separate. An actor can be recently indexed before the retained one-year window is fully filled in.
48- The service only retains and backfills the most recent 365 days of activity.
4949
5050Background polling:
5151
@@ -112,8 +112,7 @@ Behavior notes:
112112- This endpoint resolves aliases to a canonical actor before querying data.
113113- This endpoint also registers the actor for background indexing and updates the actor's `last_requested_at` timestamp.
114114- The response is always immediate; it does not wait for SourceHut polling to finish.
115- Historical backfill runs in bounded background batches and may take multiple scheduler passes to complete.
116- The recent visible window is prioritized before full-history backfill so clients can show a useful graph sooner.
115- One-year backfill runs in bounded background batches and may take multiple scheduler passes to complete.
117116
118117Example by year:
119118
@@ -305,7 +304,7 @@ Response fields:
305304Behavior notes:
306305
307306- Manual polling also updates the actor's indexing metadata.
308- Manual polling also advances historical backfill by one bounded batch per supported service.
307- Manual polling also advances one-year backfill by bounded batches for each supported service.
309308- Git polling auto-discovers the actor's owned repositories and unions in any configured tracked repositories.
310309
311310Possible errors:
README.md +2 −2
@@ -14,7 +14,7 @@ The current V1 is intentionally narrow and production-oriented:
1414
1515## What It Does
1616
17The service collects SourceHut activity from one or more sr.ht GraphQL services, turns those records into a canonical event shape, aggregates activity by day, and returns zero-filled calendar ranges so the client never has to patch missing dates. It performs recent incremental polling, prioritizes a recent visible-history window for faster UX, and then continues bounded historical backfill.
17The service collects SourceHut activity from one or more sr.ht GraphQL services, turns those records into a canonical event shape, aggregates activity by day, and returns zero-filled calendar ranges so the client never has to patch missing dates. It performs recent incremental polling, backfills the most recent 365 days for newly requested actors, and prunes older activity from storage.
1818
1919Example use cases:
2020
@@ -165,7 +165,7 @@ Example response:
165165}
166166```
167167
168Scheduled polling only runs when `ENABLE_SCHEDULER=true`. The scheduler seeds `DEFAULT_ACTOR` as an initial known actor, runs one poll immediately at startup, and public contribution reads register additional actors for later background polling and historical backfill.
168Scheduled polling only runs when `ENABLE_SCHEDULER=true`. The scheduler seeds `DEFAULT_ACTOR` as an initial known actor, runs one poll immediately at startup, and public contribution reads register additional actors for later background polling and one-year backfill.
169169
170170For `git.sr.ht`, owned repositories are auto-discovered for the actor. `GIT_TRACKED_REPOSITORIES` can still be used to union in extra repositories. Entries may be either:
171171