mediation

The rule catalogue and the release gate

Twenty-one numbered rules, and the one call a release path makes.

The rule catalogue (V01–V21)

Codes are stable and never reused.

RuleDetectsBlocks
V01 UnassignedOffsetUTC offset outside UTC−12:00 … UTC+14:00✅
V02 FutureTimestamprecord opens after the evaluation instant✅
V03 ClosedBeforeOpenedrecord closes before it opens✅
V04 DurationExceedsSpanduration longer than the wall-clock span✅
V05 ImplausibleVolumevolume the elapsed time could not have carried—
V06 ZeroUsageno quantity at all—
V07 ContainerSumMismatchcontainer sum disagrees with the record total✅
V08 UnattributablePartyno charged party could be determined✅
V09 NotKeyableno natural key✅
V10 BeyondDeadlinepast the inclusion deadline✅
V11 LateArrivallate, still billable—
V12 ServingNetworkAbsentno serving network (not for wireline, IMS, fixed access)—
V13 QuantityDoesNotMatchServicequantity does not match the service—
V14 CheckDigitFailureidentifier check digit does not verify—
V15 VolumeOverflowthe record's directions or containers overflow when summed✅
V16 UnorderedSeriesinput not in ascending instant order—
V17 DuplicateRecordretransmission of a record already seen—
V18 SequenceGapsource sequence has an unfilled hole, or regressed—¹
V19 OrphanPartialrun of partials can never be reassembled✅
V20 IncompleteReassemblyrun of partials is missing members, the first included✅
V21 JurisdictionConflictserving network and location disagree on country✅

¹ The source's records are held instead; the finding lists the files to request. Escalate it to block the whole batch.

  • validate_records is pure; V17–V20 come from the stateful dedup, sequence and partial stages.
  • V16 is reported once per slice; in process it checks only ingested records.
  • ValidationConfig::escalating raises a rule to blocking everywhere. Nothing lowers a severity.

The release gate

score_batch answers "may this batch be invoiced?" with every blocker.

BlockerMeaning
Unbalancedthe conservation law does not hold
IncompleteSourcesa released source has a sequence hole
BlockingFindingsa blocking finding
use mediation::{BatchReconciliation, Disposition, QualityGrade, ValidationReport, score_batch};

let counts: BatchReconciliation = vec![Disposition::Billable; 1_000_000].into_iter().collect();

// Clean records cannot outvote unknown completeness.
let report = score_batch(&counts, &ValidationReport::new(), false);
assert_eq!(report.grade, QualityGrade::F);
assert!(report.blocks_release());

The third argument says whether every source the batch releases from is complete. score_dispositions, used by process, also ignores blocking findings on records already rejected or held. Grade thresholds are fixed proportions.

Improve this page on GitHub