mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 18:01:37 +00:00
370b772fbd
internal/ciparity/ — new stdlib-only package with four tests: 1. TestSurfaceParity_MCPToolCatalogue (HARD GATE): - Every MCP tool name conforms to certctl_<word>(_<word>)* - No duplicate names across the five tools*.go files - Total tools ≥ mcpBaselineFloor (150; current count 155) Catches accidental tool deletions + naming-convention drift. 2. TestSurfaceParity_CLICommandCatalogue (INFORMATIONAL): Walks cmd/cli/main.go's switch-case dispatcher. Logs the 31 distinct verbs. Per frozen decision 0.9, warn-only until the CLI surface stabilizes. 3. TestSurfaceParity_OpenAPI_MCPHeuristicCoverage (INFORMATIONAL): Reports the fraction of OpenAPI ops whose path tokens overlap with MCP tool name tokens. Trend metric; current coverage 92%. 4. TestSurfaceParity_Summary (INFORMATIONAL): One-glance count of router routes / OpenAPI ops / MCP tools / CLI verbs. Easy eyeball for a PR reviewer. Verified in sandbox: - gofmt clean - go vet clean - go test -short -count=1: all four PASS in 0.017s Stdlib-only by design — the tests read source files with os.ReadFile + regexp + go/ast. Keeps the test runnable without pulling in the rest of the codebase's transitive deps; fast self-contained signal. Router ↔ OpenAPI parity (TestRouter_OpenAPIParity) stays in internal/api/router/openapi_parity_test.go where it already lives. This bundle does not duplicate it. Allowlist scaffold at scripts/ci-guards/surface-parity-mcp-exemptions.yaml for the day TestSurfaceParity_OpenAPI_MCP* is promoted from informational to hard gate. Audit-Closes: post-v2.1.0-anti-rot/item-2
21 lines
1.0 KiB
Go
21 lines
1.0 KiB
Go
// Package ciparity hosts cross-surface contract-parity tests.
|
|
//
|
|
// Per post-v2.1.0 anti-rot item 2 (Auditable Codebase Bundle), this
|
|
// package contains tests that walk source files (router.go,
|
|
// openapi.yaml, the MCP tools*.go catalogue, cmd/cli/main.go) and
|
|
// assert invariants ACROSS those surfaces — e.g. "every MCP tool
|
|
// follows the canonical naming convention" or "the MCP tool count
|
|
// does not regress below the documented floor."
|
|
//
|
|
// The package is stdlib-only by design: the tests read source files
|
|
// with os.ReadFile and parse them with regexp + go/ast. This keeps
|
|
// the test runnable without pulling in the rest of the codebase's
|
|
// transitive dependencies — a developer running `go test ./internal/ciparity/...`
|
|
// gets a fast, self-contained signal.
|
|
//
|
|
// The router ↔ openapi.yaml parity test lives separately in
|
|
// internal/api/router/openapi_parity_test.go (TestRouter_OpenAPIParity)
|
|
// because it predates this package and operates on the same AST that
|
|
// TestRouterRBACGateCoverage already needs. Don't duplicate it here.
|
|
package ciparity
|