5.1 KiB
15 — Test strategy
Build-pack contract test
Before application tests, run python3 scripts/validate_pack.py. It validates all nine JSON Schemas, 28 P0 runtime packages, six normative examples, the 72-entry catalog, package inventories, evaluation references, canonical fixture digests, required OpenAPI coverage, reference SQL tables, internal documentation references, secret-like files and 28 golden rendered prompts against the executable reference composer. CI must run the same script without a reduced local variant.
Test pyramid
Unit tests
Fast deterministic tests for:
- schema semantic rules;
- canonicalization and digests;
- autonomy range and policy precedence;
- compatibility resolution;
- scope merging;
- prompt block rendering;
- byte-identical golden prompt conformance for all 28 P0 examples;
- linter rules;
- redaction;
- path/archive safety;
- finding rules;
- authorization policies.
Integration tests
Use a real disposable PostgreSQL instance for:
- migrations;
- immutable version enforcement;
- idempotent imports;
- full-text search and filters;
- profile revisioning;
- run generation transactions;
- job leasing/retry;
- artifact metadata;
- cross-workspace authorization.
Use a controlled fake HTTP Gitea server and optional real-version compatibility environment for:
- pagination;
- permission differences;
- rate limits;
- version/capability detection;
- timeouts and errors;
- redirect/SSRF controls;
- content-size enforcement.
Contract tests
- OpenAPI schema matches route behavior;
- Playbook Package examples validate against published JSON Schema;
- Run Pack manifest round-trip;
- repository-profile export/import round-trip;
- Gitea adapter normalized contract.
Browser tests
Critical Playwright flows:
- browse, search and filter library;
- open playbook and start composition;
- create manual repository profile;
- compose with profile and protected path;
- resolve linter error;
- generate immutable run;
- copy and export Markdown;
- generate and verify Run Pack;
- import private playbook draft;
- configure fake Gitea, import repository snapshot and open recommendation;
- theme, keyboard navigation and reduced-motion behavior;
- permission boundary in future multi-user fixture.
Visual verification
Use stable screenshots for selected high-value states, not every component. Verify:
- command center;
- library in both card and dense modes;
- playbook detail;
- composer at desktop, laptop and narrow widths;
- repository workspace;
- Prompt Lab diff;
- dark and light themes;
- error/degraded states.
Visual snapshots do not replace semantic browser assertions.
Fixture strategy
Package fixtures
- minimal valid quick playbook;
- full guided playbook;
- run-pack playbook;
- unknown template variable;
- autonomy range error;
- malicious archive path;
- symlink package;
- secret-like template value;
- duplicate semantic version with changed digest.
Repository-profile fixtures
- TypeScript monorepo;
- .NET service;
- Python application;
- Docker/Unraid self-hosted app;
- mixed repository with conflicting package managers;
- profile missing test command;
- protected runtime data directory.
Gitea fixtures
- full permissions;
- limited permissions;
- old/limited capability response;
- rate limited;
- unreachable;
- private HTTP explicitly permitted;
- malicious redirect;
- oversized file;
- repository containing prompt-injection text.
Security tests
- cross-workspace IDOR attempts;
- token leakage in logs/errors/responses;
- XSS through Markdown, YAML and repository evidence;
- CSRF on state-changing endpoints;
- SSRF to localhost, metadata and DNS rebinding fixtures;
- ZIP slip, Unicode path tricks, Windows reserved names and symlink escape;
- decompression bomb limits;
- template injection and unsafe helper access;
- secrets redaction false negatives on representative patterns;
- session revocation.
Performance tests
Dataset:
- 10,000 playbook versions;
- 1,000 playbook identities;
- 500 repository profiles;
- 50,000 generated runs for history pagination;
- realistic tags and full-text distributions.
Measure:
- search P50/P95/P99;
- composer preview latency;
- final run transaction latency;
- Run Pack generation;
- Gitea synchronization under pagination;
- worker throughput and job starvation;
- memory use during malicious archive rejection.
Clean-room test
From a clean machine or disposable VM/container environment:
- clone release tag;
- copy documented environment template;
- launch PostgreSQL and application;
- apply migrations;
- confirm built-in playbooks import;
- create first user;
- complete a manual-profile composition and export;
- restart all containers;
- confirm data and artifacts persist;
- back up, delete deployment state and restore;
- repeat core flow.
Release gate
Mandatory:
- format, lint and typecheck;
- unit and integration suites;
- schema/example and golden-render validation;
- production build;
- critical Playwright suite;
- security scanner and secret scan;
- migration test;
- container health test;
- no unexplained skipped critical test;
CURRENT_STATE.mdand release notes updated.