3.5 KiB
3.5 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 25-watcher-polling | Azure watcher polling | completed | 12 |
|
plan.md | ../../specs/azure-devops-integration/spec.md |
Task 25: Azure Watcher Polling
Acceptance
- One Azure watcher poller schedules due enabled work-item and PR watches, executes provider-native WIQL/PR filters, and publishes normalized events only after a current-generation reservation succeeds.
- Create, Run now, and scheduled polls use the same check functions. Each check is deterministically bounded to 100 matches; work-item hydration honors the Azure 200-ID batch limit and PR status defaults to active.
- Provider events contain watch ID/generation, workspace/workflow context, Kandev repository/base branch, profiles, prompt, cleanup/in-flight settings, provider identity, title, URL, and the fields needed for prompt interpolation. They never contain the PAT.
- Authentication, malformed WIQL/filter, timeout, rate-limit, and provider
failures record
last_error/last_error_at, update the poll timestamp, and publish no task event. A later successful check clears the error. - Polling reconciles terminal state only for current-generation reservations
that own an auto-created Kandev task.
auto,always, andnevercleanup cannot delete manual tasks or tasks owned by another watch/generation. - Poller start/stop is context-aware and isolated from Azure connection-health polling; one failing watch does not delay another due watch.
TDD Sequence
- Add client/service tests for bounded WIQL and PR matching, event mapping, duplicate reservation rejection, and error/clear transitions; verify the missing check paths fail.
- Add poller tests with a controllable clock for due scheduling, start/stop, independent failures, and Run now.
- Add cleanup reconciliation tests for provider terminal states and all three policies, then implement the minimum polling/event code and refactor shared work-item/PR scheduling with the focused suite green.
Verification
go test ./internal/azuredevops ./internal/orchestratorfromapps/backend— passed (1,455 tests).- Coverage includes bounded checks, duplicate suppression, provider errors, terminal cleanup policies, and watcher poller scheduling.
Files Likely Touched
apps/backend/internal/azuredevops/service_watches.goapps/backend/internal/azuredevops/service_watches_test.goapps/backend/internal/azuredevops/service_watch_events.goapps/backend/internal/azuredevops/poller_watches.goapps/backend/internal/azuredevops/poller_watches_test.goapps/backend/internal/azuredevops/client.goapps/backend/internal/azuredevops/rest_client.goapps/backend/internal/azuredevops/mock_client.goapps/backend/internal/azuredevops/mock_controller.goapps/backend/internal/events/types.go
Dependencies
Task 24.
Parallelism
Sequential. Poll scheduling, provider checks, reservations, and cleanup share watch state.
Inputs
- Spec: watcher behavior, failure modes, and match scenario.
- GitLab
poller.go,service_watches.go, andservice_issue_watches.go.
Risks
- WIQL may return large existing sets. Respect top/batch limits and reservation checks before event publication to avoid a task burst after restart.
- Do not reserve terminal-state reconciliation as a new match; it operates only on existing task-owning reservations.
Output Contract
Report scheduling and dedup behavior, RED/GREEN commands, files changed, mock coverage, risks, and update task/plan status.