fix(backfill): drop unparseable timestamps from the latestDate reduction#1715
fix(backfill): drop unparseable timestamps from the latestDate reduction#1715RenzoMXD wants to merge 1 commit into
Conversation
latestDate selected the contributor's latest activity with a lexicographic
.sort().at(-1) and only a truthiness filter, so a malformed/sentinel
GitHub timestamp whose first character sorts after "2" (e.g. "bad-date",
"pending") outranked a real 2026-... ISO stamp and was persisted into
contributor_repo_stats.last_activity_at. Every downstream freshness check
then did Date.parse("bad-date") -> NaN and treated a genuinely active
repo as stale/missing.
Mirror the guarded newest()/oldest() in signals/data-quality.ts: also
require Number.isFinite(Date.parse(value)) in the filter, so unparseable
values are dropped from the reduction. No behavior change when every
value is a well-formed ISO timestamp.
An existing test asserted lastActivityAt: "bad-date" against a fixture
that mixes "bad-date" with valid ISO stamps; that assertion encoded the
bug and is corrected to the real latest stamp (2026-05-24T00:00:00Z).
Closes JSONbored#1714
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-06-29 14:12:43 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 8 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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1715 +/- ##
=======================================
Coverage 95.58% 95.58%
=======================================
Files 204 204
Lines 22313 22313
Branches 8065 8064 -1
=======================================
Hits 21328 21328
Misses 408 408
Partials 577 577
🚀 New features to boost your workflow:
|
Summary
latestDate(src/github/backfill.ts) selects the contributor's latest activity timestamp with a lexicographic.sort().at(-1)and only a truthiness filter:A malformed/sentinel GitHub timestamp whose first character sorts after
2(e.g.bad-date,pending,not-a-date) therefore wins over a real2026-...ISO stamp and is persisted intocontributor_repo_stats.last_activity_at. Every downstream freshness check then doesDate.parse(bad-date) -> NaNand treats a genuinely active repo as stale/missing.Fix
Mirror the guarded canonical form already in
src/signals/data-quality.ts(newest()/oldest()):Also require
Number.isFinite(Date.parse(value))inlatestDate's filter, so unparseable values are dropped from the reduction. No behavior change when every value is a well-formed ISO timestamp.Regression proof
An existing test (
test/unit/backfill.test.ts) feeds a fixture mixingupdatedAt: bad-datewith valid ISO stamps and previously assertedlastActivityAt: bad-date-- encoding the bug. That assertion is corrected to the real latest stamp (2026-05-24T00:00:00Z); the flip is the regression proof (pre-fix the malformed value won the lexicographic max; post-fix it is dropped).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/backfill.test.ts94/94 pass; the changed filter is covered (both arms: the malformedbad-dateis dropped, the valid ISO stamps are kept).Targeted run:
npx vitest run test/unit/backfill.test.ts # 94/94 passedSafety
UI Evidence
Not applicable -- backend timestamp-reduction helper with no visible UI, frontend, docs, or extension surface.
Closes #1714