fix: read the singular "1 star today" from GitHub trending - #37
Draft
DamengRandom wants to merge 1 commit into
Draft
fix: read the singular "1 star today" from GitHub trending#37DamengRandom wants to merge 1 commit into
DamengRandom wants to merge 1 commit into
Conversation
The growth regex required the plural "stars", so a repo that gained exactly one star fell through to the zero fallback — ranked as if it had grown none, rendered as "(+0 today)", and stored that way. Closes #36 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ab5JNnyCu9dcG9erRXtTWs
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.
Closes #36
The change
src/tools/trending-scrape.tool.ts:32—stars→stars?in the growth regex.GitHub renders
1 star todaywhen a repo gained exactly one star. The pattern required the plural, so the match failed and line 33's zero fallback fired: a repo that grew by one was recorded as having grown by none, ranked accordingly byrankByGrowth, rendered as(+0 today), and persisted that way.Test
src/tools/trending-scrape.test.tsis new — there was no coverage of the parser before. It stubsfetchwith article markup trimmed from a livetrending/javascript?since=dailyresponse and asserts the singular form parses as1, alongside a plural control and the genuinely-absent case.Without the one-character fix:
With it, the full suite is 82 passing (79 on master + 3 here);
pnpm tscandpnpm format:checkare clean.Observed vs reasoned
Observed by execution. The trigger is live production data, not a constructed input —
trending/javascriptis one of exactly two pages this job scrapes, and it carried1 star todayforOWASP/threat-dragonduring the scan. Running the realtrendingScrapeToolover that page returnedtodayStars=0for it while the plural control (addyosmani/agent-skills, 226) parsed correctly. The rendered digest line read⭐ 500 (+0 today) · JavaScript. Today's Zig page carried two more instances, so the singular form is routine rather than a one-off.Reasoned, not observed. The downstream ranking and database effects —
rankByGrowthsorting on the wrong key andgithub_trending.today_starsstoring0— follow from readingsrc/agent/index.ts:166andsrc/storage/own-db.ts:127. I could not run either path: the curator needs LLM credentials and the write needs a database, neither of which exists in this environment.Generated by Claude Code