fix(store): keep the scheduled collect off the paused OssInsight source - #4
Merged
Merged
Conversation
OssInsight stopped computing its star-based rankings, so a collect run with `resource = 'ossinsight'` fetches nothing. Reset the stored value to `github` during the collect_settings migration, so an existing deployment does not keep running a cron that quietly collects zero posts. The statement is idempotent and also guards against the value reaching the table by another route. Drop it together with re-enabling the option in content-sentinel.
The migration only resets the stored resource at start-up, so a direct API call in place of content-sentinel — where the option is merely disabled in the dropdown — could write 'ossinsight' back and leave the cron collecting zero posts again until the next restart. Validate the resource in the handler, following the ValidatePromptSettings pattern, with the paused sources named separately so the error says why the value is refused. The store keeps accepting any value, so the round-trip test there is unaffected.
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 stopped computing its star-based rankings (
unavailable_since: 2026-03-01), soGetTrendingReposFromOssInsightin content-alchemist has nothing to return. Any deployment whosecollect_settings.resourceisossinsightkeeps running the collect cron daily and quietly collects zero posts.Change
Reset the stored value inside
migrateCollectSettingsSchema, which already runs on database initialisation:Idempotent, so it runs harmlessly on every start and also acts as a guard if the value reaches the table by another route. To be dropped together with re-enabling the option in content-sentinel.
UpdateCollectSettingsandGetCollectSettingsare deliberately untouched:TestSQLiteStore_UpdateCollectSettingsdoes a round-trip withResource: "ossinsight"and should stay green, since it tests storing an arbitrary value rather than the policy of which sources are offered.Follow-up from review
The migration alone only holds at start-up.
UpdateCollectSettingsininternal/server/api.govalidated MaxRepos, Since and SpokenLanguageCode but accepted any string as the resource — there was no allow-list for it anywhere — andCollectJobreads the stored value straight from the database. A direct API call in place of content-sentinel, where the option is only disabled in the dropdown, could therefore writeossinsightback and bring the silent zero-collect cron with it until the next restart.The handler now validates the resource through
validation.ValidateCollectResource, following the existingValidatePromptSettingspattern, with paused sources listed separately from unsupported ones so the 400 explains why the value was refused. An empty resource still defaults tostore.DefaultResource. The store layer is untouched, so its round-trip test stays valid.Verification
go build ./...clean;go test ./internal/store/... ./internal/schedule/...passes, including the round-trip test above.ossinsight→github, and a second run leaves it atgithub.go test ./internal/validation/... ./internal/store/... ./internal/server/... ./internal/schedule/...passes;TestValidateCollectResourcecovers the supported, paused, unknown and empty cases.Related