feat: add monitoring marked articles and retention updates
This commit is contained in:
@@ -34,3 +34,34 @@ func TestBatchProbeSQLCapsDryRunProbe(t *testing.T) {
|
||||
t.Fatalf("batchProbeSQL should count only the limited candidate subquery:\n%s", sql)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarkedArticleRetentionClearsManualAttributionBeforeDelete(t *testing.T) {
|
||||
var target retentionTarget
|
||||
for _, item := range retentionTargets() {
|
||||
if item.Name == "monitoring_user_marked_articles" {
|
||||
target = item
|
||||
break
|
||||
}
|
||||
}
|
||||
if target.Name == "" {
|
||||
t.Fatal("monitoring_user_marked_articles retention target missing")
|
||||
}
|
||||
if target.PreDeleteSQL == "" {
|
||||
t.Fatal("monitoring_user_marked_articles retention target must clear citation attribution before delete")
|
||||
}
|
||||
|
||||
for _, want := range []string{
|
||||
"SELECT tenant_id, id",
|
||||
"UPDATE monitoring_citation_facts cf",
|
||||
"cf.tenant_id = doomed.tenant_id",
|
||||
"content_source_type = 'manual_mark'",
|
||||
"content_source_id = doomed.id",
|
||||
"SET content_source_type = NULL",
|
||||
"LIMIT $2",
|
||||
"FOR UPDATE SKIP LOCKED",
|
||||
} {
|
||||
if !strings.Contains(target.PreDeleteSQL, want) {
|
||||
t.Fatalf("marked article attribution cleanup SQL missing %q in SQL:\n%s", want, target.PreDeleteSQL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user