Files
crank/_bmad-output/test-artifacts/test-design-epic-4.md
T

16 KiB
Raw Blame History

runScope, runKey, workflowStatus, workflowType, totalSteps, stepsCompleted, lastStep, nextStep, lastSaved, auditedRevision, inputDocuments
runScope runKey workflowStatus workflowType totalSteps stepsCompleted lastStep nextStep lastSaved auditedRevision inputDocuments
epic-level epic-4 completed testarch-test-design 5
step-01-detect-mode
step-02-load-context
step-03-risk-and-testability
step-04-coverage-plan
step-05-generate-output
step-05-generate-output 2026-09-13 083974c27f
_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 4 — Безопасные параллельные и фоновые выполнения

Date: 2026-09-13
Author: Bsodfather / BMad TEA
Status: Updated planning baseline; qualification not evaluated.

Executive Summary

Scope: FR-21–FR-26, 10 stories, system scenario families CP-12..15. This plan reflects the approved numbering revision; it neither changes product scope nor marks stories complete.

3 inherent risks, 3 high (score ≥6). Coverage seeds: 16 P0 and 4 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-runtime/tests/{stages,product_metrics}.rs, crates/crank-runtime/tests/integration/{idempotency,confirmation,valkey}.rs, crates/crank-test-support/src/lib.rs supply synchronous safety and real-PG fixture patterns.

No durable Task/worker/admission lifecycle tests found in main. tokio::task usage is not MCP Tasks coverage. All story-specific Task acceptance scenarios are planned. Existing synchronous idempotency and approval tests must remain regression coverage, not be rewritten to make unsafe Task behavior pass.

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 4 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
E4-R1 DATA Stale lease or retry duplicates an external side effect 3 3 9 R-003 Fencing + side-effect counters + unknown outcomes; Task owner, 4.3–4.6
E4-R2 PERF Admission/queue exhaustion starves control plane 3 3 9 R-006 Limits/fairness/recovery under load; Performance, 4.10
E4-R3 SEC Cross-scope Task control or resume bypasses consent 2 3 6 R-004 Owner-bound cancel/input/reconciliation; Security, 4.5–4.9

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

128 concurrent sync/background executions, up to 10,000 queued; start and steady queue wait p95 ≤5 s within service rate, oldest age ≤30 s; 10k backlog drains ≤60 minutes after overload ends. Shutdown ≤30 s and eligible lease recovery ≤60 s. Fencing protects Crank state, not exactly-once external side effects.

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.
  • Real PG independent worker connections; controllable clock/barriers and crash checkpoints before/after commit, claim, dispatch, side effect and terminal commit; counted upstream with and without verified idempotency; Valkey-off fixture; separate measured capacity host.
  • 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 approved split preserves former 4.5 groups: 4.5 owns groups 1–3 and part of 6, while 4.6 owns 4–5 and the reconciliation part of 6. Former Admin UI groups split between 4.8 (1–3 and its basic/UI portions) and 4.9 (4–5 and the input/reconciliation portions). 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
4.1 / 4.1-INT-A,B FR-21, FR-24 7 INT E4-R2/E4-R3 Pinned synchronous/background/adaptive admission shares safety policy and fair bounded permits Global/per-Agent/per-Tool exhaustion and safety-store loss reject before allocation/dispatch
4.2 / 4.2-INT-A,B FR-22, FR-23 11 INT E4-R1/E4-R3 Task and dispatch intent commit before acknowledgement; replay returns same Task/support IDs Crash before/after commit, conflicting fingerprint, foreign access and terminal CAS races preserve durable truth
4.3 / 4.3-INT-A,B FR-22, FR-23 10 INT E4-R1 SKIP LOCKED claim, renew and dispatch checkpoint enforce current fencing owner Crash/partition/stale worker and lost Valkey wake-up recover via PG; stale owner cannot dispatch before checkpoint or commit after lease loss
4.4 / 4.4-INT-A,B FR-25 8 INT E4-R1 Read/verified-idempotent retry respects attempt count, deadline and child spans Write uncertainty after dispatch stays outcome_unknown; cancel/timeout/lease-loss cannot fabricate safe failure
4.5 / 4.5-INT-A,B FR-25 4 INT E4-R1/E4-R3 Versioned input update transitions once under CAS and preserves task authority TTL expiry, identical/conflicting replay and unauthorized update cause no new side effect
4.6 / 4.6-INT-A,B FR-25 3 INT E4-R1/E4-R3 Evidence-bearing reconciliation transitions a Task once under CAS Unauthorized normal retry of outcome_unknown and reconciliation replay cannot fabricate a safe result or new side effect
4.7 / 4.7-API-A,B FR-21, FR-22, FR-25 11 API E4-R1/E4-R3 Negotiated Tasks extension returns durable IDs and supports exact get/update/cancel shapes plus fallback Mixed revision/client-chosen collision/foreign scope denied; no invented tasks/list; disconnect does not cancel accepted work
4.10 / 4.10-SYS-A,B FR-23, FR-24 7 SYS E4-R1/E4-R2 Qualified 128 concurrent / 10k queued workload meets start/wait/recovery budgets Overload stop drains backlog without loss/duplicate terminal results; PG/Valkey/crash matrix preserves declared behavior

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
4.8 / 4.8-E2E-A,B FR-26 6 E2E E4-R3 Basic Task filters/detail and conditional actions preserve authoritative state Stale polling and basic repeated actions remain safe; RU/EN keyboard/a11y and canary negatives
4.9 / 4.9-E2E-A,B FR-26 5 E2E E4-R3 Input and reconciliation UI preserves authoritative state and conditional actions Repeated submit and unknown-outcome Retry/Cancel remain safe; stale polling, RU/EN keyboard/a11y and canary negatives

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 64–128 hours
P1 20–40 hours
Optional P2 0–8 hours
Optional P3 0–4 hours
Total envelope 84–180 hours, approximately 3–5 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

Shared runtime/admission and MCP negotiation first; 4.1 → 4.2 → 4.3 → 4.4/4.5 → 4.6 → 4.7 → 4.8/4.9 → 4.10. Worker authority is PG; cache may only accelerate.

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 4.
  • System contract: architecture, QA inventory and execution.
  • 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.