Files
keyhunter/.planning/phases/08-dork-engine/08-07-PLAN.md
2026-04-06 00:13:13 +03:00

4.9 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
phase plan type wave depends_on files_modified autonomous requirements must_haves
08-dork-engine 07 execute 3
08-02
08-03
08-04
08-06
pkg/dorks/count_test.go
true
DORK-02
truths artifacts key_links
A guardrail test asserts pkg/dorks.NewRegistry() loads >= 150 dorks
Per-source minimums enforced: github>=50, google>=30, shodan>=20, censys>=15, zoomeye>=10, fofa>=10, gitlab>=10, bing>=5
All 8 sources present in Stats().BySource
All 5 categories present in Stats().ByCategory
All dork IDs are unique (no collisions between source files)
path provides contains
pkg/dorks/count_test.go Guardrail test preventing regression below 150-dork threshold TestDorkCountGuardrail
from to via pattern
pkg/dorks/count_test.go pkg/dorks.NewRegistry() direct call to real embedded FS NewRegistry()
Lock in the DORK-02 "150+ built-in dorks" requirement with a guardrail test that runs against the real embedded filesystem. If a future contributor removes a dork file or breaks a source's YAML, CI fails loudly instead of silently dropping coverage. Also asserts per-source minimums and ID uniqueness so partial regressions are caught.

Purpose: Prevents silent regression of the requirement that took plans 02-04 to satisfy. Output: One test file with a few targeted assertions.

<execution_context> @$HOME/.claude/get-shit-done/workflows/execute-plan.md @$HOME/.claude/get-shit-done/templates/summary.md </execution_context>

@.planning/phases/08-dork-engine/08-CONTEXT.md @pkg/dorks/registry.go Task 1: Dork count + uniqueness guardrail test pkg/dorks/count_test.go - TestDorkCountGuardrail: NewRegistry() returns >= 150 dorks total - TestDorkCountPerSource: each of the 8 sources meets its minimum - TestDorkCategoriesPresent: all 5 categories appear in Stats().ByCategory - TestDorkIDsUnique: walking Registry.List(), no duplicate IDs Create pkg/dorks/count_test.go:
```go
package dorks

import "testing"

func TestDorkCountGuardrail(t *testing.T) {
    r, err := NewRegistry()
    if err != nil {
        t.Fatalf("NewRegistry: %v", err)
    }
    const minTotal = 150
    if got := len(r.List()); got < minTotal {
        t.Fatalf("dork count regression: got %d, want >= %d (see DORK-02)", got, minTotal)
    }
}

func TestDorkCountPerSource(t *testing.T) {
    r, err := NewRegistry()
    if err != nil { t.Fatal(err) }

    minimums := map[string]int{
        "github":  50,
        "google":  30,
        "shodan":  20,
        "censys":  15,
        "zoomeye": 10,
        "fofa":    10,
        "gitlab":  10,
        "bing":    5,
    }
    stats := r.Stats()
    for src, min := range minimums {
        if stats.BySource[src] < min {
            t.Errorf("source %s: got %d, want >= %d", src, stats.BySource[src], min)
        }
    }
}

func TestDorkCategoriesPresent(t *testing.T) {
    r, err := NewRegistry()
    if err != nil { t.Fatal(err) }
    required := []string{"frontier", "specialized", "infrastructure", "emerging", "enterprise"}
    stats := r.Stats()
    for _, c := range required {
        if stats.ByCategory[c] == 0 {
            t.Errorf("category %q missing", c)
        }
    }
}

func TestDorkIDsUnique(t *testing.T) {
    r, err := NewRegistry()
    if err != nil { t.Fatal(err) }
    seen := map[string]string{}
    for _, d := range r.List() {
        if existing, ok := seen[d.ID]; ok {
            t.Errorf("duplicate dork id %q (second occurrence: %s, first: %s)", d.ID, d.Source, existing)
        }
        seen[d.ID] = d.Source
    }
}
```

Note: Stats struct was defined in 08-01 with BySource and ByCategory
map[string]int fields — confirm the exact field names match. If the
implementation used different names, align test accordingly (do not
modify 08-01; adjust the test).
cd /home/salva/Documents/apikey && go test ./pkg/dorks/ -run 'TestDork(Count|Categories|IDs)' -v All four guardrail tests pass against the real embedded filesystem. The DORK-02 150+ floor is now CI-enforced. `go test ./pkg/dorks/...` passes (full suite). `go test ./...` for the repo passes.

<success_criteria>

  • DORK-02 enforced by test (not just counted by grep)
  • Per-source minimums match the 50/30/20/15/10/10/10/5 distribution
  • No duplicate dork IDs across the embedded corpus </success_criteria>
After completion, create `.planning/phases/08-dork-engine/08-07-SUMMARY.md`