Drift detection for any rename, removal, or miscount across Tier 3-9
All future phases that modify pkg/providers/definitions/*.yaml
added
patterns
Table-driven guardrail tests (per-tier count + per-tier name slice)
Inherited cross-tier invariants via existing TestAllPatternsCompile / TestAllProvidersHaveKeywords
created
modified
pkg/providers/tier39_test.go
Single guardrail file for Tier 3-9 (mirrors tier12_test.go) — simpler than one file per tier
Reuse existing TestAllPatternsCompile and TestAllProvidersHaveKeywords rather than duplicating — they already iterate reg.List() and cover every loaded provider
Per-tier Count tests kept separate (not table-driven) to produce clear per-tier failure messages in CI
duration
completed
tasks
files_created
files_modified
~2 min
2026-04-05
1
1
0
Phase 03 Plan 08: Tier 3-9 Guardrail Tests Summary
Added pkg/providers/tier39_test.go — a guardrail test file that locks the provider registry at exactly 108 entries (26 Tier 1-2 + 82 Tier 3-9), enforces per-tier counts, and pins every Tier 3-9 provider name so future edits cannot silently drop or rename providers without a CI failure.
What Was Built
pkg/providers/tier39_test.go mirrors the tier12_test.go pattern and contains 11 test functions:
TestTier39ProviderNames — table-driven; for each of 82 names in expectedTier3..expectedTier9, calls reg.Get(name) and verifies the returned Provider.Tier matches the expected tier
Regex compilation (RE2) and keyword presence (≥1 per provider, required for the Aho-Corasick pre-filter) are already exercised globally by the pre-existing TestAllPatternsCompile and TestAllProvidersHaveKeywords in tier12_test.go, which iterate reg.List() and therefore automatically cover every newly added Tier 3-9 provider. No duplication needed.
Verification
go test ./pkg/providers/... -count=1 -v -run 'TestTier[3-9]|TestTotalProviderCount|TestTier39ProviderNames|TestAllPatternsCompile|TestAllProvidersHaveKeywords'
All 11 Tier 3-9 tests plus the two inherited invariant tests pass. Full repo regression:
go test ./... -count=1
ok github.com/salvacybersec/keyhunter/pkg/engine 0.248s
ok github.com/salvacybersec/keyhunter/pkg/providers 0.934s
ok github.com/salvacybersec/keyhunter/pkg/storage 0.117s
Phase 1/2 guardrails (TestTier1Count, TestTier2Count, TestTier1ProviderNames, TestTier2ProviderNames) still green — no regression.