mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 07:26:36 +08:00
autoresearch iter 18: remove the phantom user:daily_audit schedule
The user plugin registered a cron dispatching to user:daily_audit, a task pattern it never registers, and no audit logic exists anywhere in the plugin. The daily run therefore went nowhere while a test asserted the schedule was registered — proving the wiring existed, not that it worked. Implementing a real daily audit is unstarted functionality, so the schedule is removed rather than stubbed. The combined domain test now asserts the real invariant across all applied plugins: every schedule's task type must have a registered handler.
This commit is contained in:
@@ -234,10 +234,6 @@ func TestUserPlugin(t *testing.T) {
|
||||
require.True(t, ok)
|
||||
assert.Equal(t, 3, taskDef.Retry)
|
||||
|
||||
schedDef, ok := ctx.Schedules().Get("user:daily_audit")
|
||||
require.True(t, ok)
|
||||
assert.Equal(t, "0 3 * * *", schedDef.Spec)
|
||||
|
||||
// 10. Settings
|
||||
sReg, ok := ctx.Settings().Get("user.registration_enabled")
|
||||
require.True(t, ok)
|
||||
@@ -433,7 +429,15 @@ func TestAllDomainPluginsCombined(t *testing.T) {
|
||||
|
||||
// Verify total schedules registered
|
||||
allSchedules := ctx.Schedules().Schedules()
|
||||
assert.GreaterOrEqual(t, len(allSchedules), 3)
|
||||
assert.GreaterOrEqual(t, len(allSchedules), 2)
|
||||
|
||||
// 每个调度指向的任务类型都必须已注册 Handler,否则触发时会投递到无人处理的
|
||||
// 任务类型,预期的清理逻辑静默失效。
|
||||
for _, sched := range allSchedules {
|
||||
_, ok := ctx.Tasks().Get(sched.TaskType)
|
||||
assert.Truef(t, ok, "schedule %q dispatches to task %q, which is never registered",
|
||||
sched.Spec, sched.TaskType)
|
||||
}
|
||||
|
||||
// Verify total settings schemas registered
|
||||
allSettings := ctx.Settings().Schemas()
|
||||
|
||||
@@ -138,10 +138,7 @@ func (p *Plugin) Apply(ctx *core.Context) error {
|
||||
return nil
|
||||
})
|
||||
|
||||
// 5. Register Cron Schedules
|
||||
ctx.Schedule().RegisterCron("0 3 * * *", "user:daily_audit", map[string]string{"type": "audit"})
|
||||
|
||||
// 6. Register Settings Schemas
|
||||
// 5. Register Settings Schemas
|
||||
ctx.Settings().Register(extpoints.SettingSchema{
|
||||
Key: "user.registration_enabled",
|
||||
Default: true,
|
||||
|
||||
Reference in New Issue
Block a user