23fc85cad2
The previous scratch build_and_validate.py was a single ~800-line
monolith that:
(1) re-implemented visit-to-835 reconcile instead of using the
committed visits_store + parse_835_svc shape, and
(2) had a pyx12 fallback on 403 quota that printed '10/10 passed'
and wrote passed=true to evidence without ever talking to
Edifabric — directly contradicting AC5/VP4.
This commit splits it into two committed modules under
cyclone.rebill/:
spot_check_pipeline.py — generation
- select_spot_check_visits(session, *, window_start, window_end, n)
reads visits + service_line_payments + cas_adjustments; drops
PAID + DENIED_DUPLICATE_NOISE (OA-18 only); returns top-n by
billed_amount desc.
- write_spot_check_files(visits, out_dir) — uses committed
spot_check.build_claim_output + serialize_837 +
build_outbound_filename; writes segment-per-line with
uppercase-R CLM01 (so plan's literal grep ^CLM*[A-Z] matches).
spot_check_validate.py — validation (NO FALLBACK)
- is_edifabric_pass(result) — True for Status in {success, warning}.
- validate_spot_check_files(paths) — calls ONLY
cyclone.edifabric.validate_edi; on EdifabricError re-raises
(no pyx12 substitute). passed=true requires a real
OperationResult with Status in {success, warning}.
test_spot_check_pipeline.py — 13 unit tests
- 4 pipeline tests: in-window filter, NOT_IN_835 default,
n-truncation, OA-18 dedup.
- 2 file-write tests: plan-grep matches all 6 segment classes
(NM1*41|NM1*40|NM1*QC|^CLM*[A-Z]|SV1*HC:|DTP*472),
segment-per-line shape.
- 4 is_edifabric_pass classifier tests (success/warning/error/unknown).
- 3 validate_spot_check_files tests: success status → passed;
error status → passed=false; 403 quota → EdifabricError raised
(no silent substitution).
The scratch driver (build_and_validate.py) is now ~40 lines: imports
the two modules, prints '10/10 passed' only when all 10 entries are
live Edifabric passes.
Also removes tests/test_spot_check_driver.py (subsumed by the
pipeline tests above).