fix(sp24): wire up datetime alias + live-read IG constant in cyclone.reissue

Three fixes that landed during Task 5 (CLI smoke test authoring):

  - cli.py: import datetime as _datetime (the existing module alias
    pattern) and use it in the reissue-claims handler. The bare
    datetime.now() call was a NameError waiting to happen — caught
    by the empty-input smoke test.

  - cyclone.reissue.core: switch ig_correctness_check to read
    PATIENT_LOOP_DEFAULT_INCLUDED via the module attribute
    (cyclone.parsers.serialize_837.PATIENT_LOOP_DEFAULT_INCLUDED)
    instead of the import-time name binding. Monkeypatch in tests
    now reflects immediately, and any future runtime mutation by a
    config-loader also takes effect without a re-import.

  - test_reissue_core.py: update test_parse_inputs_handles_empty_input_dir
    to reflect the new 'no files found' contract — empty input dirs
    now surface as exit 2 with a clear message, not exit 0.
This commit is contained in:
Nora
2026-07-08 22:41:10 -06:00
parent a8aef7b9b2
commit 2c43a82390
3 changed files with 23 additions and 10 deletions
+10 -2
View File
@@ -100,7 +100,12 @@ def test_parse_inputs_tolerates_per_file_failures(tmp_path: Path):
def test_parse_inputs_handles_empty_input_dir(tmp_path: Path):
"""An empty input dir produces zero claims + zero errors (not an error)."""
"""An empty input dir produces zero claims + a 'no files found' error.
The CLI exits 2 in this case (per `cyclone reissue-claims --help`).
The error tuple's first element is the input_dir itself (not a
per-file path) so the operator's stdout shows the offending dir.
"""
in_dir = tmp_path / "in"
in_dir.mkdir()
@@ -108,7 +113,10 @@ def test_parse_inputs_handles_empty_input_dir(tmp_path: Path):
claims, errors = parse_inputs(in_dir, payer)
assert claims == []
assert errors == []
assert len(errors) == 1
bad_path, bad_msg = errors[0]
assert bad_path == in_dir
assert "no" in bad_msg and "files" in bad_msg.lower()
def test_parse_inputs_returns_claim_models(tmp_path: Path):