test(approvals): 100% coverage for IsGated policy #2829
Reference in New Issue
Block a user
Delete Branch "test/approvals-policy-coverage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds table-driven unit tests for
approvals.IsGated, covering all canonical gated/ungated actions plus unknown/empty inputs.workspace-server/internal/approvalsgo test -cover ./internal/approvals→ PASS, 100.0% coveragePart of the coverage-gap initiative. No open PR touches this package.
🤖 Generated with Claude Code
APPROVED on head
8918c1d8.CI case: Platform Go is clean-green for the blocking gate on the matching head. Job 496234 ran for 2m29s on 8918c1d8; checkout/setup/go mod/build/vet/golangci-lint, the blocking tests-with-coverage step, per-file coverage, and coverage thresholds all succeeded. The race-detection step failed, but it is advisory/non-blocking and matches the known repo-wide cap-and-queue flake class rather than anything in this test-only approvals change.
The test coverage is sound.
TestIsGateddirectly exercises both gated actions, representative exported non-gated actions, unknown input, and empty input against the real policy map.TestGatedActionsis a small drift guard for the canonical gated constants. No production code, schema, security, performance, or readability concerns.APPROVE on head
8918c1d8d0.Verified this is test-only and scoped to workspace-server/internal/approvals/policy_test.go. The table covers both currently gated actions, both currently ungated actions, and the default false behavior for unknown and empty actions. Platform Go job 496234 is success on the matching head.