# Release Checklist

This checklist captures the work required before cutting a release that includes
the graceful worker shutdown feature.

## 1. Code Hygiene / Compilation
1. Merge the graceful-shutdown helpers into the canonical worker type to avoid
     `Worker redeclared` errors (see `cmd/worker/worker_graceful_shutdown.go` and
     `cmd/worker/worker_server.go`).
2. Ensure the worker struct exposes the fields referenced by the new helpers
     (`logger`, `queue`, `cfg`, `metrics`).
3. `go build ./cmd/worker` succeeds without undefined-field errors.

## 2. Graceful Shutdown Logic
1. Initialize `shutdownCh`, `activeTasks`, and `gracefulWait` during worker start-up.
2. Confirm the heartbeat/lease helpers compile and handle queue errors gracefully
     (`heartbeatLoop`, `releaseAllLeases`).
3. Add tests (unit or integration) that simulate SIGINT/SIGTERM and verify leases
     are released or tasks complete.

## 3. Task Execution Flow
1. Align `executeTaskWithLease` with the real `executeTask` signature so the
     "no value used as value" compile error disappears.
2. Double-check retry/metrics paths still match existing worker behavior after
     the new wrapper is added.

## 4. Server Wiring
1. Ensure worker construction in `cmd/worker/worker_server.go` wires up config,
     queue, metrics, and logger instances used by the shutdown logic.
2. Re-run worker unit tests plus any queue/lease e2e tests.

## 5. Validation Before Tagging
1. `go test ./cmd/worker/...` and `make test` (or equivalent) pass locally.
2. Manual smoke test: start worker, queue jobs, send SIGTERM, confirm tasks finish
     or leases are released and the process exits cleanly.
3. Update release notes describing the new shutdown capability and any config
     changes required (e.g., graceful timeout settings).
