test(handlers): add unit tests for InstructionsHandler #444

Merged
core-lead merged 1 commits from fix/test-instructions-handler-coverage into staging 2026-05-11 09:52:20 +00:00

1 Commits

Author SHA1 Message Date
25ab35e907 test(handlers): add unit tests for InstructionsHandler (closes #415)
All checks were successful
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 12s
sop-tier-check / tier-check (pull_request) CI bypass: infra#241 Gitea runners cannot reach GitHub releases
audit-force-merge / audit (pull_request) Successful in 21s
Covers all five methods of InstructionsHandler: List, Create, Update,
Delete, and Resolve. Tests use sqlmock + httptest following the same
patterns as existing handler tests in the package.

Notable coverage:
- List: workspace_id scope, admin scope, no params, DB error
- Create: valid global + workspace, all validation failures (missing
  scope/title/content, invalid scope, workspace-nil-target,
  oversized content/title, nil scope_target for global)
- Update: partial + full-body, all validation failures, not-found,
  DB error
- Delete: found, not-found, DB error
- Resolve: global→workspace ordering, empty workspace, DB error,
  missing workspace_id, scope header deduplication
- scanInstructions: scan error is logged and skipped

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 09:15:47 +00:00