Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ __pycache__/
skills/verdict/bin
skills/verdict/.verdict-managed
.scratch/

# This repo commits its review controls; generated state stays ignored.
!.verdict/config.json
!.verdict/kb.jsonl
!.verdict/recipes.json
11 changes: 11 additions & 0 deletions .verdict/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"schema_version": "1",
"requirements": {
"block_clauses": [
{
"name": "open-important-or-above",
"threshold": "important"
}
]
}
}
50 changes: 50 additions & 0 deletions .verdict/kb.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{"id":"go-errors-01","rule":"Return `error` (static type) as the last value; never concrete error types.","scope":"*.go","provenance":"docs/go-rules.md GO-ERRORS-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-errors-03","rule":"`%w` only with a documented/tested inspection contract; `%v` seals boundaries.","scope":"*.go","provenance":"docs/go-rules.md GO-ERRORS-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-errors-04","rule":"Match errors with `errors.Is`/`As`, never `==` or message text.","scope":"*.go","provenance":"docs/go-rules.md GO-ERRORS-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-errors-06","rule":"Handle each error once: wrap up, log at the edge; advise only at the command layer.","scope":"*.go","provenance":"docs/go-rules.md GO-ERRORS-06","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-context-01","rule":"`ctx` is the first param; never store it in structs.","scope":"*.go","provenance":"docs/go-rules.md GO-CONTEXT-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-context-02","rule":"On `ctx.Done()`, stop and return `ctx.Err()`.","scope":"*.go","provenance":"docs/go-rules.md GO-CONTEXT-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-context-03","rule":"Carry request-scoped values with unexported keys only.","scope":"*.go","provenance":"docs/go-rules.md GO-CONTEXT-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-context-04","rule":"Do not smuggle loggers through context.","scope":"*.go","provenance":"docs/go-rules.md GO-CONTEXT-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-conc-01","rule":"Every goroutine has an exit path reviewable from its spawn site.","scope":"*.go","provenance":"docs/go-rules.md GO-CONC-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-conc-03","rule":"Channels move ownership; mutexes guard state; maps are never shared unsynchronized.","scope":"*.go","provenance":"docs/go-rules.md GO-CONC-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-conc-05","rule":"`WaitGroup.Add` before `go`, same frame.","scope":"*.go","provenance":"docs/go-rules.md GO-CONC-05","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-conc-06","rule":"Set `Cmd.WaitDelay` on every command with captured pipes.","scope":"*.go","provenance":"docs/go-rules.md GO-CONC-06","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-conc-07","rule":"`go test -race -shuffle=on -count=1 ./...` is green on 3 OSes.","scope":"*.go","provenance":"docs/go-rules.md GO-CONC-07","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-iface-04","rule":"No `*io.Reader`; comma-ok every type assertion.","scope":"*.go","provenance":"docs/go-rules.md GO-IFACE-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-collect-02","rule":"Copy collections at trust boundaries.","scope":"*.go","provenance":"docs/go-rules.md GO-COLLECT-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-defer-01","rule":"`defer` cleanup at the acquisition site.","scope":"*.go","provenance":"docs/go-rules.md GO-DEFER-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-defer-03","rule":"Never panic for ordinary errors; `recover` only at API edges with re-panic.","scope":"*.go","provenance":"docs/go-rules.md GO-DEFER-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-log-01","rule":"`slog` to stderr only; stdout is machine-parseable data.","scope":"*.go","provenance":"docs/go-rules.md GO-LOG-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-log-03","rule":"Never `Printf` a dynamic string.","scope":"*.go","provenance":"docs/go-rules.md GO-LOG-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-log-04","rule":"Secrets never reach logs; redact via `LogValue` + scrub helpers.","scope":"*.go","provenance":"docs/go-rules.md GO-LOG-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-test-07","rule":"Exact `Test/Fuzz/Benchmark/Example` signatures.","scope":"*.go","provenance":"docs/go-rules.md GO-TEST-07","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-api-04","rule":"Honest `go 1.N` floor; `vet:stdversion` clean.","scope":"*.go","provenance":"docs/go-rules.md GO-API-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-layout-02","rule":"`main` is thin: parse, `run()`, exit once; only `main` calls `os.Exit`.","scope":"*.go","provenance":"docs/go-rules.md GO-LAYOUT-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-mod-04","rule":"`govulncheck ./...` blocks on reachable vulns.","scope":"*.go","provenance":"docs/go-rules.md GO-MOD-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-cli-01","rule":"`--json` prints exactly one envelope to stdout; everything else to stderr.","scope":"*.go","provenance":"docs/go-rules.md GO-CLI-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-cli-03","rule":"No prompt without a TTY; `--yes`-or-fail otherwise.","scope":"*.go","provenance":"docs/go-rules.md GO-CLI-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-cli-05","rule":"Root ctx from `signal.NotifyContext`; cancel kills children, exits 3 + JSON envelope.","scope":"*.go","provenance":"docs/go-rules.md GO-CLI-05","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-exec-01","rule":"Kill process trees (pgid/Job Objects), never just the direct child.","scope":"*.go","provenance":"docs/go-rules.md GO-EXEC-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-exec-02","rule":"`exec.CommandContext` + `WaitDelay`; timeouts read from `ctx.Err()`, not `err`.","scope":"*.go","provenance":"docs/go-rules.md GO-EXEC-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-exec-03","rule":"No shell for agent-supplied commands; argv only — except verify's own verifyCmd, which runs through bash -c by design.","scope":"*.go","provenance":"docs/go-rules.md GO-EXEC-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-exec-04","rule":"Scrub the child environment with an allowlist — except the fixed gh/git argv, which inherits the developer environment by design (SECURITY.md).","scope":"*.go","provenance":"docs/go-rules.md GO-EXEC-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-exec-05","rule":"Bound child output; extract exit codes with ExitError.","scope":"*.go","provenance":"docs/go-rules.md GO-EXEC-05","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-json-01","rule":"Strict capped JSON entry (`DisallowUnknownFields`, `UseNumber`, size caps).","scope":"*.go","provenance":"docs/go-rules.md GO-JSON-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-json-02","rule":"Preserve unknown store fields via `RawMessage` maps, never struct round-trips.","scope":"*.go","provenance":"docs/go-rules.md GO-JSON-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-json-05","rule":"No `encoding/json/v2` or `jsontext` imports until stable.","scope":"*.go","provenance":"docs/go-rules.md GO-JSON-05","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-atomic-01","rule":"Stores: temp-file + fsync + rename + dir-fsync; never truncate in place.","scope":"*.go","provenance":"docs/go-rules.md GO-ATOMIC-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-fs-02","rule":"Secrets at `0600`; scratch via `MkdirTemp` + deferred cleanup.","scope":"*.go","provenance":"docs/go-rules.md GO-FS-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-fs-04","rule":"`filepath` for disk, `path` for URLs; never split separators by hand.","scope":"*.go","provenance":"docs/go-rules.md GO-FS-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-http-01","rule":"One hardened HTTP constructor; never `http.DefaultClient`/`Get`/`Post`.","scope":"*.go","provenance":"docs/go-rules.md GO-HTTP-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-http-02","rule":"Cap every response body (`LimitReader(N+1)`, abort past cap).","scope":"*.go","provenance":"docs/go-rules.md GO-HTTP-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-http-03","rule":"Retry idempotent methods only; honor `Retry-After`; jitter; ctx-cancellable.","scope":"*.go","provenance":"docs/go-rules.md GO-HTTP-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-obs-03","rule":"No network except configured code hosts; no telemetry.","scope":"*.go","provenance":"docs/go-rules.md GO-OBS-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-crypto-01","rule":"Stream hashes; constant-time secret comparison.","scope":"*.go","provenance":"docs/go-rules.md GO-CRYPTO-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-crypto-02","rule":"No SHA-1 outside the one wire-compat package (scoped lint exception, not-a-security-boundary doc, explicit FIPS stance); suite runs once under `GODEBUG=fips140=only`.","scope":"*.go","provenance":"docs/go-rules.md GO-CRYPTO-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-xplat-01","rule":"Windows runs in CI, not just cross-compiles.","scope":"*.go","provenance":"docs/go-rules.md GO-XPLAT-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-lint-01","rule":"Start from default:none-equivalent and enable explicitly.","scope":"*.go","provenance":"docs/go-rules.md GO-LINT-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-lint-02","rule":"Format with gofumpt + gci; never goimports alongside gci.","scope":"*.go","provenance":"docs/go-rules.md GO-LINT-02","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-ci-01","rule":"Matrix OS × Go, keep -race green, fail on new lint issues.","scope":"*.go","provenance":"docs/go-rules.md GO-CI-01","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-ci-03","rule":"One workflow: lint, vet, test-matrix, vuln, fuzz, build, tag-release.","scope":"*.go","provenance":"docs/go-rules.md GO-CI-03","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
{"id":"go-ci-04","rule":"Releases via goreleaser: signed SBOMs + cosign bundles.","scope":"*.go","provenance":"docs/go-rules.md GO-CI-04","rigor":"said","hits":0,"false_hits":0,"judged":0,"status":"active"}
10 changes: 10 additions & 0 deletions .verdict/recipes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"schema_version": "1",
"recipes": {
"default": {
"version": "1.0.0",
"lenses": [{ "id": "api-contract" }, { "id": "perf" }, { "id": "test" }],
"synthesize": {}
}
}
}
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,26 @@ Two rules no ladder rung covers live in
ban and test determinism (poll with `testenv.Until`; a timed-out test has a
race to fix, never a timeout to raise).

## Reviewing this repo with verdict

This repo commits three review controls: `.verdict/config.json` (the
`important` block clause), `.verdict/kb.jsonl` (the MUST rules from
[`docs/go-rules.md`](docs/go-rules.md)), and `.verdict/recipes.json` (the
`default` lens pipeline). Fetch and run read them from the PR base, so a
change to a control takes effect on the next review after it lands. For a
local bundle, run `make build`, then with local changes in the tree
`bin/verdict fetch-local stainless-code/verdict self` (add `--staged` to
review the index). Both read the controls from `HEAD`;
`bin/verdict run stainless-code/verdict local-self --agent claude --recipe default --print`
shows the declared pipeline without launching an agent.

Refresh the KB with the verb, never by editing the JSONL. After the MUST
rules change, append each new rule with
`bin/verdict learn --rule "<statement>" --scope "**/*.go" --provenance "docs/go-rules.md <GO-ID>" --id <lowercase-id> --rigor said`,
check it with `bin/verdict learn --status`, retire an obsolete rule with
`bin/verdict learn --retire <id> --reason "<30+ chars>"`, and commit
`.verdict/kb.jsonl` with the rules change so the next base carries it.

## Golden tests

Golden files under `testdata/` are the contract: if your change
Expand Down
Loading