feat(onboard): burst picks likely-good videos, summarizes with stronger model (ADR-028)
Wire the onboarding burst to its quality-aware selection and a stronger model: - main.go onboard uses OnboardBurstVideoIDs (junk-avoiding) instead of pure newest-first, bounded by MinVideoSeconds / OnboardMaxVideoSeconds. - buildBurstProcessor builds a burst-only summarizer chain led by the onboard model (burstChainModels: onboard -> standard ADR-022 chain, deduped, NDA lever intact), over the same store/cache/sink. Collapses onto the shared Processor when the onboard model is empty/equal-to-primary or config is incomplete. - summarizerEndpoint + newYouTubeSource extracted so standard and burst wiring share one definition. - Remove now-superseded NewestUnsummarizedVideoIDs: OnboardBurstVideoIDs(.,0,0) is identical pure-newest behaviour and its test covers RLS + ordering.
This commit is contained in:
@@ -112,38 +112,6 @@ func TestUpsertVideo_PerUserIsolation(t *testing.T) {
|
||||
require.NotEqual(t, idA, idB, "same provider video for two users must be two distinct rows")
|
||||
}
|
||||
|
||||
func TestNewestUnsummarizedVideoIDs(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
s := newStore(t)
|
||||
resetDB(t, rawPool(t))
|
||||
|
||||
mk := func(user, pid string, day int) string {
|
||||
v := ytVideo(user, pid, pid)
|
||||
v.PublishedAt = time.Date(2026, 6, day, 12, 0, 0, 0, time.UTC)
|
||||
id, err := s.UpsertVideo(ctx, v)
|
||||
require.NoError(t, err)
|
||||
return id
|
||||
}
|
||||
|
||||
_ = mk(userA, "a1vid000001", 1)
|
||||
id2 := mk(userA, "a2vid000002", 2)
|
||||
id3 := mk(userA, "a3vid000003", 3)
|
||||
id4 := mk(userA, "a4vid000004", 4)
|
||||
mk(userB, "b1vid000009", 9) // userB's newest — must never leak via RLS
|
||||
|
||||
// The newest (v4) is summarized, so it's excluded from "unsummarized".
|
||||
require.NoError(t, s.Deliver(ctx, summary(userA, id4, "done")))
|
||||
|
||||
// Cap 2, newest-first unsummarized: v3 then v2 (v4 excluded; userB excluded).
|
||||
got, err := s.NewestUnsummarizedVideoIDs(ctx, userA, 2)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []string{id3, id2}, got)
|
||||
|
||||
none, err := s.NewestUnsummarizedVideoIDs(ctx, userA, 0)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, none, "limit 0 returns nothing")
|
||||
}
|
||||
|
||||
func TestOnboardBurstVideoIDs(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
s := newStore(t)
|
||||
@@ -158,14 +126,16 @@ func TestOnboardBurstVideoIDs(t *testing.T) {
|
||||
return id
|
||||
}
|
||||
|
||||
good1 := mk(userA, "good0000001", 5, 600) // 10m, newest known-good
|
||||
tooLong := mk(userA, "toolong0001", 4, 20000) // > maxSeconds -> dropped
|
||||
_ = tooLong
|
||||
tooShort := mk(userA, "tooshort001", 3, 30) // < minSeconds -> dropped
|
||||
_ = tooShort
|
||||
unknown := mk(userA, "unknown0001", 2, 0) // NULL duration -> kept, ranked last
|
||||
good2 := mk(userA, "good0000002", 1, 800) // known-good but oldest
|
||||
mk(userB, "bvid0000009", 9, 600) // userB -> must not leak via RLS
|
||||
summarized := mk(userA, "summ0000001", 6, 600) // newest known-good, but already summarized
|
||||
good1 := mk(userA, "good0000001", 5, 600) // 10m, newest UNsummarized known-good
|
||||
tooLong := mk(userA, "toolong0001", 4, 20000) // > maxSeconds -> dropped
|
||||
tooShort := mk(userA, "tooshort001", 3, 30) // < minSeconds -> dropped
|
||||
unknown := mk(userA, "unknown0001", 2, 0) // NULL duration -> kept, ranked last
|
||||
good2 := mk(userA, "good0000002", 1, 800) // known-good but oldest
|
||||
mk(userB, "bvid0000009", 9, 600) // userB -> must not leak via RLS
|
||||
|
||||
// The newest video is summarized, so it is excluded from the burst.
|
||||
require.NoError(t, s.Deliver(ctx, summary(userA, summarized, "done")))
|
||||
|
||||
const minSec, maxSec = 60, 14400
|
||||
|
||||
|
||||
Reference in New Issue
Block a user