fix(github): normalize public_repos/followers from the users API with finiteCount#1711
Conversation
… finiteCount fetchPublicContributorProfile passed `public_repos` and `followers` straight from the GitHub users API response into PublicContributorProfile. The same module already normalizes the analogous repo-stat counts (`stargazers_count`/`forks_count`) through the `finiteCount` helper, which returns 0 for anything that is not a finite, non-negative number. The user-profile counts are the same class of external GitHub-API field but were not normalized, so a null/string/non-finite value (some account shapes, or a BYOK proxy) would propagate as a non-number onto the contributor-evidence surface. Apply the existing `finiteCount` to `publicRepos` and `followers` for consistency with the repo-stat path. No behavior change for any well-formed response (a valid count is returned unchanged; 0 stays 0). Closes JSONbored#1710
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1711 +/- ##
=======================================
Coverage 95.58% 95.59%
=======================================
Files 204 204
Lines 22313 22313
Branches 8065 8065
=======================================
+ Hits 21328 21329 +1
Misses 408 408
+ Partials 577 576 -1
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
fetchPublicContributorProfile(src/github/public.ts) passedpublic_reposandfollowersstraight from the GitHub users API response intoPublicContributorProfile:The same module already normalizes the analogous repo-stat counts from the repos API through the
finiteCounthelper:where
finiteCountreturns0for anything that is not a finite, non-negative number. The user-profile counts are the same class of external GitHub-API field but were not normalized, so anull/string/non-finite value (some account shapes, or a BYOK proxy) would propagate as a non-number onto the contributor-evidence surface.Fix
Apply the existing
finiteCounttopublicReposandfollowersfor consistency with the repo-stat path. No behavior change for any well-formed response -- a valid count is returned unchanged and0stays0.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run db:migrations:checknpm run typechecknpm run test:coverage--test/unit/adapters.test.ts8/8 pass; the changedfiniteCountcall sites are covered (both arms: a valid count via the existingoktofeesh1stub, andnull/string via the newnullcountsstub).Targeted run:
npx vitest run test/unit/adapters.test.ts # 8/8 passedSafety
UI Evidence
Not applicable -- backend normalization on advisory metadata with no visible UI, frontend, docs, or extension surface.
Closes #1710