ActivityPub background actor validation, update and cleanup process (#4765)

* feat(ap): add validation+update+cleanup AP actor job

* fix(test): use time.Time instead of sql.NullTime

* feat(test): add integration test for AP follower cleanup/validation job
This commit is contained in:
Gabe Kangas
2026-02-02 17:34:25 -08:00
committed by GitHub
parent 1a14b266aa
commit 5a4af3a294
16 changed files with 1315 additions and 25 deletions
+17
View File
@@ -35,6 +35,8 @@ func MigrateDatabaseSchema(db *sql.DB, from, to int) error {
migrateToSchema7(db)
case 7:
migrateToSchema8(db)
case 8:
migrateToSchema9(db)
default:
log.Fatalln("missing database migration step")
}
@@ -48,6 +50,21 @@ func MigrateDatabaseSchema(db *sql.DB, from, to int) error {
return nil
}
func migrateToSchema9(db *sql.DB) {
// Add columns for tracking follower validation status.
// last_validated_at: when the follower was last successfully validated
// first_validation_failure_at: when consecutive validation failures started (for removal threshold)
alterStmts := []string{
"ALTER TABLE ap_followers ADD COLUMN last_validated_at TIMESTAMP",
"ALTER TABLE ap_followers ADD COLUMN first_validation_failure_at TIMESTAMP",
}
for _, stmt := range alterStmts {
if _, err := db.Exec(stmt); err != nil {
log.Warnln("Migration statement may have already been applied:", err)
}
}
}
func migrateToSchema8(db *sql.DB) {
// Add shared_inbox column to ap_followers for ActivityPub shared inbox support.
// This allows delivering messages to a server's shared inbox instead of each