autoresearch iter 17: wire the pairing-code cleanup cron to a real handler

message_gateway scheduled message_gateway:cleanup_pairing_codes every 10
minutes but never registered a task under that pattern, so every dispatch
went to a task type with no handler and expired pairing rows accumulated
forever, even though repository.DeleteExpiredPairingCodes already existed.
Add a test that fails for any schedule whose task pattern is unregistered:
it reports the exact orphan rather than relying on a schedule-exists assert.
This commit is contained in:
ryan
2026-08-29 09:03:33 +08:00
parent 84946977bf
commit 1b1c45206c
3 changed files with 2539 additions and 0 deletions
@@ -154,6 +154,10 @@ func (p *Plugin) Apply(ctx *core.Context) error {
return nil
})
ctx.Task().Register("message_gateway:cleanup_pairing_codes", func(c context.Context, _ []byte) error {
return repository.DeleteExpiredPairingCodes(c)
}, extpoints.WithTaskRetry(defaultTaskRetry))
// 6. Register Cron Schedules
ctx.Schedule().RegisterCron("*/10 * * * *", "message_gateway:cleanup_pairing_codes", map[string]any{"action": "cleanup"})