Commit Graph

2 Commits

Author SHA1 Message Date
Nora 2c43a82390 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.
2026-07-08 22:41:10 -06:00
Nora b5b715d1c9 test(sp24): pure-unit tests for cyclone.reissue.core
15 cases covering the four public functions + the IG guard:

  - ig_correctness_check:
    * returns True when PATIENT_LOOP_DEFAULT_INCLUDED is False (default)
    * returns False when monkeypatched to True
    * emits a WARNING explaining the IG violation when tripped
    * parametrized binary pass/fail against [False, True]

  - parse_inputs:
    * AppleDouble metadata files (._foo.x12) are skipped
    * per-file parse failures land in errors[]; valid files survive
    * empty input dir → zero claims + zero errors (not an error)
    * returned objects are Pydantic ClaimOutput instances

  - emit_outputs:
    * filenames match the HCPF-spec tp<sender>-837P-<ts>-1of1.x12 shape
    * creates the output dir if missing
    * emitted X12 has no HL*3 + HL*2 child_count=0 (the IG-correct
      shape for SBR02='18' — the original 999 rejection root cause)

  - write_summary_sidecar: one row per emitted file with claim_id +
    output_file + byte_size.

  - zip_outputs:
    * testzip() returns None (integrity OK); entries round-trip
    * parent dirs of the zip path are created on demand.

Also bumps cyclone.reissue.core.ig_correctness_check to read
PATIENT_LOOP_DEFAULT_INCLUDED live (via the module attribute, not
the import-time name binding) so test monkeypatching takes effect
immediately.
2026-07-08 22:30:48 -06:00