STD: WCAF Rule (Multiple Control Failures)
Version: v1.0.0
Status: Draft
SRS Source: docusaurus/docs/srs/rules/rule-wcaf.md
Rule Name: WCAF
Domain: RULES-WCAF
Overview
This document specifies tests for the WCAF (Multiple Control Failures) rule using decision tables and test vectors. The rule detects when two or more control wells have failed in a run, marking affected wells for replating with an error message.
Rule Characteristics:
- Pure business logic (run-level QC rule)
- Threshold-based detection (2+ failures)
- Exclusion filtering (unknown mix wells)
- Dynamic clearing on error resolution
- Complements CONTROL_FAIL rule
Test Method: TM-API (per Test Plan Section 3.3 - Rules use automated API tests)
Verification Approach:
Rule verification is performed using data-driven test vectors. Each row in a decision table represents a complete verification scenario with defined inputs and expected outputs. This format enables exhaustive condition coverage while remaining concise and auditable.
Coverage Summary
| REQ ID | Title | Conditions | Test Vectors | Coverage | Gaps |
|---|
| REQ-RULES-WCAF-001 | Detect and Mark Multiple Control Failures | 8 | 12 | 100% | None |
| REQ-RULES-WCAF-002 | Exclude Unknown Mix Wells from Failure Counting | 4 | 8 | 100% | None |
| REQ-RULES-WCAF-003 | Clear Error When Failures Reduce Below Threshold | 5 | 10 | 100% | None |
Totals: 3 REQs, 17 Conditions, 30 Test Vectors, 100% Coverage
| Variable | Type | Valid Values | Description |
|---|
control_wells | array | Well objects | Control wells in the run |
well.status | enum | PASSED, FAILED | Control well QC status |
well.mix_status | enum | known, unknown | Whether mix is identifiable |
well.has_wcaf_error | bool | true, false | Whether WCAF error is applied |
well.has_original_error | bool | true, false | Whether original control error exists |
threshold | int | 2 (default) | Number of failures to trigger WCAF |
Global Output Variables
| Variable | Type | Description |
|---|
wcaf_triggered | bool | Whether WCAF rule fired |
error_message | string? | "Well should be replated due to multiple qc errors" or null |
affected_wells | array | Wells marked with WCAF error |
wcaf_cleared | bool | Whether WCAF error was removed |
REQ-RULES-WCAF-001: Detect and Mark Multiple Control Failures
| Variable | Type | Valid Values | Description |
|---|
countable_failures | int | 0, 1, 2, 3+ | Control failures with known mix |
total_controls | int | 0, 1, 2+ | Total control wells in run |
threshold | int | 2 | Failure threshold |
Output Variables
| Variable | Type | Description |
|---|
wcaf_triggered | bool | Rule fires when countable_failures >= threshold |
error_message | string? | Error text or null |
patient_samples_failed | bool | Patient samples fail by association |
Decision Table: Threshold Evaluation
| TV | countable_failures | threshold | wcaf_triggered | error_message | Covers |
|---|
| TV-001-001 | 0 | 2 | false | null | AC: 0 failures < threshold |
| TV-001-002 | 1 | 2 | false | null | AC: 1 failure < threshold |
| TV-001-003 | 2 | 2 | true | "Well should be replated due to multiple qc errors" | AC: Exactly 2 = threshold |
| TV-001-004 | 3 | 2 | true | "Well should be replated due to multiple qc errors" | AC: 3 failures > threshold |
| TV-001-005 | 5 | 2 | true | "Well should be replated due to multiple qc errors" | AC: Many failures > threshold |
Decision Table: Run-Level Scope
| TV | total_controls | control_statuses | countable_failures | wcaf_triggered | Covers |
|---|
| TV-001-006 | 0 | [] | 0 | false | AC: No controls = no trigger |
| TV-001-007 | 1 | [FAILED] | 1 | false | AC: Single control failure |
| TV-001-008 | 3 | [FAILED, FAILED, PASSED] | 2 | true | AC: 2 of 3 controls failed |
| TV-001-009 | 3 | [PASSED, PASSED, PASSED] | 0 | false | AC: All controls pass |
Decision Table: Patient Sample Association
| TV | wcaf_triggered | patient_wells_present | patient_samples_failed | Covers |
|---|
| TV-001-010 | true | true | true | AC: Patients fail by association |
| TV-001-011 | false | true | false | AC: No WCAF = patients unaffected |
| TV-001-012 | true | false | N/A | AC: No patients present |
REQ-RULES-WCAF-002: Exclude Unknown Mix Wells from Failure Counting
| Variable | Type | Valid Values | Description |
|---|
well.status | enum | PASSED, FAILED | Control well QC status |
well.mix_status | enum | known, unknown | Mix identifiability |
Output Variables
| Variable | Type | Description |
|---|
counted_toward_threshold | bool | Whether failure counts |
Decision Table: Mix Status Exclusion
| TV | well.status | well.mix_status | counted_toward_threshold | Covers |
|---|
| TV-002-001 | FAILED | known | true | AC: Known mix failure counts |
| TV-002-002 | FAILED | unknown | false | AC: Unknown mix excluded |
| TV-002-003 | PASSED | known | false | AC: Passed well not counted |
| TV-002-004 | PASSED | unknown | false | AC: Passed unknown not counted |
Decision Table: Combined Scenario - Mixed Known/Unknown
| TV | known_failures | unknown_failures | countable_total | wcaf_triggered | Covers |
|---|
| TV-002-005 | 1 | 1 | 1 | false | AC: 1 known + 1 unknown = 1 countable |
| TV-002-006 | 2 | 1 | 2 | true | AC: 2 known + 1 unknown = 2 countable |
| TV-002-007 | 0 | 3 | 0 | false | AC: 0 known + 3 unknown = 0 countable |
| TV-002-008 | 2 | 0 | 2 | true | AC: 2 known + 0 unknown = 2 countable |
REQ-RULES-WCAF-003: Clear Error When Failures Reduce Below Threshold
| Variable | Type | Valid Values | Description |
|---|
initial_failures | int | 2+ | Failures before resolution |
resolved_count | int | 1+ | Number of errors resolved |
remaining_failures | int | 0+ | Failures after resolution |
wcaf_error_present | bool | true | WCAF error exists before action |
Output Variables
| Variable | Type | Description |
|---|
wcaf_cleared | bool | WCAF error removed |
original_error_retained | bool | Original control error kept |
Decision Table: Re-evaluation After Resolution
| TV | initial_failures | resolved_count | remaining_failures | wcaf_cleared | Covers |
|---|
| TV-003-001 | 2 | 1 | 1 | true | AC: 2->1 = below threshold, clear |
| TV-003-002 | 3 | 1 | 2 | false | AC: 3->2 = at threshold, keep |
| TV-003-003 | 3 | 2 | 1 | true | AC: 3->1 = below threshold, clear |
| TV-003-004 | 4 | 2 | 2 | false | AC: 4->2 = at threshold, keep |
| TV-003-005 | 2 | 0 | 2 | false | AC: No resolution = keep |
Decision Table: WCAF Error Not Self-Counting
| TV | control_failures | wcaf_errors_on_wells | counted_failures | Covers |
|---|
| TV-003-006 | 2 | 2 | 2 | AC: WCAF errors not counted as failures |
| TV-003-007 | 1 | 1 | 1 | AC: Only original errors counted |
Decision Table: Original Error Retention
| TV | wcaf_cleared | original_error_present | original_error_retained | Covers |
|---|
| TV-003-008 | true | true | true | AC: Original error kept when WCAF clears |
| TV-003-009 | false | true | true | AC: Original error always retained |
| TV-003-010 | true | false | N/A | AC: No original error to retain |
Error Handling Test Vectors
Decision Table: Edge Cases
| TV | Scenario | Input State | Expected Behavior | Covers |
|---|
| TV-ERR-001 | Undetermined status | well.status = UNKNOWN | Skip well, log warning | AC: Unable to determine status |
| TV-ERR-002 | Empty run | control_wells = [] | No trigger (0 < 2) | AC: No controls in run |
Traceability to Existing Tests
| Requirement | Jira Tests | Automation Status | Config |
|---|
| REQ-RULES-WCAF-001 | BT-5248 (14 TVs) | Automated | v2 |
| REQ-RULES-WCAF-002 | BT-5248, BT-5300 | Automated | v2 |
| REQ-RULES-WCAF-003 | BT-5300 (4 TVs) | Automated | v2 |
Gap Analysis
Identified Gaps
| Gap | Requirement | Description | Priority | Remediation |
|---|
| None | - | All requirements have existing test coverage | - | - |
Coverage Notes
- BT-5248 covers core WCAF detection with 14 test vectors including threshold evaluation and unknown mix exclusion
- BT-5300 covers error clearing scenarios with 4 test vectors for resolution behavior
All acceptance criteria from the SRS have corresponding test vectors. No gaps identified. Note: Both tests use v2 configs.