STD: Threshold Rule (THRESH)
Version: v1.0.0
Status: Draft
SRS Source: docusaurus/docs/srs/rules/rule-threshold.md
Rule Name: THRESHOLD
Domain: RULES-THRESH
Overview
This document specifies tests for the THRESHOLD rule using decision tables and test vectors. The rule validates that threshold values recorded in runfiles match the expected threshold values specified in mix setup configuration, raising errors when mismatches are detected or when threshold configuration is missing.
Rule Characteristics:
- Pure business logic (no UI)
- Exact comparison (runfile threshold == expected threshold)
- Permanent error persistence (non-resolvable)
- Missing configuration detection (THRESHOLD_MISSED)
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-THRESH-001 | Validate Threshold Value | 7 | 15 | 100% | None |
| REQ-RULES-THRESH-002 | Persist Threshold Errors | 4 | 6 | 100% | None |
| REQ-RULES-THRESH-003 | Missing Configuration Detection | 3 | 4 | 100% | None |
Totals: 3 REQs, 14 Conditions, 25 Test Vectors, 100% Coverage
| Variable | Type | Valid Values | Description |
|---|
obs.threshold | float | numeric | Runfile threshold value from observation |
config.target_threshold | float? | null, numeric | Expected threshold from mix setup configuration |
target.expected_threshold | int | 0-1000 (passive), 0-100000000 (non-passive) | Expected threshold from target configuration import |
target.is_passive | bool | true, false | Whether target is passive type |
well.errors | array | [], [THRESHOLD], [THRESHOLD_MISSED] | Current well error codes |
well.observations | array | observation records | Observations associated with well |
Output Variables
| Variable | Type | Description |
|---|
obs.error_code | string? | Error code applied to observation (THRESHOLD) |
well.error_code | string? | Error code applied to well (THRESHOLD_MISSED) |
error.resolvable | bool | Whether the error can be resolved (always false for THRESHOLD errors) |
obs.threshold_retained | float | Original threshold value retained after re-analysis |
REQ-RULES-THRESH-001: Validate Threshold Value
Acceptance Criteria Mapping
| AC ID | Acceptance Criterion | Test Vectors |
|---|
| AC-001-1 | Threshold mismatch raises THRESHOLD error | TV-001-001, TV-001-002 |
| AC-001-2 | Threshold match results in no error | TV-001-003, TV-001-004 |
| AC-001-3 | Comparison is exact (equal) | TV-001-005, TV-001-006 |
| AC-001-4 | Rule evaluates per observation | TV-001-001 through TV-001-006 |
| AC-001-5 | Threshold retrieved from target.expected_threshold via config import | TV-001-010 |
| AC-001-6 | Passive target expected_threshold range 0-1000 | TV-001-011, TV-001-012, TV-001-013 |
| AC-001-7 | Non-passive target expected_threshold range 0-100000000 | TV-001-014, TV-001-015 |
Decision Table: Threshold Validation
| TV | config.target_threshold | obs.threshold | match | error_code | Covers |
|---|
| TV-001-001 | 100.0 | 100.0 | true | null | AC: Exact match, no error |
| TV-001-002 | 100.0 | 99.0 | false | THRESHOLD | AC: Mismatch, error raised |
| TV-001-003 | 100.0 | 101.0 | false | THRESHOLD | AC: Mismatch above expected |
| TV-001-004 | 50.5 | 50.5 | true | null | AC: Decimal match |
| TV-001-005 | 50.5 | 50.500001 | false | THRESHOLD | AC: Near-miss (exact comparison) |
| TV-001-006 | 0.0 | 0.0 | true | null | AC: Zero threshold match |
Decision Table: Per-Observation Evaluation
| TV | observation_count | obs_1.threshold | obs_2.threshold | config.target | obs_1.error | obs_2.error | Covers |
|---|
| TV-001-007 | 2 | 100.0 | 100.0 | 100.0 | null | null | AC: Both match |
| TV-001-008 | 2 | 100.0 | 99.0 | 100.0 | null | THRESHOLD | AC: Independent evaluation |
| TV-001-009 | 2 | 99.0 | 99.0 | 100.0 | THRESHOLD | THRESHOLD | AC: Both fail |
Decision Table: Configuration Source
| TV | target.expected_threshold | config_import_performed | config.target_threshold | Covers |
|---|
| TV-001-010 | 500 | true | 500 | AC: Threshold retrieved from target config import |
Decision Table: Passive Target Range Validation
| TV | target.is_passive | target.expected_threshold | validation_result | error | Covers |
|---|
| TV-001-011 | true | 1000 | valid | null | AC: Passive upper boundary valid |
| TV-001-012 | true | 1001 | invalid | VALIDATION_ERROR | AC: Passive exceeds upper range |
| TV-001-013 | true | -1 | invalid | VALIDATION_ERROR | AC: Passive below lower range |
Decision Table: Non-Passive Target Range Validation
| TV | target.is_passive | target.expected_threshold | validation_result | error | Covers |
|---|
| TV-001-014 | false | 100000000 | valid | null | AC: Non-passive upper boundary valid |
| TV-001-015 | false | 100000001 | invalid | VALIDATION_ERROR | AC: Non-passive exceeds upper range |
REQ-RULES-THRESH-002: Persist Threshold Errors
Acceptance Criteria Mapping
| AC ID | Acceptance Criterion | Test Vectors |
|---|
| AC-002-1 | THRESHOLD error is not resolvable via UI | TV-002-001 |
| AC-002-2 | Error cannot be removed from well | TV-002-002 |
| AC-002-3 | Re-analysis retains threshold error | TV-002-003, TV-002-004 |
| AC-002-4 | Original threshold retained for re-analysis | TV-002-005, TV-002-006 |
Decision Table: Error Resolution Blocking
| TV | well.errors | resolution_attempt | resolution_blocked | error_persists | Covers |
|---|
| TV-002-001 | [THRESHOLD] | resolve_error | true | true | AC: Resolution blocked |
| TV-002-002 | [THRESHOLD] | remove_error | true | true | AC: Removal blocked |
Decision Table: Re-Analysis Behavior
| TV | initial_error | reanalysis_performed | final_error | original_threshold_retained | Covers |
|---|
| TV-002-003 | THRESHOLD | true | THRESHOLD | true | AC: Error persists |
| TV-002-004 | THRESHOLD_MISSED | true | THRESHOLD_MISSED | true | AC: MISSED error persists |
| TV-002-005 | THRESHOLD | true | THRESHOLD | true | AC: Original value used |
| TV-002-006 | null | true | null | true | AC: No error to persist |
REQ-RULES-THRESH-003: Missing Configuration Detection
Acceptance Criteria Mapping
| AC ID | Acceptance Criterion | Test Vectors |
|---|
| AC-003-1 | targetThreshold = null triggers THRESHOLD_MISSED | TV-003-001 |
| AC-003-2 | Error applied at well level | TV-003-002, TV-003-003 |
| AC-003-3 | Configuration check precedes validation | TV-003-004 |
Decision Table: Missing Configuration Detection
| TV | config.target_threshold | obs.threshold | error_code | error_level | Covers |
|---|
| TV-003-001 | null | 100.0 | THRESHOLD_MISSED | well | AC: Missing config detected |
| TV-003-002 | null | 50.0 | THRESHOLD_MISSED | well | AC: Error at well level |
| TV-003-003 | undefined | 100.0 | THRESHOLD_MISSED | well | AC: Undefined treated as null |
| TV-003-004 | 100.0 | 100.0 | null | n/a | AC: Config present, no MISSED error |
Decision Table: Configuration Check Precedence
| TV | config.target_threshold | obs.threshold | checked_first | result | Covers |
|---|
| TV-003-005 | null | 99.0 | config_present | THRESHOLD_MISSED | AC: Missing config checked first |
| TV-003-006 | 100.0 | 99.0 | config_present | THRESHOLD | AC: With config, proceeds to validation |
Traceability to Existing Tests
| Requirement | Jira Tests | Automation Status |
|---|
| REQ-RULES-THRESH-001 | BT-5172 | Automated (v3 config) |
| REQ-RULES-THRESH-002 | BT-1629 | Manual (reanalysis persistence test) |
| REQ-RULES-THRESH-003 | BT-1437 | Automated |
Gap Analysis
Identified Gaps
| Gap | Requirement | Description | Priority | Owner |
|---|
| None | - | All requirements have associated test coverage | - | - |
Boundary Value Coverage
| Boundary | Test Vector | Status |
|---|
| Exact match | TV-001-001, TV-001-004 | Covered |
| Near-miss values | TV-001-005 | Covered |
| Zero threshold | TV-001-006 | Covered |
| Null configuration | TV-003-001, TV-003-003 | Covered |
| Multiple observations | TV-001-007 through TV-001-009 | Covered |
| Passive range upper boundary (1000) | TV-001-011 | Covered |
| Passive range exceeded (1001) | TV-001-012 | Covered |
| Passive range below minimum (-1) | TV-001-013 | Covered |
| Non-passive range upper boundary (100000000) | TV-001-014 | Covered |
| Non-passive range exceeded (100000001) | TV-001-015 | Covered |