Skip to content

fix(store): keep the scheduled collect off the paused OssInsight source - #4

Merged
sigmanor merged 2 commits into
mainfrom
fix/ossinsight-paused
Sep 8, 2026
Merged

sigmanor merged 2 commits into
mainfrom
fix/ossinsight-paused

Conversation

@sigmanor

@sigmanor sigmanor commented Sep 8, 2026

Copy link
Copy Markdown
Member

Problem

OssInsight stopped computing its star-based rankings (unavailable_since: 2026-03-01), so GetTrendingReposFromOssInsight in content-alchemist has nothing to return. Any deployment whose collect_settings.resource is ossinsight keeps running the collect cron daily and quietly collects zero posts.

Change

Reset the stored value inside migrateCollectSettingsSchema, which already runs on database initialisation:

UPDATE collect_settings SET resource = 'github' WHERE resource = 'ossinsight'

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.

UpdateCollectSettings and GetCollectSettings are deliberately untouched: TestSQLiteStore_UpdateCollectSettings does a round-trip with Resource: "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. UpdateCollectSettings in internal/server/api.go validated MaxRepos, Since and SpokenLanguageCode but accepted any string as the resource — there was no allow-list for it anywhere — and CollectJob reads 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 write ossinsight back and bring the silent zero-collect cron with it until the next restart.

The handler now validates the resource through validation.ValidateCollectResource, following the existing ValidatePromptSettings pattern, with paused sources listed separately from unsupported ones so the 400 explains why the value was refused. An empty resource still defaults to store.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.
  • The statement was exercised on a throwaway SQLite database: ossinsightgithub, and a second run leaves it at github.
  • go test ./internal/validation/... ./internal/store/... ./internal/server/... ./internal/schedule/... passes; TestValidateCollectResource covers the supported, paused, unknown and empty cases.

Related

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.
@sigmanor
sigmanor merged commit 60e4f8b into main Sep 8, 2026
1 check passed
@sigmanor
sigmanor deleted the fix/ossinsight-paused branch September 8, 2026 10:27
@sigmanor

sigmanor commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

🎉 This PR is included in version 3.9.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant