Skip to content
VerificationWould you notice if your agent drifted in production?Explore the 5-stage harness›
Development & CLI

5-Stage Verification Harness

The aegil verify command executes an automated five-stage verification harness designed to prove application correctness. By testing static integrity, hook completeness, boundary constraints, state machine transitions, and live PostgreSQL database integration, the harness mathematically proves that the full-stack system satisfies all declared invariants.

In conventional development, testing full-stack applications is difficult:

  • Unit tests mock the database, hiding subtle SQL type mismatches or foreign-key violations.
  • Integration tests are slow and brittle to set up, so developers often skip them.
  • Manual testing cannot exhaustively check every allowed and forbidden state transition in complex workflows.

Aegil solves this by compiling an Automated Invariant and Integration Harness alongside your code. Whenever you run aegil verify, the harness executes five automated checks.


flowchart TD
  Start["aegil verify"] --> S1["[1/5] Hash Lock Verification\nChecks .aegil/manifest.json checksums"]
  S1 --> S2["[2/5] Hook Completeness Check\nConfirms all @mutation tasks have hooks"]
  S2 --> S3["[3/5] Dart Static Analysis\nRuns dart analyze across server, client, hooks"]
  S3 --> S4["[4/5] Dynamic Invariant Suite\nTests min/max bounds & state transitions"]
  S4 --> S5["[5/5] Server Integration Suite\nRuns endpoints against throwaway Docker Postgres"]
  S5 --> Verified["Status: VERIFIED"]
  • Computes FNV-1a checksums for every file recorded in .aegil/manifest.json.
  • Guarantees that neither human developers nor AI agents modified files inside .aegil/ by hand.
  • Catches ERR_TAMPERED_GENERATED_FILE or ERR_DELETED_GENERATED_FILE.
  • Inspects every custom @mutation declared in specs/<feature>/*.tsp.
  • Confirms that a corresponding handler class exists in hooks/ and is registered with the server.
  • Prevents unfinished tasks from slipping into production (ERR_MISSING_HOOK_IMPLEMENTATION).
  • Runs dart analyze across specs/, hooks/, client/, and generated backend code.
  • Ensures zero compile errors, type mismatches, or deprecated API usages.
  • Automatically generates test cases for every @validate bound:
    • Tests edge values: min, max, min - 1, max + 1.
    • Verifies that boundary violations throw expected validation errors on both client and server.
  • Exhaustively tests the State Machine Transition Matrix:
    • Every allowed transition must succeed.
    • Every forbidden transition must be rejected.
    • Role-based transition guards are verified.
  • Automatically starts a throwaway PostgreSQL container in Docker.
  • Applies database migrations and seeds initial test data.
  • Executes real endpoint calls using three distinct caller personas:
    1. Anonymous caller: Confirms private endpoints reject unauthenticated requests, and @public endpoints respond.
    2. Customer caller: Confirms row-level CEL policies isolate rows and prevent reading other customers’ data.
    3. Admin caller: Confirms elevated permissions and administrative mutations execute correctly.

When aegil verify completes, it reports one of three statuses:

Status Meaning Acceptable for Completion?
VERIFIED All 5 stages passed against real PostgreSQL. Yes. The app is verified and ready.
VERIFIED_PARTIAL Stages 1–4 passed, but Stage 5 was skipped (e.g. --skip-integration). No. Integration tests were not executed.
UNAVAILABLE Docker was not running or integration failed. No. Must start Docker and resolve the failure.

For fast local development iterations, you can run specific stages:

Terminal window
aegil verify --only hash_lock,hooks,analyze

When running with AI coding agents or in CI/CD pipelines, pass the --agent flag:

Terminal window
aegil verify --project . --agent

Aegil returns machine-readable JSON on stdout:

{
"status": "VERIFIED",
"project": ".",
"timestamp": "2026-11-23T12:00:00Z",
"stages": {
"hashLock": "PASSED",
"hookCompleteness": "PASSED",
"staticAnalysis": "PASSED",
"dynamicInvariants": "PASSED",
"serverIntegration": "PASSED"
}
}

What you see Why What to do
Status: UNAVAILABLE Docker is not running or failed to start the test Postgres container. Start Docker Desktop or daemon and re-run aegil verify.
Status: VERIFIED_PARTIAL Verification was run with --skip-integration. Run aegil verify without --skip-integration to execute database tests.
ERR_STALE_BUILD The specs or hooks were edited since the last build. Run aegil build first, then run aegil verify.