Initial public release of Apophis — invariant-driven automated API testing
This commit is contained in:
@@ -4,6 +4,8 @@ Behavioral confidence for Fastify services.
|
||||
|
||||
APOPHIS checks whether route behavior holds across operations, states, and protocol flows.
|
||||
|
||||
Inspired by [Invariant-Driven Automated Testing](https://arxiv.org/abs/2602.23922) (Malhado Ribeiro, 2021): instead of only checking payload shape, APOPHIS encodes intended behavior as executable contracts and verifies them with property-based and stateful testing.
|
||||
|
||||
Supported Node.js versions: 20.x and 22.x.
|
||||
|
||||
```bash
|
||||
@@ -12,6 +14,8 @@ apophis init --preset safe-ci
|
||||
apophis verify --profile quick --routes "POST /users"
|
||||
```
|
||||
|
||||
`x-ensures` is an OpenAPI schema extension for behavioral contracts — statements about what a route must guarantee.
|
||||
|
||||
## Cross-Route Failure Example
|
||||
|
||||
Add one behavioral contract next to a route schema. APOPHIS can verify cross-route behavior, such as whether a resource created by one route is retrievable through another.
|
||||
@@ -19,6 +23,8 @@ Add one behavioral contract next to a route schema. APOPHIS can verify cross-rou
|
||||
**Route:**
|
||||
|
||||
```javascript
|
||||
import crypto from 'crypto';
|
||||
|
||||
app.post('/users', {
|
||||
schema: {
|
||||
'x-category': 'constructor',
|
||||
@@ -29,7 +35,7 @@ app.post('/users', {
|
||||
}
|
||||
}, async (request, reply) => {
|
||||
const { name } = request.body;
|
||||
const id = `usr-${Date.now()}`;
|
||||
const id = `usr-${crypto.createHash('sha256').update(name).digest('hex').slice(0, 8)}`;
|
||||
reply.status(201);
|
||||
return { id, name };
|
||||
});
|
||||
@@ -47,7 +53,7 @@ Expected
|
||||
response_code(GET /users/{response_body(this).id}) == 200
|
||||
|
||||
Observed
|
||||
GET /users/usr-123 returned 404
|
||||
GET /users/usr-7d865e returned 404
|
||||
|
||||
Why this matters
|
||||
The resource created by POST /users is not retrievable.
|
||||
@@ -80,6 +86,9 @@ apophis init --preset safe-ci
|
||||
|
||||
# 3. Verify
|
||||
apophis verify --profile quick --routes "POST /users"
|
||||
|
||||
# 4. Doctor
|
||||
apophis doctor
|
||||
```
|
||||
|
||||
See [docs/getting-started.md](docs/getting-started.md) for the full walkthrough.
|
||||
@@ -87,9 +96,12 @@ See [docs/getting-started.md](docs/getting-started.md) for the full walkthrough.
|
||||
## Trust and Safety
|
||||
|
||||
- **Deterministic replay**: Every failure includes a seed and a one-command replay.
|
||||
- **Explicit test budget**: Control how many tests run with `runs: 10` in your preset.
|
||||
- **CI-safe default path**: `verify` is deterministic and safe for CI pipelines.
|
||||
- **Machine-readable output**: `--format json-summary` and `--format ndjson-summary` for CI dashboards.
|
||||
- **Production-safe observe path**: `observe` is non-blocking by default. Blocking behavior requires explicit break-glass policy.
|
||||
- **Qualify path gated away from prod**: `qualify` is blocked in production by default.
|
||||
- **Monorepo workspace support**: `--workspace` fans out `verify` and `doctor` across all packages.
|
||||
- **Explicit environment boundaries**: Config rejects unknown keys and unsafe environment mixes.
|
||||
|
||||
## LLM-Safe
|
||||
@@ -110,10 +122,11 @@ See [docs/llm-safe-adoption.md](docs/llm-safe-adoption.md) for templates and CI
|
||||
- [Verify Mode](docs/verify.md) — Deterministic contract verification
|
||||
- [Observe Mode](docs/observe.md) — Runtime visibility and drift detection
|
||||
- [Qualify Mode](docs/qualify.md) — Scenarios, stateful testing, chaos
|
||||
- [Quality Engines](docs/quality.md) — Chaos injection, flake detection, mutation testing
|
||||
- [Performance](docs/performance.md) — Repeatable benchmarks and CPU profiling
|
||||
- [LLM-Safe Adoption](docs/llm-safe-adoption.md) — Scaffolds and CI guards
|
||||
- [Protocol Extensions](docs/protocol-extensions-spec.md) — JWT, X.509, SPIFFE, WIMSE
|
||||
- [Protocol Extensions](docs/attic/protocol-extensions-spec.md) — JWT, X.509, SPIFFE, WIMSE
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
MIT
|
||||
|
||||
Reference in New Issue
Block a user