Skip to content

fix: read the singular "1 star today" from GitHub trending - #37

Draft
DamengRandom wants to merge 1 commit into
masterfrom
fix/scan-singular-star-today
Draft

fix: read the singular "1 star today" from GitHub trending#37
DamengRandom wants to merge 1 commit into
masterfrom
fix/scan-singular-star-today

Conversation

@DamengRandom

Copy link
Copy Markdown
Owner

Closes #36

The change

src/tools/trending-scrape.tool.ts:32starsstars? in the growth regex.

GitHub renders 1 star today when 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 by rankByGrowth, rendered as (+0 today), and persisted that way.

Test

src/tools/trending-scrape.test.ts is new — there was no coverage of the parser before. It stubs fetch with article markup trimmed from a live trending/javascript?since=daily response and asserts the singular form parses as 1, alongside a plural control and the genuinely-absent case.

Without the one-character fix:

not ok 1 - reads the singular "1 star today" GitHub renders, not just the plural form
  expected: 1
  actual: 0
# tests 3
# pass 2
# fail 1

With it, the full suite is 82 passing (79 on master + 3 here); pnpm tsc and pnpm format:check are clean.

Observed vs reasoned

Observed by execution. The trigger is live production data, not a constructed input — trending/javascript is one of exactly two pages this job scrapes, and it carried 1 star today for OWASP/threat-dragon during the scan. Running the real trendingScrapeTool over that page returned todayStars=0 for 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 — rankByGrowth sorting on the wrong key and github_trending.today_stars storing 0 — follow from reading src/agent/index.ts:166 and src/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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trending scrape records "1 star today" as 0 — the regex only matches the plural "stars"

2 participants