Improve Go SDK test coverage: audit trail and LLM fallback paths #23

Open
opened 2026-04-20 09:37:18 +00:00 by sharang · 0 comments
Owner

Problem

ai-compliance-sdk has handler and service code but sparse test coverage:

  • Audit trail validation logic has no table-driven tests
  • LLM fallback path (when primary model is unavailable) is untested
  • CI reports coverage but no gate enforces the 80% target in service/

Required Actions

  1. Add table-driven tests for audit trail service: internal/service/audit/audit_service_test.go
  2. Add tests for LLM provider fallback: mock primary as unavailable, assert secondary is tried
  3. Add go test -coverprofile=coverage.out ./... gate: fail CI if coverage drops below 80% on internal/service/
  4. Ensure handler tests use httptest.NewRecorder per AGENTS.go.md

Acceptance Criteria

  • go tool cover -func=coverage.out shows ≥80% on internal/service/
  • CI fails on coverage regression
  • At least 5 new table-driven test cases added
## Problem `ai-compliance-sdk` has handler and service code but sparse test coverage: - Audit trail validation logic has no table-driven tests - LLM fallback path (when primary model is unavailable) is untested - CI reports coverage but no gate enforces the 80% target in `service/` ## Required Actions 1. Add table-driven tests for audit trail service: `internal/service/audit/audit_service_test.go` 2. Add tests for LLM provider fallback: mock primary as unavailable, assert secondary is tried 3. Add `go test -coverprofile=coverage.out ./...` gate: fail CI if coverage drops below 80% on `internal/service/` 4. Ensure handler tests use `httptest.NewRecorder` per AGENTS.go.md ## Acceptance Criteria - `go tool cover -func=coverage.out` shows ≥80% on `internal/service/` - CI fails on coverage regression - At least 5 new table-driven test cases added
sharang added this to the M4: Testing & Contract Stability milestone 2026-04-20 09:37:18 +00:00
sharang added the testingseverity: medium labels 2026-04-20 09:37:18 +00:00
Sign in to join this conversation.