Fix duplicate new contributors appearing across multiple months#609
Merged
Fix duplicate new contributors appearing across multiple months#609
Conversation
Fix date boundary overlap bug where contributors appeared as 'new' in multiple months. The issue occurred because the historical contributor query used an inclusive endpoint (<=) which caused PRs merged at the exact report start time (e.g., 2026-01-01 00:00:00.000Z) to be counted in both the historical set AND the current report period. Root cause: - Historical query: 2024-01-01 to reportStartDate (inclusive) - Current report: reportStartDate to reportEndDate (inclusive) - Result: reportStartDate overlapped in both ranges Solution: Subtract 1 millisecond from historical query endpoint to ensure strict boundary separation: - Historical: 2024-01-01 to (reportStartDate - 1ms) - Current: reportStartDate to reportEndDate Verified fix: - December 2025: 16 new contributors (KiKaraage, coxde, sebjag, etc.) - January 2026: 10 new contributors (all different people) - No overlap: December new contributors correctly show as returning in January Changes: - scripts/lib/contributor-tracker.mjs: Subtract 1ms from beforeDate - reports/2025-12-31-report.mdx: Regenerated with fixed logic - reports/2026-01-31-report.mdx: Regenerated with fixed logic Assisted-by: Claude Sonnet 4.5 via GitHub Copilot
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Problem Details
Contributors were incorrectly marked as "New Lights" (first-time contributors) in multiple months:
Example duplicates found:
Root Cause
Date boundary overlap in
scripts/lib/contributor-tracker.mjs:Before:
PRs merged at exactly
2026-01-01 00:00:00.000Zwere counted in both the historical set AND the current report period.Solution
Subtract 1 millisecond from historical query endpoint:
Verification
Ran comprehensive verification showing:
✅ Zero duplicates between December and January new contributors
✅ All 16 December new contributors correctly categorized in January:
Verified examples:
Changes
scripts/lib/contributor-tracker.mjs: Fixed date boundary logic with 1ms subtractionreports/2025-12-31-report.mdx: Regenerated with corrected logicreports/2026-01-31-report.mdx: Regenerated with corrected logicImpact
--month=YYYY-MMflag to apply fixTesting