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.
Why traditional tests leave gaps
Section titled “Why traditional tests leave gaps”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.
The 5-stage verification pipeline
Section titled “The 5-stage verification pipeline”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"]
Stage 1: Generated File Hash Lock
Section titled “Stage 1: Generated File Hash Lock”- 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_FILEorERR_DELETED_GENERATED_FILE.
Stage 2: Hook Completeness Check
Section titled “Stage 2: Hook Completeness Check”- Inspects every custom
@mutationdeclared inspecs/<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).
Stage 3: Dart Static Analysis
Section titled “Stage 3: Dart Static Analysis”- Runs
dart analyzeacrossspecs/,hooks/,client/, and generated backend code. - Ensures zero compile errors, type mismatches, or deprecated API usages.
Stage 4: Dynamic Invariant Suite
Section titled “Stage 4: Dynamic Invariant Suite”- Automatically generates test cases for every
@validatebound:- Tests edge values:
min,max,min - 1,max + 1. - Verifies that boundary violations throw expected validation errors on both client and server.
- Tests edge values:
- Exhaustively tests the State Machine Transition Matrix:
- Every allowed transition must succeed.
- Every forbidden transition must be rejected.
- Role-based transition guards are verified.
Stage 5: Server Integration Suite
Section titled “Stage 5: Server Integration Suite”- 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:
- Anonymous caller: Confirms private endpoints reject unauthenticated requests, and
@publicendpoints respond. - Customer caller: Confirms row-level CEL policies isolate rows and prevent reading other customers’ data.
- Admin caller: Confirms elevated permissions and administrative mutations execute correctly.
- Anonymous caller: Confirms private endpoints reject unauthenticated requests, and
Verification statuses
Section titled “Verification statuses”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. |
Selective stage execution (--only)
Section titled “Selective stage execution (--only)”For fast local development iterations, you can run specific stages:
aegil verify --only hash_lock,hooks,analyzeAgent mode (--agent)
Section titled “Agent mode (--agent)”When running with AI coding agents or in CI/CD pipelines, pass the --agent flag:
aegil verify --project . --agentAegil 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 could go wrong?
Section titled “What could go wrong?”| 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. |
Next steps
Section titled “Next steps”- Review CLI Commands & Options Reference.
- Review Verification Check Kinds Reference.
- Review Error Codes Reference.