186 lines
18 KiB
Markdown
186 lines
18 KiB
Markdown
---
|
||
runScope: 'epic-level'
|
||
runKey: 'epic-2'
|
||
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 2 — Надёжное создание Tools из реальных OpenAPI
|
||
|
||
**Date:** 2026-09-13
|
||
**Author:** Bsodfather / BMad TEA
|
||
**Status:** Updated planning baseline; qualification not evaluated.
|
||
|
||
## Executive Summary
|
||
|
||
Scope: FR-7–FR-12, 15 stories, system scenario families CP-05..07. This plan reflects the approved numbering revision; it neither changes product scope nor marks stories complete.
|
||
|
||
4 inherent risks, 3 high (score ≥6). Coverage seeds: 22 P0 and 8 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-artifacts/tests/{artifact_store,artifact_store_io,reconciliation}.rs`; `crates/crank-registry/tests/integration/{artifact_sources,artifact_reconciliation}.rs`; `apps/admin-api/tests/integration/openapi_source/`; `crates/crank-import/tests/{preview,coverage,normalization_details,reference_resolution}.rs`; `apps/admin-api/tests/integration/openapi_import/`; `apps/ui/tests/e2e/operations.spec.js`.
|
||
|
||
2.1–2.6 source/metadata/reconciliation/preview and 2.7–2.8 have reusable source tests, not fresh acceptance evidence. 2.9 tests exist only at candidate f8ee7c9, not main 083974c; rerun after integration. Security-scheme API/UI mapping, full partial/re-import policy matrix, ≥50-spec corpus and OpenAPI onboarding still need story-level deltas. Two candidate review deferrals (reverse URL placeholder validation and object/array default projection) remain explicit triage inputs, not automatically accepted or added to every story.
|
||
|
||
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 2 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 |
|
||
|---|---|---|---:|---:|---:|---|---|
|
||
| E2-R1 | DATA | Silent HTTP/schema loss in supported imports | 3 | 3 | 9 | R-002 | Wire oracle + IR/ref/plan golden tests; Import owner, before 2.14 |
|
||
| E2-R2 | SEC | Hostile files/refs escape scope, leak secrets or exhaust resources | 3 | 3 | 9 | R-004 | Bounded parser/network/storage canaries; Security + Import, each source story |
|
||
| E2-R3 | DATA | GC/re-import races lose pinned artifacts or overwrite revisions | 2 | 3 | 6 | R-008 | Real PG + filesystem fault interleavings; Registry, before 2.13 |
|
||
| E2-R4 | TECH | Flaky preview UI/evidence masks failed import | 2 | 2 | 4 | R-012 | Stale-response tests + strict evidence; UI/QA, 2.6/2.15 |
|
||
|
||
Medium risks: E2-R4 (4), tracked UI flakiness. No additional low risk is invented just to fill a template. Residual risk is unmeasured until evidence exists.
|
||
|
||
## NFR Planning
|
||
|
||
Zero silent semantic loss; ≥50 versioned specs and ≥95% actionable Draft operations (2.14). Source size/depth/time/scan budgets come from the typed contract; test min/max/over-limit, do not invent limits. No secrets outside allowed encrypted authority. Test artifact retention under reference/cleanup contention.
|
||
|
||
| 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.
|
||
- Immutable hostile/valid YAML/JSON corpus with expected IR and wire outcomes; local allowlisted HTTP/DNS fixtures; isolated temp roots; real PostgreSQL schemas; reproducible crash checkpoints. File-size fault tests must retain pipe/PTY stdout rather than a regular-file redirect.
|
||
- 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 `Given` groups, including the five shared groups inherited by both Stories 2.3 and 2.4; their physical placement under 2.4 does not mean 2.3 has no AC. Counts are not a claim that two tests exhaust those groups. The former security-mapping story is split without loss: 2.10 owns its former API groups 1–10 and 12, while 2.11 owns former group 11 plus the UI perspectives of groups 3 and 5. 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 |
|
||
|---|---|---:|---|---|---|---|
|
||
| 2.1 / 2.1-INT-A,B | FR-7, FR-9 | 6 | INT | E2-R2/E2-R3 | Immutable bytes: digest roundtrip and concurrent no-clobber dedupe | Corrupt/missing bytes, symlink/traversal and crash/disk-full must fail safely |
|
||
| 2.2 / 2.2-INT-A,B | FR-7, FR-9 | 6 | INT | E2-R2/E2-R3 | Workspace-owned metadata attach/read/detach and idempotent replay | Foreign scope indistinguishable from missing; conflicting replay and missing blob rejected |
|
||
| 2.3 / 2.3-INT-A,B | FR-7, FR-9 | 5 shared | INT | E2-R3 | Bounded scan continuation visits eligible entries exactly once | Malformed entries, quarantine/unlink race and retries preserve live bytes |
|
||
| 2.4 / 2.4-INT-A,B | FR-7, FR-9 | 5 | INT | E2-R3 | Claim/finalize recovery converges after process restart | Global reference recheck wins over cleanup; stale token and DB/fsync crash windows cannot delete referenced content |
|
||
| 2.5 / 2.5-API-A,B | FR-7, FR-9 | 6 | API | E2-R2 | Verified YAML/JSON multipart preview creates no Draft | Malformed/oversized/cancelled upload, foreign scope, corruption and parser canaries remain bounded/sanitized |
|
||
| 2.7 / 2.7-UNIT-A,B | FR-7, FR-8 | 12 | UNIT | E2-R1 | OAS3.0/3.1/Swagger2 normalize byte-for-byte to stable source-construct identities | Malformed, duplicate IDs and unsupported constructs yield bounded explicit findings, never silent loss |
|
||
| 2.8 / 2.8-INT-A,B | FR-9 | 13 | INT | E2-R1/E2-R2 | Local/external refs and supported composition preserve provenance/snapshot digests | Cycles, depth/size, SSRF/redirect/TOCTOU and foreign cached snapshots denied |
|
||
| 2.9 / 2.9-INT-A,B | FR-8 | 14 | INT | E2-R1 | All supported methods/parameter locations/body encodings replay expected wire bytes; 2xx/204 outcomes match | Unsupported XML/serialization or lost semantics block with findings; hostile headers/bodies fail before dispatch |
|
||
| 2.10 / 2.10-API-A,B | FR-10 | 11 | API | E2-R2 | Global/operation security overrides, OR/AND and explicit no-auth bind compatible AuthProfileRef | Revoked/foreign/wrong-scheme refs rejected; imported secret canaries absent from API IR/plan/export surfaces |
|
||
| 2.13 / 2.13-INT-A,B | FR-11 | 15 | INT | E2-R1/E2-R3 | skip/rename/new_version decisions apply atomically with immutable report and scoped replay | Concurrent/stale/conflicting plans and crash before/after commit leave no partial or mutated Published state |
|
||
| 2.14 / 2.14-INT-A,B | FR-12 | 13 | INT | E2-R1 | Checksummed corpus of at least 50 specs yields ≥95% actionable operations and zero silent loss | Bad fixture/checksum/unsupported construct is explicit; offline rerun reproduces oracle and evidence |
|
||
|
||
### 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 |
|
||
|---|---|---:|---|---|---|---|
|
||
| 2.6 / 2.6-E2E-A,B | FR-7, FR-9 | 5 | E2E | E2-R4 | Real multipart upload renders actionable preview and safe support IDs | Replace/navigation/cancel races reject stale responses; RU/EN keyboard flow and clean required evidence |
|
||
| 2.11 / 2.11-E2E-A,B | FR-10 | 3 | E2E | E2-R2/E2-R4 | Security mapping UI makes the selected compatible AuthProfileRef and explicit no-auth state visible without exposing secrets | Stale/foreign/revoked/wrong-scheme selections and secret canaries are rejected or absent from browser-visible state |
|
||
| 2.12 / 2.12-API-A,B | FR-7 | 14 | API | E2-R1/E2-R4 | Preview classifies every operation and computes dependency-closed explicit partial ImportPlan | Blockers/stale digest cannot apply; bounded 2k pagination and out-of-order UI updates do not change selection |
|
||
| 2.15 / 2.15-E2E-A,B | FR-7, FR-11, FR-33 | 7 | E2E | E2-R4 | OpenAPI onboarding reuses upload → selection → publish → Agent → real MCP call | Return context/digest changes/retry must not auto-publish, duplicate records or claim activation without call |
|
||
|
||
### 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 | 40–80 hours |
|
||
| P1 | 20–40 hours |
|
||
| Optional P2 | 0–8 hours |
|
||
| Optional P3 | 0–4 hours |
|
||
| Total envelope | 60–132 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
|
||
|
||
Epic 1 safety foundation → 2.1/b/e/f → 2.5/d → 2.7 → 2.8 → 2.9 → 2.10/2.11 → 2.12 → 2.13 → 2.14 → 2.15; retain the explicit dependency graph in epics.md. Do not start later work by treating candidate-only 2.9 as merged.
|
||
|
||
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 2.
|
||
- 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, approved old→new AC allocation, requirements, risk arithmetic/linkage and document paths checked; no final test/NFR PASS issued. Approval is planning-level user direction, not fabricated reviewer signatures.
|