19 KiB
workflowStatus, totalSteps, stepsCompleted, lastStep, nextStep, lastSaved, lastEdited, editScope, auditedRevision, workflowType, inputDocuments
| workflowStatus | totalSteps | stepsCompleted | lastStep | nextStep | lastSaved | lastEdited | editScope | auditedRevision | workflowType | inputDocuments | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| completed | 5 |
|
step-05-generate-output | 2026-09-13 | 2026-09-13 | system-level inventory and evidence-aware strategy refresh | 083974c27f |
testarch-test-design |
|
Test Design for Architecture: Crank Community Production Readiness
Purpose: Architectural testability contract between Engineering, Architecture, Security and QA. It defines what the system must expose so production claims can be proven; execution details live in test-design-qa.md.
Date: 2026-09-13 (original design: 2026-08-08)
Author: BMad TEA / Bsodfather
Status: System-level design updated; production qualification remains unproven
Project: crank
PRD: _bmad-output/planning-artifacts/prds/prd-crank-2026-08-03/prd.md
Architecture: _bmad-output/planning-artifacts/architecture/architecture-crank-2026-08-03/ARCHITECTURE-SPINE.md
Executive Summary
The Community edition is being advanced from a working brownfield REST→MCP core to a production-ready, self-hosted product for small organizations and private developers. Scope covers 54 FRs, 30 NFRs and 8 epics: real-world OpenAPI import; complete modern MCP Tools/Resources/Prompts and Tasks; safe concurrency; end-to-end traceability; Prometheus/Grafana/GlitchTip; built-in load testing; secure offline deployment/recovery; and evidence-backed release.
Key decisions are a Rust hexagonal modular monolith; PostgreSQL as correctness authority with optional rebuildable Valkey; immutable/versioned capability catalogs; unified outbound execution; durable CAS/fenced Tasks; typed observability/metrics; and a fail-closed signed evidence manifest.
Expected reference scale is 100 RPS for 30 minutes, a 250 RPS five-minute burst, 128 concurrent executions, 10,000 queued Tasks and a production-size catalog/history dataset on 4 vCPU/8 GiB. Platform overhead is bounded at 50 ms p95/150 ms p99.
Risk summary: 15 risks: 14 high (score ≥6), 1 medium, 0 low. Five score-9 risks are release blockers. Scores describe inherent release risk, not a measured residual defect rate. The August effort estimate is superseded as a remaining-work forecast: significant foundation code and tests now exist. The PRD's 30-day burn-in remains non-accelerable calendar time.
Audit Boundary and Evidence State — 2026-09-13
This refresh inspects tracked source at 083974c27f3a21a15807dd248bb6bc4fe04a5cd8 (main). It does not declare the system production-ready or reopen epic/story implementation.
- Story 2.9 commit
f8ee7c9bfeaa8a3f73a4850ff3f82b2bc2155fe8is separate and not integrated into main. Its HTTP-contract tests and prior successfuljust verifyapply to that candidate, not main. docs/capability-baseline/results.jsoncontains historical revision-bound evidence, including records for767428436d3a54e60809a727044dfcec48e1f1dd. Validating that snapshot does not execute today's product or establish today's manual-regression verdict.- Test source, an executed test report, measured coverage, and release qualification are four different claims. The QA companion records the inventory and required evidence; no current line/branch coverage report was found.
- Prior system and Epic 1 checkpoints are historical records. Epic plans, sprint statuses and the handoff document are unchanged by this edit; the two refreshed system documents take precedence for current inventory and CP-to-FR mapping.
Quick Guide
🚨 BLOCKERS — architecture must provide
- B-001 Deterministic control plane: aggregate builders, per-test namespaces, controllable clock/IDs/scheduler and reliable cleanup. Owner: Core/Task Architecture; foundation through Epic 4.
- B-002 Named fault-injection seams: upstream/DNS/redirect, PostgreSQL/Valkey, worker crash, telemetry endpoint, disk/fsync and network failure controls. Owner: Platform/SRE; before affected epic qualification.
- B-003 Queryable observability sinks: local history, captured OTLP/Sentry envelopes, Prometheus exposition and Grafana provisioning queryable by request/trace ID. Owner: Observability; before Epic 5 qualification.
- B-004 Executable evidence contract: stable schemas, content-addressed collectors and RC/config/topology provenance from the first enabling epic. Owner: Release Architecture; establish in Epic 1.
- B-005 Independently measurable load runner: isolated resource accounting, calibrated stub/external reference, heartbeat and kill path. Owner: Performance/Platform; before Epic 6.
The B-001..B-005 list is a required-capability contract, not a claim that all foundations are absent:
| Seam | Existing foundation | Remaining system-level gap |
|---|---|---|
| B-001 | PostgreSQL Testcontainers, per-test schemas, runtime doubles, typed builders | Deterministic durable Task time/claim/crash control; UI isolation before increasing workers |
| B-002 | DNS/redirect/proxy negatives, artifact crash/disk-full tests, DB failure/rollback tests | Worker, telemetry-spool and full-stack recovery fault orchestration |
| B-003 | Captured OTLP, redaction, local request/trace identity and Prometheus tests | Actual GlitchTip receiver/delivery evidence, browser-to-receiver correlation, dashboards/alerts |
| B-004 | Versioned capability inventory, bounded collectors and accepted-run validation | Complete same-RC signed release evidence across every required surface, not only OpenAPI UI |
| B-005 | Local overhead/budget probes and an ignored million-row history query test | Calibrated full workload, built-in Load Runs, separate generator/SUT accounting and stop control |
⚠️ HIGH PRIORITY — validate during implementation
- Freeze Task lease/poll/batch/fairness parameters by performance evidence without weakening NFRs.
- Freeze MCP versions and digest-pinned observability images at feature freeze, then bind them into the RC manifest.
- Prove PostgreSQL/artifact/config/key consistency before readiness and after restore; a green health endpoint alone is insufficient.
- Start nightly contention, telemetry-replay and soak trends before the final epics so long-duration defects are found early.
📋 INFO ONLY — agreed strategy
- Lowest effective test level is authoritative; E2E is reserved for critical cross-boundary outcomes.
- PostgreSQL 16 Testcontainers, Rust property/state-machine tests, MCP protocol harnesses and Playwright browser journeys build on existing repository patterns.
- Target execution tiers are PR, nightly, weekly and immutable-RC qualification. Current Gitea files implement PR/push and release gates; scheduled qualification tiers are not yet established.
- Release requires 100% P0, complete mandatory evidence, no Critical/High findings and all quantitative NFRs met.
Risk Assessment
| ID | Category | Risk | P | I | Score | Mitigation | Owner | Timeline |
|---|---|---|---|---|---|---|---|---|
| R-001 | TECH | Untested brownfield regressions | 3 | 3 | 9 | Capability inventory, characterization and guided baseline | QA Lead + Core | Epic 1 |
| R-002 | DATA | OpenAPI semantic loss/mapping errors | 3 | 3 | 9 | ≥50-spec oracle corpus, deterministic IR/plan, atomic apply | Import Lead | Epic 2 |
| R-003 | TECH | Duplicate effects/stale Task writes after contention or crash | 3 | 3 | 9 | State model, PG contention/crash tests, fencing and reconciliation | Task Lead | Epic 4 |
| R-004 | SEC | SSRF/bypass or secret leakage crosses closed contour | 3 | 3 | 9 | Malicious network lab, canaries, fail-closed config | Security Owner | Every epic + RC |
| R-005 | OPS | Trace spool/replay failure creates false correlation claims | 2 | 3 | 6 | Capacity/outage/corruption tests and loss accounting | Observability Lead | Epic 5 |
| R-006 | PERF | DB/telemetry/runner contention breaches SLO | 3 | 3 | 9 | Calibrated workload, query plans, resource differential | Performance Owner | Epics 5–6 + RC |
| R-007 | SEC | Admin bootstrap/session/recovery authorization failure | 2 | 3 | 6 | Auth state model and full web-security matrix | Security + Admin API | Epic 7 |
| R-008 | OPS | Upgrade/restore produces schema/artifact/key mismatch | 2 | 3 | 6 | N/N-1 matrix and three product-probed PITR restores | Release/SRE | Epic 7 |
| R-009 | BUS | MCP clients see inconsistent catalog/semantics | 2 | 3 | 6 | Immutable snapshots and ≥3-client version matrix | MCP Lead | Epic 3 |
| R-010 | OPS | Built-in load runner escapes scope or cannot stop | 2 | 3 | 6 | Signed bounds, reserved capacity, watchdog/kill tests | Load + Security | Epic 6 |
| R-011 | DATA | Metrics rollups double-count or explode cardinality | 2 | 3 | 6 | Typed registry lint and idempotent differential replay | Metrics Lead | Epic 5 |
| R-012 | TECH | Flaky E2E hides defects and slows feedback | 2 | 2 | 4 | Isolated factories, deterministic waits and burn-in | QA Automation | Continuous |
| R-013 | OPS | Evidence mixes builds or is stale/incomplete | 2 | 3 | 6 | Fail-closed signed manifest binding all digests | Release Owner | Epic 1→8 |
| R-014 | SEC | Offline bundle is untrusted/vulnerable or leaks egress | 2 | 3 | 6 | SBOM/signature/air-gap/default-deny tests | Supply-chain Owner | Epics 7–8 |
| R-015 | OPS | 30-day run reveals leaks/corruption too late | 2 | 3 | 6 | Early nightly trends, 72 h pre-soak, final burn-in | QA/SRE | Epic 4→8 |
Category meanings: TECH architecture/integration; SEC security/privacy; PERF performance/scalability; DATA integrity; BUS user/business behavior; OPS deployment/operations.
NFR Testability Requirements
| Category | Bound requirement | Design support | Required seam / decision | Planned evidence |
|---|---|---|---|---|
| Security/privacy | Default deny; encrypted secrets; per-connection SSRF; no Critical/High; no opt-out egress | Strong invariants, partial implementation | Malicious network lab, secret canaries, security configuration fixture | Negative suites, SARIF/SBOM, egress and canary reports |
| Performance/scale | 100/250 RPS; 99.95% success; 128/10k; 50/150 ms overhead | Quantified and topology-bound | Calibrated stub/external generator, production dataset, independent runner accounting | Raw samples, resource series, query plans, threshold JSON |
| Reliability/recovery | 30 s drain, 60 s lease recovery, RPO 5 m/RTO 30 m, 72 h/30 d | Durable architecture defined | Crash/fault control, virtual time, consistency manifest | Crash schedule, restore manifests/probes, soak series |
| Observability | 100% IDs/traces; 99.99%/60 s delivery; 25 h completeness; 30 h spool; bounded overhead | Typed ownership and spool designed | Queryable capture sinks, disk/outage controls, loss oracle | Correlation graph, captured envelopes, spool ledger, metric/dashboard tests |
| Maintainability/compatibility | MSRV/wire discipline; MCP stable/N-1/N-2; RU+EN | Conventions defined | Feature-freeze matrix and executable architecture rules | Coverage/lint, protocol/corpus/browser matrices |
| Release provenance | One immutable RC, signed complete evidence, no mandatory waivers | Fail-closed manifest designed | Stable schemas/collectors/trust store from Epic 1 | Validated signed manifest and content-addressed raw tree |
Product thresholds come from PRD §5 and §10; this design does not invent replacements. Exact client/revision/image matrices, measurement tooling, reference-host allocation and release trust material still require recorded freeze inputs. A missing measurement environment or report is an evidence gap even when the numerical threshold is known.
Testability Concerns and Architectural Gaps
🚨 Actionable concerns
| Concern | Impact | Architecture must provide | Owner | Timeline |
|---|---|---|---|---|
| Deterministic state/time | Flaky or impractically slow Task/retention tests | Builders, scoped cleanup, clock/ID/scheduler ports | Core/Task | Epic 1–4 |
| Incomplete fault controls | Recovery/security behavior cannot be reproduced | Named injection points with observable activation | Platform/SRE | Before each NFR epic gate |
| Non-queryable telemetry | Trace assertions depend on external UI/manual inspection | Local capture/query adapters and stable schemas | Observability | Epic 5 |
| Generator/SUT ambiguity | Invalid performance verdicts | Separate budgets/metrics plus external calibration | Performance | Epic 6 |
| Late evidence plumbing | Cross-RC or irreproducible release proof | Manifest schemas and collectors from foundation | Release | Epic 1 |
| UI shared state | Parallel browser collisions and stale assertions | Per-worker namespaces, seed/cleanup APIs, stable selectors | Admin/QA | Before full regression |
Required architectural improvements
- Reuse existing builders, runtime doubles and fault seams. Introduce time/claim/failure controls only at new stateful boundaries that require them; do not refactor all modules solely to match a testing pattern.
- Treat test/evidence schemas as supported internal contracts, versioned alongside wire and migration changes.
- Expose only safe, bounded test control in test profiles; production profiles must reject it.
- Make observability truth distinguish
captured locally,delivered,lostandunknown; UI must never infer GlitchTip presence. - Add resource ownership/accounting to load runner and telemetry spools so product and harness costs are separable.
Testability assessment summary
- ✅ Hexagonal, framework-free core supports unit/property testing and adapter replacement.
- ✅ PostgreSQL authority plus optional Valkey enables correctness-first and differential cache tests.
- ✅ Existing Testcontainers support, Rust suites, in-memory runtime stores and Playwright coverage are a solid base.
- ✅ Typed errors/events/metrics, immutable revisions and version-isolated MCP adapters provide stable oracles.
- Quantitative NFRs and bounded capability collectors provide an objective starting point; complete signed release qualification is still a required future capability.
Accepted trade-offs: single-instance drain/restart is the only claimed upgrade model; HA/rolling upgrades, S3 artifacts, SSO/RBAC, non-REST adapters and arbitrary distributed load targets remain out of this release and must not appear in evidence or documentation claims.
Risk Mitigation Plans
All high risks follow the same gate: the owner implements the production seam/control, QA captures machine-readable evidence, and the risk closes only when the linked scenarios pass on the bound topology. Owners below are accountable roles, not claims that separate staffed teams exist. The product owner must assign a person before scheduling qualification. Existing tests reduce implementation work but do not by themselves close a risk.
| Risk | Numbered strategy | Owner / timeline | Status | Verification |
|---|---|---|---|---|
| R-001 | 1. Inventory; 2. characterize; 3. run guided baseline before semantic changes | QA Lead + Core / Epic 1 | Open; see seam inventory | CP-01..04 and zero blocked baseline items |
| R-002 | 1. Build oracle corpus; 2. prove deterministic IR/plan; 3. prove rollback/zero loss | Import Lead / Epic 2 | Open; see seam inventory | CP-05..07 thresholds |
| R-003 | 1. Model states; 2. inject crash/contention; 3. prove fencing/reconciliation | Task Lead / Epic 4 | Open; see seam inventory | CP-12..15, no illegal/stale transition |
| R-004 | 1. Centralize policy; 2. attack every ingress; 3. scan every output with canaries | Security Owner / every epic + RC | Open; see seam inventory | CP-03/04/25/27 and malicious-network report |
| R-005 | 1. Implement delivery/loss ledger; 2. force outage/disk faults; 3. verify UI truth | Observability Lead / Epic 5 | Open; see seam inventory | CP-16..18 and spool accounting |
| R-006 | 1. Calibrate; 2. baseline/query-plan; 3. run contention and immutable-RC profiles | Performance Owner / Epics 5–6 + RC | Open; see seam inventory | CP-14/18/23/29 raw thresholds |
| R-007 | 1. Model auth; 2. exercise web config matrix; 3. prove recovery revocation | Security + Admin API / Epic 7 | Open; see seam inventory | CP-25 negative matrix |
| R-008 | 1. Bind consistency manifest; 2. exercise N/N-1/rollback; 3. restore three times | Release/SRE / Epic 7 | Open; see seam inventory | CP-26 and measured product probes |
| R-009 | 1. Isolate adapters; 2. freeze snapshots; 3. run revisions × clients | MCP Lead / Epic 3 | Open; see seam inventory | CP-08..11 matrix |
| R-010 | 1. Sign/bound plan; 2. reserve control capacity; 3. force watchdog/kill recovery | Load + Security / Epic 6 | Open; see seam inventory | CP-22..24 |
| R-011 | 1. Type registry; 2. enforce label budget; 3. replay/diff rollups and alerts | Metrics Lead / Epic 5 | Open; see seam inventory | CP-19..21 |
| R-013 | 1. Version schemas; 2. bind all digests/freshness; 3. verify trust/revocation failures | Release Owner / Epic 1→8 | Open; see seam inventory | CP-31 negative matrix |
| R-014 | 1. Pin/sign/SBOM; 2. scan; 3. install/upgrade with captured default-deny egress | Supply-chain Owner / Epics 7–8 | Open; see seam inventory | CP-27 |
| R-015 | 1. Start nightly trends; 2. pass 72 h soak; 3. complete 30-day immutable-RC burn-in | QA/SRE / Epic 4→8 | Open; see seam inventory | CP-29 with no drift/SLO breach |
R-012 is medium (score 4): QA owns deterministic Playwright practices and continuous burn-in; it is monitored rather than treated as a production-architecture blocker. Final NFR status belongs to the later NFR assessment.
Assumptions and Dependencies
Assumptions:
- Reference Deployment and all numeric thresholds in PRD/epics are normative.
- PostgreSQL remains the correctness source; Valkey outage may reduce throughput but cannot change results.
- Feature-freeze inputs may select versions/digests but cannot relax requirements.
- Release identity changes on any code/config/topology digest change.
Dependencies:
- Foundation test controls and evidence schemas — Epic 1.
- Stable OpenAPI corpus oracle — Epic 2.
- Representative MCP clients and protocol harness — Epic 3.
- Fault/telemetry/load/recovery environments — before Epics 4–7 qualification.
- Protected release signing/trust material — before Epic 8 RC.
Risk to plan: specialized performance/security/SRE capacity or reference hardware may be unavailable. Contingency is to prepare hermetic fixtures and rehearsal environments early; qualification remains blocked rather than using incomparable evidence.
System-Level Handoff Boundary
First review the QA inventory, evidence gaps and shared execution rules. Resolve common fixture, report-retention, compatibility and measurement prerequisites at system level; only then derive epic-level deltas from the same CP/R identifiers. Do not restart completed stories or create new mandatory features from this test design. Security, data-loss and unsupported-contract findings discovered during later testing must be triaged explicitly.
This edit ran no product tests, load jobs or deployment operations. The only test-discovery command was Playwright --list; source inspection and document consistency checks are not a final NFR assessment.