fix(parser): fail loudly when the OssInsight ranking is unavailable - #7
Merged
Merged
Conversation
OssInsight paused its star-based rankings: the trends endpoint answers with HTTP 200, an empty `data.rows` and a `data_quality` block explaining that the metric cannot be computed. The parser only read `data.rows`, so a collect run returned an empty repository list and reported success, which made the scheduled collect fetch nothing without a single error in the logs. Parse `data_quality` and return an error when the metric is not ok, or when the response carries no rows at all. `data.rows` is checked instead of the filtered slice, so an all-non-English page stays a legitimate empty result.
The empty-payload guard fired for any request with no rows, including one that is legitimately empty: `language` is not validated against an allow-list, so a narrow filter reaching a healthy OssInsight can match nothing at all. That made the two collect sources disagree on the same class of input — GetTrendingRepos returns an empty slice when the GitHub trending page has no matches, while this path answered with a 500. Restrict the guard to an unfiltered query, where no rows can only mean the ranking is broken. The check still covers the case data_quality is missing from the response.
Member
Author
|
🎉 This PR is included in version 3.9.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Problem
OssInsight paused its star-based rankings. The trends endpoint still answers with HTTP 200, but with an empty
data.rowsand adata_qualityblock spelling out why:GetTrendingReposFromOssInsightread onlydata.rows, so the chain was:empty rows →
allRepos == nil→FilterExistingRepos(nil)→[]→AutoGeneraterespondsstatus: "ok"with emptyadded/dont_added.A silent failure: a collect run reported success while fetching nothing, with no error anywhere in the logs.
Change
Parse
data_qualityand reject the response before iterating rows:statuspresent and notok→ error naming the metric, the date and the upstream reason;The check reads
data.rowsrather than the filtered slice, so a page where every description failsisEnglishTextremains a legitimate empty result rather than an error.ossinsightstays invalidResourcesinauto_generate.go— a direct API call now gets a meaningful 500 with the real cause logged, which is better than a 400 claiming the resource is invalid.Follow-up from review
The empty-payload guard was initially unconditional, which caught more than the outage it was meant for.
languagehas no allow-list inauto_generate.go(unlikeperiod), so a narrow filter against a healthy OssInsight can legitimately match nothing — andGetTrendingReposreturns an empty slice in exactly that situation for the GitHub source (parser/parser.go:294). The two sources would have disagreed on the same class of input, one answering 200 with an empty list and the other a 500.The guard is now limited to an unfiltered query (
languageempty orAll), where no rows can only mean the ranking is broken. It still covers a response that has lost itsdata_qualityblock.Verification
go build ./...andgo vet ./...clean.OssInsight metric "github_event_derived_ranking" is unavailable since 2026-03-01: This ranking is ordered by recent star/PR/issue event counts, and our capture of those events fell to roughly 0.3% of baseline..."resource": "github"is unaffected.Related
github