feat(sources): enforce supported source allowlist

Assign stable keys to the three supported sources, preserve excluded historical rows, and expose history read-only in admin. Add migration, coverage, and responsive browser spec.

Refs #13

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 00:11:26 +01:00
parent 4459a81206
commit ac17d27f51
26 changed files with 924 additions and 61 deletions

View File

@ -109,7 +109,7 @@ func run(ctx context.Context) error {
if err = server.EnsureAdmin(repo, cfg); err != nil {
return err
}
feeds := map[string]scraper.Scraper{"stocktwits": e2estack.FakeScraper{URL: fakeURL, Client: client}}
feeds := map[string]scraper.Scraper{models.SourceYahooFinance: e2estack.FakeScraper{URL: fakeURL, Client: client}}
provider := e2estack.FakeProvider{URL: fakeURL, Client: client}
gin.SetMode(gin.TestMode)
gin.DefaultWriter = io.Discard
@ -222,7 +222,7 @@ func seed(db *sql.DB, fakeURL string) error {
if _, err = tx.Exec(`UPDATE sources SET enabled=false`); err != nil {
return err
}
if _, err = tx.Exec(`INSERT INTO sources(id,name,type,enabled,article_limit) VALUES('00000000-0000-0000-0000-000000001201','E2E fixture','stocktwits',true,20)`); err != nil {
if _, err = tx.Exec(`UPDATE sources SET enabled=true WHERE source_key='yahoo_finance'`); err != nil {
return err
}
if _, err = tx.Exec(`INSERT INTO ai_providers(id,name,model,endpoint,is_active) VALUES('00000000-0000-0000-0000-000000001202','ollama','fake-laya',$1,true)`, fakeURL); err != nil {