Skip to content
full-stack-pluginsPublic

About

Test plans, behavior contracts, and regression evidence guard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

TestGuard

English · 简体中文

TestGuard validates whether the required behavior was actually tested — not merely whether a test command exited with code 0.

Status: real explicitly authorized Maven/Cargo execution, signed current-input verification, read-only MCP and imported JUnit checks are implemented. See execution contract and validation. Coverage, additional runners and merge authorization remain planned.

What TestGuard does

A frozen test plan maps approved SpecGuard acceptance criteria and ArchGuard domain invariants to required tests and environments. Native executors (JUnit/Maven/Gradle, Cargo, Vitest/Jest and Playwright) produce raw evidence, which TestGuard normalizes into execution status, observed behavior and coverage against the pre-approved plan. The common GuardEngine evaluates versioned contracts and evidence.

Approved acceptance / domain invariants / change scope
                         ↓
                  Frozen Test Plan
                         ↓
                  Native Test Runners
                         ↓
            Results + Coverage + Provenance
                         ↓
             TestGuard checks → GuardEngine
                         ↓
             CI / FlowGuard stage decision

A zero-test run, skipped mandatory case, missing report, stale candidate or unauthorized test reduction must not be mapped to PASS. Coverage percentage does not prove functional correctness; flaky retries must retain prior failures. TestGuard never creates merge authorization; only trusted branch protections can enforce merge requirements.

Responsibility and other Guards

SpecGuard defines what must be accepted; ArchGuard defines domain invariant checks; CodeGuard owns static quality; TestGuard owns test-plan adequacy and execution evidence; GitGuard handles candidate/branch safety; FlowGuard checks lifecycle approvals. GuardEngine provides a common contract, rule and evidence protocol. Each product remains independently installable when implemented.

Documents

Implemented: verify imported JUnit evidence

testguard verify-junit --plan /absolute/plan.json --report /absolute/TEST-Example.xml --candidate aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

The explicit plan has exactly these fields (replace the digest with the independently preserved report SHA-256):

{
  "schema_version": "testguard.junit-plan.v1",
  "candidate": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "report_sha256": "<64 lowercase hexadecimal characters>",
  "required_tests": ["Example#accepts"]
}

The adapter reads testcase nodes, reconciles suite/aggregate counts and blocks zero tests, failed/skipped/notrun cases, missing required IDs, duplicates, retained retry failures, digest changes and candidate drift. Unsupported XML structures, DTD, invalid/unknown plan fields and files over 4 MiB are errors. XML depth is capped at 16 elements before recursive parsing; DOM nodes are capped at 100,000. XML must be UTF-8; a testsuite must have tests/failures/errors/skipped counters. This intentionally strict subset may reject other JUnit dialects.

Metadata is also validated: system-out / system-err accept only text or CDATA; properties accepts only unnamespaced property children with text/CDATA values. Nested failure, skipped, retry or unknown result elements cannot hide inside these containers. Extra dialect attributes such as disabled / result are not interpreted as execution status; this subset does not establish their semantics or verify execution. See repair verification.

Exit 0 means consistent_untrusted; 2 means blocked; 4 means input error. Every result has execution_verified: false. Neither exit 0 nor a report and plan edited together prove actual test execution, trusted provenance, fresh execution, authorized requirements or merge approval. The candidate is an explicit caller-provided immutable ID; this command does not resolve Git refs or inspect a checkout. No project test commands are executed.

serve --mcp exposes testguard_verify_junit with the same plan, report, candidate inputs and checks. The plugin skill documents these boundaries; host loading is not verified here.

Validation: cargo test --locked --offline exercises the real CLI/MCP processes with adversarial XML fixtures. These are adapter tests, not claims that Maven or Cargo ran tests in a business project.

Execution CLI (implemented)

testguard keygen --private /outside/private.key --public /outside/public.key
testguard run --project /isolated/project --plan /approved/plan.json --output /outside/new-run --executable /tools/mvn --execute --private-key /outside/private.key
testguard verify --project /isolated/project --plan /approved/plan.json --receipt /outside/new-run/receipt.json --public-key /outside/public.key

The execution plan binds task_id, runner, required_tests and timeout_seconds under schema testguard.execution-plan/v1. Full contract, Windows setup and trust boundaries. MCP only verifies; it never executes tests. Local signing establishes integrity relative to an explicit public key, not approval or sandboxing.

Agent installation and managed instructions

The shared installer provides install, uninstall, context, instructions render|sync, doctor --integration, and serve --mcp for Codex, Claude Code, and Gemini CLI. Each tool renders its own managed block.

cargo build --locked
testguard install --agents codex,claude,gemini --project /absolute/project --bin-dir /absolute/bin --dry-run
testguard context --project /absolute/project

After building, invoke the executable under target/debug/ (with .exe on Windows); short commands above assume PATH is configured. --bin-dir copies the current executable; PATH is not changed automatically. Remove --dry-run to apply. A sibling ../guardengine/crates/guard-install source checkout is required.

Shared design, host mapping, update/uninstall and verification. Configuration success does not prove host loading or quality approval.

About

Test plans, behavior contracts, and regression evidence guard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages