Repository navigation
fix(signals): detect the Explosive spike from the last 90 days - #131
Open
MikeSoroka wants to merge 1 commit into
Open
MikeSoroka wants to merge 1 commit into
MikeSoroka wants to merge 1 commit into
Conversation
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.
Fixes #130
Problem
The Explosive style ("a recent burst well above your usual pace") is triggered by
recent_spike, which compared the last 365 days of contributions againstlifetime / active_years. That window is too coarse, and it misfires both ways:active_yearscomes from owned-repo created/pushed years, not contribution years (see Active years are undercounted for organization contributions #90), so the lifetime average can be far too low or too high.Fix
recent_spikeis now computed byisRecentSpike()inlib/github/signals.tsfrom the daily contribution calendar. That calendar was already fetched (only to count active days), so this costs no extra API calls.A profile spikes when its last 90 days are:
"Usual pace" is the higher of:
Taking the higher of the two means getting back to a normal level after a quiet stretch doesn't count as a burst.
Changes
lib/github/client.ts:RawPayloadgainsrecentDaily: number[](the calendar flattened, oldest first)lib/github/signals.ts: new exportedisRecentSpike(); replaces the one-line formulascripts/distribution-runner.ts: buildsrecentDailythe same way, so the distribution sampling scores like productiontests/signals.test.ts: 6 new tests: fresh burst, finished burst, steady pace, getting back to the lifetime pace, tiny counts, wiring throughsignalsFromPayloadNotes
recent_spikealso feedspickFinishinengine.ts: a spiking profile with overall ≥ 65 gets the TOTW (IN-FORM) finish, so some cards change design, not only the Style label.active_years, which still drives the Controlled style and PHY/legacy; that remains Active years are undercounted for organization contributions #90 / fix(scoring): derive active years from GitHub contribution history #89. The spike no longer depends on it.SPIKE_DAYS,SPIKE_FACTOR,SPIKE_MIN) are constants at the top ofsignals.ts, easy to tune.Testing
npm run lint: no errors (existing warnings only, none in touched files)npm test: 305/305 passnpm run build: succeeds