179 lines
16 KiB
Markdown
179 lines
16 KiB
Markdown
---
|
||
runScope: 'epic-level'
|
||
runKey: 'epic-7'
|
||
workflowStatus: 'completed'
|
||
workflowType: 'testarch-test-design'
|
||
totalSteps: 5
|
||
stepsCompleted: ['step-01-detect-mode', 'step-02-load-context', 'step-03-risk-and-testability', 'step-04-coverage-plan', 'step-05-generate-output']
|
||
lastStep: 'step-05-generate-output'
|
||
nextStep: ''
|
||
lastSaved: '2026-09-13'
|
||
auditedRevision: '083974c27f3a21a15807dd248bb6bc4fe04a5cd8'
|
||
inputDocuments:
|
||
- '_bmad-output/planning-artifacts/epics.md'
|
||
- '_bmad-output/planning-artifacts/prds/prd-crank-2026-08-03/prd.md'
|
||
- '_bmad-output/planning-artifacts/architecture/architecture-crank-2026-08-03/ARCHITECTURE-SPINE.md'
|
||
- '_bmad-output/test-artifacts/test-design-architecture.md'
|
||
- '_bmad-output/test-artifacts/test-design-qa.md'
|
||
---
|
||
|
||
# Test Design: Epic 7 — Автономное production-развёртывание и восстановление
|
||
|
||
**Date:** 2026-09-13
|
||
**Author:** Bsodfather / BMad TEA
|
||
**Status:** Updated planning baseline; qualification not evaluated.
|
||
|
||
## Executive Summary
|
||
|
||
Scope: FR-41–FR-45, 9 stories, system scenario families CP-25..27. This plan refines the current system design; it neither changes approved product scope nor marks stories complete.
|
||
|
||
3 inherent risks, 3 high (score ≥6). Coverage seeds: 16 P0 and 2 P1 independently assertable scenarios. Counts describe the two seeds per story below, not implemented tests, coverage percentages or the eventual parameterized case count. Every source AC remains mandatory.
|
||
|
||
## Existing Coverage and Evidence
|
||
|
||
Source inventory at main `083974c`: `crates/crank-config/tests/{contract,generation,redaction}.rs`; `crates/crank-registry/tests/integration/migrations.rs` and `migrations/`; `apps/admin-api/tests/migration_command.rs`; `apps/admin-api/tests/config_startup.rs`; `scripts/restore-community.sh`; `scripts/authenticated-product-smoke.py`; `.gitea/workflows/ci.yml`.
|
||
|
||
Config/migration/auth foundations and Compose authenticated smoke exist. Restore script presence is not three qualified PITR restores. Complete offline signed bundle, role isolation with future worker/runner and full N/N-1 online/offline matrix need evidence. Prior deployment failures require regression fixtures for legacy fingerprint, missing core, external PG topology and failed migrate diagnostics, not permission to reset databases.
|
||
|
||
Source presence ≠ execution ≠ requirement coverage ≠ qualification. No product test, deployment or load execution was performed for this plan. Reuse source tests only after matching their oracle to the current AC and recording a run on the candidate under test.
|
||
|
||
## Not in Scope
|
||
|
||
| Item | Reason | Mitigation |
|
||
|---|---|---|
|
||
| Unrelated future-epic implementation and whole-product refactoring | This is Epic 7 test planning | Keep explicit prerequisites below; do not invent additional story acceptance |
|
||
| SSO/RBAC enterprise features, non-REST adapters, HA/rolling deployment | Outside approved Community scope | Preserve Community boundary checks |
|
||
| Declaring current production readiness from source inventory | No bound qualification run | Require real evidence before gate |
|
||
| Product-wide 72-hour soak / 30-day burn-in | Owned by Epic 8 | Component fault/performance obligations in this epic remain required |
|
||
|
||
## Risk Assessment
|
||
|
||
Score = probability × impact on a 1–3 scale. Score ≥6 needs verified mitigation; 9 is an unresolved critical release risk, not a command to implement every mitigation immediately. Categories: SEC security, DATA integrity, OPS operations, PERF performance, BUS user behavior, TECH architecture/testing.
|
||
|
||
| Risk ID | Category | Failure | P | I | Score | System risk | Mitigation / accountable role / deadline |
|
||
|---|---|---|---:|---:|---:|---|---|
|
||
| E7-R1 | DATA | Schema/artifact/key mismatch destroys recovery | 2 | 3 | 6 | R-008 | Manifest + N/N-1 + three real restores; SRE, 7.8–7.9 |
|
||
| E7-R2 | SEC | Unsafe defaults/proxy/privileges expose installation | 2 | 3 | 6 | R-007 | Fresh-host negative exposure tests; Security, 7.4/7.6 |
|
||
| E7-R3 | SEC | Offline bundle untrusted or phones home | 2 | 3 | 6 | R-014 | Offline signature/tamper/egress tests; Release, 7.5 |
|
||
|
||
Medium risks: shared R-012 (4), deterministic test isolation; QA owns continuous monitoring. No additional low risk is invented just to fill a template. Residual risk is unmeasured until evidence exists.
|
||
|
||
## NFR Planning
|
||
|
||
Each of3independent restores RPO≤5m/RTO≤30m with real MCP probe; drain≤30s and eligible Task recovery≤60s. Production sizing retains≥30% measured headroom. Zero known Critical/High, zero unapproved egress. Trust material/reference-host allocation and exact image digests are execution prerequisites, never generated secrets in docs.
|
||
|
||
| Category | Scenario linkage | Planned validation / evidence |
|
||
|---|---|---|
|
||
| Security/privacy | SEC risks and B scenarios below | Scope/abuse/canary tests, bounded sanitized logs and network/scan report |
|
||
| Reliability/data integrity | DATA/OPS risks and fault scenarios | Real authority/state assertions, fault schedule and reconciled counters/digests |
|
||
| Performance/scalability | Numeric epic obligations above | Calibrated raw latency/resource samples, achieved load and immutable config/topology fingerprint |
|
||
| Maintainability/compatibility | Every changed component | Existing `just verify`/UI gates as applicable, schema/contract diffs and traceable regression reports |
|
||
|
||
Unknowns: exact execution hardware and fresh qualification artifacts are not available from this audit. Where the owning story requires a new tolerance, limit or version selection, freeze it in its approved contract before writing a numeric assertion; never replace the PRD threshold with a guessed easier value. Full NFR verdict belongs to `bmad-testarch-nfr` after execution.
|
||
|
||
## Entry Criteria
|
||
|
||
- Approved owning story/spec and prerequisites are available in the same worktree.
|
||
- ATDD loads the actual ACs from `epics.md` / selected spec and the system QA design.
|
||
- Existing tests and baseline failures are inspected before adding tests; no duplicate test suite solely for new IDs.
|
||
- Disposable fresh host/network namespaces; PG16 current/N-1/legacy snapshots; checksummed artifacts/WAL plus out-of-band test keys; fault checkpoints; offline registry-less image archive; default-deny egress capture; fresh scanner DB pinned in report.
|
||
- Missing fixture, service or approval is reported as blocked/not-run, not silently skipped.
|
||
|
||
## Test Coverage Plan
|
||
|
||
P0/P1/P2/P3 indicate priority, **not execution timing**. Each table row has two separate scenario seeds: `<Story>-<Level>-A` and `...-B`. Split a seed when independent assertions require different fixtures. Reuse an existing equivalent test rather than duplicating it; ATDD records exact test name/path and AC mapping.
|
||
|
||
The AC-count column inventories all `Given` groups under that source story, not a claim that two tests exhaust those groups. The former offline-upgrade acceptance group moves from 7.5 to 7.9: 7.5 remains bundle creation/install trust coverage, while 7.9 owns upgrade/rollback continuity. ATDD must map each group (story + ordinal + quoted acceptance text) to existing test, new test, or explicit not-run prerequisite before implementation. The approved spec controls finer-grained cases.
|
||
|
||
### P0 — Critical
|
||
|
||
Security, irreversible data integrity and false acceptance have no safe user workaround.
|
||
|
||
| Story / scenario IDs | Requirements | AC groups | Primary level | Risk | A: expected behavior | B: rejection / fault |
|
||
|---|---|---:|---|---|---|---|
|
||
| 7.1 / 7.1-UNIT-A,B | FR-45 | 6 | UNIT | E7-R2 | Typed schema generates matching examples/Compose/docs/redacted effective config | Unknown/unused/divergent/unsafe cross-field and conflicting alias values fail safely |
|
||
| 7.2 / 7.2-INT-A,B | FR-43 | 6 | INT | E7-R1 | Fresh/current/N-1/legacy PG16 states migrate idempotently through canonical authority | Checksum/future/partial drift and concurrent preflight reject before mutation; large backfill resumable |
|
||
| 7.4 / 7.4-API-A,B | FR-41 | 6 | API | E7-R2 | Explicit TLS/origin/host/trusted proxy and separate Admin/MCP/metrics identities work | Spoofed forwarded headers, host/CORS/CSRF/cookie downgrade and exposed recovery denied |
|
||
| 7.5 / 7.5-SYS-A,B | FR-42 | 5 | SYS | E7-R3 | Signed digest-pinned complete bundle installs with default-deny egress | Extra/missing/tampered/unpinned artifacts or invalid trust fail offline; no CDN/registry/phone-home |
|
||
| 7.6 / 7.6-SYS-A,B | FR-44 | 7 | SYS | E7-R2/E7-R3 | Images enforce role-scoped non-root/caps/read-only/resource/mount policy and≤30s drain | Runner cannot access DB/secrets; OOM/disk pressure isolated; changed hardened image invalidates and rebuilds bundle |
|
||
| 7.7 / 7.7-INT-A,B | FR-43 | 6 | INT | E7-R1 | Online consistent WAL/artifact/config cut produces immutable complete BackupManifest | Interrupted backup/missing WAL/wrong epoch/tampered bytes never become usable; retention keeps pinned dependencies |
|
||
| 7.8 / 7.8-SYS-A,B | FR-43 | 6 | SYS | E7-R1 | Three independent fresh-host restores prove RPO/RTO and real authenticated MCP plus key recovery | Mismatch blocks mutation; ciphertext/manifest errors explicit; crash during re-encryption preserves decryptability |
|
||
| 7.9 / 7.9-SYS-A,B | FR-43 | 8 | SYS | E7-R1 | N-1→N preflight/backup/drain/migrate/probe preserves pinned state online and through the transferred offline-upgrade path | Fault before reversible boundary rolls back safely; irreversible boundary requires explicit manifest restore |
|
||
|
||
### P1 — High
|
||
|
||
Core user journeys and complex integrations; limited workaround, not relaxed acceptance.
|
||
|
||
| Story / scenario IDs | Requirements | AC groups | Primary level | Risk | A: expected behavior | B: rejection / fault |
|
||
|---|---|---:|---|---|---|---|
|
||
| 7.3 / 7.3-SYS-A,B | FR-41 | 6 | SYS | E7-R2 | Fresh minimal/production profile starts, persists, restarts and makes real MCP call; PG-only correct | Missing secrets/unsafe exposure fail readiness; optional backend outage cannot pretend safety store is optional |
|
||
|
||
### P2 / P3
|
||
|
||
No additional mandatory scope. Optional focused exploratory/cosmetic variants may be recorded later with owner and justification; they do not become an endless implementation/review queue.
|
||
|
||
Levels: UNIT pure contract/model; INT real filesystem/database/runtime boundary; API actual handler/protocol; E2E critical browser journey; SYS isolated full-stack qualification; MANUAL named human protocol. Use unit cases for algorithms, real PG for transaction/fencing, wire fixtures for protocol, browser only for user-visible interaction. Intentional defense-in-depth checks different failure surfaces, not identical duplicated assertions.
|
||
|
||
## Execution Strategy
|
||
|
||
Run all functional tests in PRs when they fit the target 15-minute feedback window; defer only expensive infrastructure/duration, not inconvenient failures. Current Playwright is Chromium, one worker: parallelization is a future isolation-dependent optimization, not a current claim.
|
||
|
||
- **PR:** changed functional/negative regressions and boundary suites; applicable Rust/tooling/config and UI gates.
|
||
- **Nightly:** bounded fault/contention, repeated isolation and resource trend tests after the required seams exist.
|
||
- **Weekly:** calibrated production-size performance, fresh-host/offline/recovery and manual qualification as applicable.
|
||
- **Epic / RC acceptance:** every mandatory AC and quantitative obligation must have exact-candidate evidence, even if its normal execution tier is weekly. Epic 8 owns the immutable long-duration release windows.
|
||
|
||
Nightly/weekly scheduling is a proposed execution model; the current Gitea pipeline has PR/push and release jobs, not those schedules. This planning task does not create them. `just verify` does not replace Playwright, deployment/image or qualification jobs.
|
||
|
||
## Resource Estimates
|
||
|
||
Incremental QA test/evidence effort with working production seams and reusable fixtures, excluding feature implementation, provisioning lead time and unaccelerated duration. Low-confidence planning ranges, not token budgets or compulsory numbers of new tests; reassess at each story ATDD after deduplication.
|
||
|
||
| Priority | Estimated effort |
|
||
|---|---|
|
||
| P0 | 48–96 hours |
|
||
| P1 | 16–32 hours |
|
||
| Optional P2 | 0–8 hours |
|
||
| Optional P3 | 0–4 hours |
|
||
| Total envelope | 64–140 hours, approximately 2–4 contributor-weeks |
|
||
|
||
If a measurement environment is missing, report the prerequisite; do not run large workloads opportunistically inside a story session.
|
||
|
||
## Exit Criteria and Quality Gates
|
||
|
||
- P0 pass 100%; P1 ≥95% is an interim development signal only, **100% of mandatory P1 and manual ACs must pass for acceptance**.
|
||
- Every owning-story AC has test/protocol plus bound execution evidence; no mandatory skipped/flaky/blocked/not-run item becomes pass.
|
||
- No unresolved Critical/High defect; high-risk mitigation verified on the owning scenario before release. Mandatory Habr conditions have no waiver.
|
||
- Coverage targets remain system planning goals (80% workspace /90% new critical code where measured); **no coverage report currently proves them**. Scenario counts do not substitute for coverage instrumentation.
|
||
- NFR evidence names revision, config/topology, tool/data versions, command, seed, timestamps, raw sanitized output digest and result.
|
||
- Story completion follows its spec, not all remaining epic/system gaps; no automatic reopening of done stories.
|
||
|
||
## Mitigation Plans
|
||
|
||
Each high-risk owner in the matrix: (1) implement/reuse the production-safe seam; (2) run its A/B and detailed AC cases with controlled failures; (3) bind the output to the candidate; (4) re-evaluate residual risk. Status is planned or source-partial, never verified solely by this document. Required completion time is the owning story/epic milestone in the risk table. No generic follow-up review loop is created.
|
||
|
||
## Assumptions and Dependencies
|
||
|
||
All shipped processes/config/metrics contracts from preceding epics. 7.1/7.2 preflight → profiles/exposure/bundle/hardening; 7.7 complete manifest →7.8 restore→7.9 upgrade. 7.6 image changes require7.5 bundle requalification.
|
||
|
||
Accountable roles are responsibilities, not claims of staffed teams. Reference hardware, operator credentials and manual reviewers must be assigned before relevant qualification. Use disposable fixtures while waiting; lack of resources blocks the affected evidence, not permission to mutate a live deployment.
|
||
|
||
## Interworking and Regression
|
||
|
||
Affected components and reusable suites are named in Existing Coverage. Preserve existing REST→MCP, auth/credential/approval, config/migration, correlation and Community-boundary behavior whenever those shared contracts change. Frontend failures need actual browser regression; registry races need real-PG assertions, not UI mocks.
|
||
|
||
## ATDD Handoff
|
||
|
||
For the selected not-yet-implemented story only, load this plan and the exact approved spec; freeze its finite AC-to-test checklist before implementation. Prefer existing Rust/PG/Playwright patterns, add only uncovered acceptance scenarios and reproduce RED for missing behavior without artificial failure. Existing correct behavior may already be GREEN: record it honestly. Resume matching incomplete ATDD, reuse completed matching checklists and update only changed ACs. Do not invoke whole-epic automation on each review.
|
||
|
||
Automatic pre-implementation ATDD requires the project build-auto handoff override; the stock bmad-loop0.11.1 TEA ATDD injection is post-dev and is not that sequence. Loop configuration is separate from completion of this plan. The design workflow itself does not run ATDD or product implementation.
|
||
|
||
## References and Validation
|
||
|
||
- Epic/AC source: `_bmad-output/planning-artifacts/epics.md`, Epic 7.
|
||
- System contract: [architecture](test-design-architecture.md), [QA inventory and execution](test-design-qa.md).
|
||
- Normative PRD and architecture spine: frontmatter inputDocuments.
|
||
- TEA knowledge: risk-governance, probability-impact, test-levels-framework, test-priorities-matrix, nfr-criteria.
|
||
- Utility integration: Playwright/Pact flags are true but packages absent. No imports, framework migration or Pact service are generated. Browser CLI unavailable; source-based design only.
|
||
- Validation: story IDs/requirements/AC counts, risk arithmetic/linkage and document paths checked; no final test/NFR PASS issued. Approval is planning-level user direction, not fabricated reviewer signatures.
|