feat(schedule): add Temporal schedule for periodic scanning#4
feat(schedule): add Temporal schedule for periodic scanning#4revied wants to merge 7 commits intoblock:mainfrom
Conversation
Adds Temporal Schedule API support so the OrchestratorWorkflow runs automatically on a configurable cron (default: every 6 hours). The schedule manager uses a create-or-update pattern to handle restarts gracefully. Disabled by default via SCHEDULE_ENABLED=false. New files: - pkg/schedule/schedule.go: Schedule manager with create-or-update logic - pkg/schedule/schedule_test.go: 6 unit tests covering all paths Modified: - cmd/server/main.go: Added SCHEDULE_ENABLED, SCHEDULE_CRON, SCHEDULE_ID, SCHEDULE_JITTER config; wiring with graceful failure - pkg/workflow/orchestrator/workflow.go: ScanID fallback from workflow execution ID for scheduled runs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Aligns with the design doc which specifies daily at 06:00 UTC, not every 6 hours. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🤖 Automated Expert ReviewSummaryAdds Temporal Schedule API support for periodic orchestrator scanning with a solid create-or-update pattern. Well-structured code with good test coverage, but has a potential nil pointer panic in the update path and missing startup timeout. Findings🚫 BLOCKER: Nil pointer dereference in DoUpdate closureFile: if input.Description.Schedule.Spec == nil {
input.Description.Schedule.Spec = &client.ScheduleSpec{}
}
|
| Check | Status | Notes |
|---|---|---|
| 🔒 Security | ✅ | No secrets, credentials, or injection vectors |
| 🏗️ Reliability | Nil pointer risk in DoUpdate; missing startup timeout | |
| 🚀 Staging before Prod | N/A | Feature flag gated (SCHEDULE_ENABLED=false default) |
| 📦 Atlantis Plan | N/A | Not an infrastructure PR |
| 🧪 Tests | 6 tests cover happy paths well; missing nil Spec edge case | |
| ⚙️ CI Checks | 🚫 | "Test" check is failing (1m49s) |
| 💰 Cost/Blast Radius | ✅ | Disabled by default, low risk |
Verdict: REQUEST CHANGES
The BLOCKER (nil pointer panic in DoUpdate) must be fixed before merge. The CI test failure also needs investigation. The two WARNINGs (partial update propagation, missing startup timeout) should ideally be addressed but are not strictly blocking.
🤖 Review by Amp agent · not a substitute for human review
- Add nil guard for Spec in DoUpdate closure to prevent panic - Propagate TaskQueue changes in schedule updates via Action assertion - Add 10s timeout on EnsureSchedule during startup - Add TestEnsureSchedule_AlreadyExists_NilSpec test case Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rename ScheduleConfig -> Config, ScheduleCreator -> Creator (revive) - Reorder mockScheduleHandle fields for alignment (govet) - Add nolint for hugeParam on mock Create (matches SDK interface) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Handle Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Summary
SCHEDULE_ENABLED=falsefor backwards compatibilityConfiguration
SCHEDULE_ENABLEDfalseSCHEDULE_CRON0 6 * * *SCHEDULE_IDversion-guard-scanSCHEDULE_JITTER5mChanges
New:
pkg/schedule/schedule.go- Schedule manager with create-or-update logicpkg/schedule/schedule_test.go- 6 unit tests covering all pathsModified:
cmd/server/main.go- Config fields, schedule wiring with graceful failurepkg/workflow/orchestrator/workflow.go- ScanID fallback from workflow execution ID for scheduled runsTest plan
go build ./...compilesgo test ./pkg/schedule/...- 6/6 tests passgo test ./...- full suite passesSCHEDULE_ENABLED=true go run ./cmd/server/with local Temporal dev server🤖 Generated with Claude Code