Skip to content

test(server): RPC-iterating drift guard for the gRPC surface (done-bar §4)#48

Merged
mastermanas805 merged 1 commit into
masterfrom
test/grpc-rpc-coverage-guard
Jun 4, 2026
Merged

test(server): RPC-iterating drift guard for the gRPC surface (done-bar §4)#48
mastermanas805 merged 1 commit into
masterfrom
test/grpc-rpc-coverage-guard

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

What

Adds TestGRPCSurface_EveryRPCHasRoundTripTest (internal/server/server_rpc_coverage_guard_test.go) — the registry/RPC-iterating done-bar guard (rule 18) for the provisioner gRPC surface, per docs/sessions/2026-06-04/USER-FLOW-INVENTORY-AND-TEST-MATRIX.md §4.

It iterates the proto-generated ProvisionerService_ServiceDesc.Methods (the single source of truth for which RPCs exist) and fails CI if any RPC lacks a maintained, existing real-backend round-trip test.

Why

Integration coverage is already strong (internal/server 99.2% after #47), and all four RPCs — ProvisionResource, DeprovisionResource, GetStorageBytes, RegradeResource — have real round-trip tests. But that's a snapshot: adding a new RPC to proto/provisioner/v1/provisioner.proto would not red the round-trip suite, so it could ship with zero real-backend coverage, silently (the silent-untested-RPC class).

This guard closes that hole. It reds on:

  • a new RPC with no rpcCoverage entry (unmapped),
  • a mapping pointing at a deleted/renamed test (the test names are source-parsed via go/ast, so a mapped name must actually exist), or
  • a stale mapping/exemption for an RPC removed from the proto.

Design

Pure descriptor + source-scan test — no backends, no env, never skips. It runs unconditionally in the go test -short deploy gate (a drift guard that can skip is useless). Does not touch the NATS-via-docker-run coverage workflow.

Exemptions require both an exemptedRPCs entry and a justification row in INTEGRATION-COVERAGE-EXCLUSIONS.md (none today — every RPC has a real round-trip).

Verification

  • RPCs enumerated from descriptor: ProvisionResource, DeprovisionResource, GetStorageBytes, RegradeResource — all four mapped to existing round-trip tests.
  • Failing-then-passing confirmed: dropping the RegradeResource mapping reds with "exists in ServiceDesc but has NO entry in rpcCoverage"; renaming a mapped test to a nonexistent name reds with "no such test function exists"; restore passes.
  • make gate GREEN.
  • golangci-lint run on the new file: 0 issues.

🤖 Generated with Claude Code

…r §4)

Add TestGRPCSurface_EveryRPCHasRoundTripTest — the registry-iterating done-bar
guard (rule 18) for the provisioner gRPC surface. It iterates the proto-generated
ProvisionerService_ServiceDesc.Methods (single source of truth for which RPCs
exist) and fails CI if any RPC lacks a maintained, existing real-backend
round-trip test.

Closes the silent-untested-RPC class: today's round-trip suite proves
ProvisionResource/DeprovisionResource/GetStorageBytes/RegradeResource are
exercised end-to-end, but adding a new RPC to the proto would not red that suite —
it would ship with zero real-backend coverage, silently. This guard reds on:
  - a new RPC with no rpcCoverage entry (unmapped),
  - a mapping pointing at a deleted/renamed test (source-parsed, so the name
    must really exist), or
  - a stale mapping/exemption for an RPC removed from the proto.

Pure descriptor + source-scan test: no backends, no env, never skips — runs
unconditionally in the `go test -short` deploy gate, as a drift guard must.
Exemptions require both an exemptedRPCs entry and a justification row in
INTEGRATION-COVERAGE-EXCLUSIONS.md (none today).

All 4 RPCs already have real round-trip tests; this test only guards against
future drift. make gate green; failing-then-passing verified (dropping a mapping
or renaming a mapped test reds it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 enabled auto-merge (squash) June 4, 2026 18:28
@mastermanas805 mastermanas805 merged commit 2743a0d into master Jun 4, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant