test(handlers/delegation): add coverage for listDelegationsFromLedger + listDelegationsFromActivityLogs #967

Merged
devops-engineer merged 1 commits from feat/delegation-list-tests into main 2026-05-14 05:18:34 +00:00

1 Commits

Author SHA1 Message Date
41d4da590f test(handlers/delegation): add coverage for listDelegationsFromLedger + listDelegationsFromActivityLogs
Some checks failed
sop-checklist / na-declarations (pull_request) awaiting /sop-n/a declaration for: qa-review, security-review
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 19s
CI / Detect changes (pull_request) Successful in 39s
E2E API Smoke Test / detect-changes (pull_request) Successful in 46s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 52s
Harness Replays / detect-changes (pull_request) Successful in 17s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 54s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 16s
qa-review / approved (pull_request) Successful in 18s
gate-check-v3 / gate-check (pull_request) Successful in 28s
security-review / approved (pull_request) Successful in 14s
sop-checklist / all-items-acked (pull_request) Successful in 15s
sop-tier-check / tier-check (pull_request) Successful in 14s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 46s
audit-force-merge / audit (pull_request) Successful in 17s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m22s
CI / Canvas (Next.js) (pull_request) Successful in 6s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 5s
CI / Python Lint & Test (pull_request) Successful in 5s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 9s
Harness Replays / Harness Replays (pull_request) Successful in 6s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 9s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1m50s
CI / Platform (Go) (pull_request) Failing after 4m4s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 4m3s
CI / Canvas Deploy Reminder (pull_request) Successful in 7s
CI / all-required (pull_request) Successful in 5s
Add 13 unit tests covering the data-backend methods behind ListDelegations:

- listDelegationsFromLedger (7 cases): empty result → nil, single row,
  multiple rows in order, NULL last_heartbeat/deadline/result_preview/error_detail
  omitted from map, query error → nil (graceful fallback), rows.Err() mid-stream,
  scan error on row → row skipped.

- listDelegationsFromActivityLogs (6 cases): empty → empty slice, single
  delegate row, delegate_result row with error+response_preview+delegation_id,
  query error → empty slice, rows.Err(), scan error → row skipped.

Both methods were untested (cf. infra-sre review of PR #942 noting
listDelegationsFromLedger had no test coverage). Uses sqlmock, follows
existing test patterns in delegation_test.go.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 05:16:52 +00:00