Skip to content

fix(dispatch): send split-EDI outputs instead of the original file - #40

Merged
dtg01100 merged 1 commit into
masterfrom
fix/split-edi-pipeline
Aug 9, 2026
Merged

dtg01100 merged 1 commit into
masterfrom
fix/split-edi-pipeline

Conversation

@dtg01100

@dtg01100 dtg01100 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

What

The production pipeline sent the original unsplit file when split_edi was enabled. EDISplitterStep.execute() wrote split outputs into a TemporaryDirectory it owned, deleted them before returning, and FileProcessor._run_splitting discarded the return value — so recipients got the wrong granularity and it was recorded as success. The correct split-aware flow existed only in dead code.

Changes

  • FileProcessor now drives splitting with a caller-owned temp dir (tracked on the processing context, cleaned up by the existing artifact cleanup) and converts + sends each split file through the normal send path.
  • UPC dictionary is threaded into the splitter, making category filtering actually work — including the filter-without-split case, which previously sent the unfiltered original.
  • EDISplitterStep.execute() is a compat shim that no longer deletes its outputs.
  • Pipeline imports in file_processor.py stay function-local to avoid reintroducing a module-level import cycle.

Tests

End-to-end tests run a real EDISplitterStep through FileProcessor.process_file with a snapshot backend asserting the delivered bytes are the split (and category-filtered) outputs — the original never reaches a backend. Verified with mutation testing: breaking UPC threading or temp-dir tracking makes every new e2e test fail.

2,506 passed, 0 failures across the dispatch unit + integration suites; ruff clean; no new mypy errors.

The splitter wrote split files into a TemporaryDirectory owned by
EDISplitterStep.execute(), which deleted them before returning, so the
production pipeline discarded the split outputs and sent the original
multi-invoice file — reported as a success. The working split-aware flow
lived only in dead code (DispatchOrchestrator._process_split_pipeline,
zero callers).

FileProcessor now drives splitting itself with a caller-owned temp dir
tracked on the processing context, converts and sends each split file
through the normal send path, and threads the UPC dictionary into the
splitter so category filtering works (also fixing the filter-without-split
case, which sent the unfiltered original). EDISplitterStep.execute() is
kept as a compat shim and no longer deletes its outputs.

Pipeline imports in file_processor stay function-local (TYPE_CHECKING for
annotations) so the new split flow does not reintroduce a module-level
dispatch.results -> dispatch.services -> dispatch.pipeline cycle.

Adds end-to-end tests through FileProcessor.process_file with a real
EDISplitterStep and a snapshot backend asserting the split files (and
their filtered variants) are what actually reach the backends.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
@dtg01100
dtg01100 force-pushed the fix/split-edi-pipeline branch from 4641e7a to b3ba869 Compare August 9, 2026 09:26
@dtg01100
dtg01100 merged commit 4644e87 into master Aug 9, 2026
1 check passed
@dtg01100
dtg01100 deleted the fix/split-edi-pipeline branch August 9, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant