Case study · 2026 to present · Anonymized
Rescuing an e-invoicing ETL that lost invoices without reporting an error
I inherited a pipeline that lost invoices and reported success. I audited it against production and put it under tests, CI and tag-based deployment. Today, if it fails, it ends in error and sends an email.
Areas
- Legacy systems
- Data and BI
- Automation and AI

Project facts
- Role
- Data engineer in charge of the rescue and of running the system
- Period
- Aug 2026 to present
- Technologies
- Python · Apache Airflow · Selenium · Oracle · MongoDB
- Public links
- Internal system: the code is private, and names, data and diagrams were left out or recreated.
At a glance
A process that loaded supplier invoices into the accounting system could lose invoices and still report that everything went fine.
74
audit findings, each one backed by evidence measured against production
Source: Technical audit of the system, August 2026
0 to 151
automated tests, in a codebase that arrived with none
Source: Repository pytest suite, September 2026
532
portal rows cross-checked against three databases to size an incident the same day
Source: Month-change incident record, September 2026
The problem
A pipeline built by a third party downloaded supplier e-invoices from the invoicing operator's portal, converted them and loaded them into the financial ERP of two companies, three times a day. It arrived with no version control, no tests and a serious defect, because it could lose invoices and still finish green.
Before:It lost invoices and the run finished as successful.
After:If a task does not load what it should, the run ends in error and sends an email.
Before:Nothing compared what was downloaded with what reached the ERP.
After:About 1,050 invoices from one month were checked one by one against the destination.
Before:It arrived with no version control and no tests.
After:Every change goes through automated tests and every run says which version ran.
The solution
My role
Data engineer in charge of the rescue and of running the system
Audited the whole system and documented 74 findings, with a summary for the business team.
Put it under git, tests, CI with branch protection and tag-based deployment, without stopping the daily runs.
Fixed the failures that lost invoices and migrated the primary key of the target tables, rehearsed first in development.
Run the system, including incidents, reconciliations, deployments and communication with the finance team.
Constraints
The process could not stop, because the accounts payable of two companies depend on it.
The source portal belongs to a third party and changes without notice, and downloading changes the state of the real process.
The target databases are shared with other systems, and every change is coordinated with their administrator.
The orchestrator is shared with six other workflows.
Decisions
Audit and measure before fixing
A baseline measured against production made it possible to prioritize by business impact and prove each improvement with numbers.
Ruled out
- Rewrite the pipeline from scratch
Extract a pure, tested domain from the scraping code
Calendar, pagination and classification rules moved into modules with no network or secrets, with doctests as the contract. They run in under a second without touching the portal.
Ruled out
- Test only end to end against the real portal
A run that loaded nothing ends in error
The original defect was reporting success without loading anything. Now every task verifies its result and, if the count does not add up, fails and sends an email alert.
Ruled out
- Add more retries and leave the status green
An MCP server to diagnose the orchestrator
It exposes runs, failures grouped by signature and root-cause analysis of logs as tools for an AI agent. The two tools that write simulate by default and require explicit confirmation.
Ruled out
- Read the logs by hand in the orchestrator UI
Architecture
01Source
- Invoicing operator portalPDF and XML for every invoice
02Orchestration
- DownloadSelenium Grid, calendar and paginated grid
- ConversionUBL XML to document
- LoadRouted by receiving company
03Stores
- Shared diskOriginal files
- MongoDBTraceability for every document
- Oracle per companyTables the ERP reads
04Consumer
- Financial ERPAccounts payable for two companies
05Operations
- ReconcilerCross-checks portal, disk, MongoDB and Oracle
- Diagnostic MCP serverRoot cause and simulated reprocessing
How data moves
- Invoicing operator portaltoDownloadThree times a day
- DownloadtoShared diskPDF and XML
- Shared disktoConversionFiles for the period
- ConversiontoMongoDBOne document per invoice
- MongoDBtoLoadPending invoices
- LoadtoOracle per companyInvoices per company
- Oracle per companytoFinancial ERPReceived in the ERP
- ReconcilertoOracle per companyVerifies invoice by invoice
- Diagnostic MCP servertoDownloadReads runs and logs through the orchestrator API
Results
If a run does not load what it downloaded, it ends in error and sends an email.
A month-change incident was sized the same day, with exactly 63 pending invoices, a reply to the business team before noon and a root fix tested live.
About 1,050 invoices from one month were verified one by one against the target database.
Every production log maps to its commit, because deployment is tag-based and each run prints its version.
What I would do differently
I would build the cross-store reconciler before any fix. It is what made it possible to count the invoices affected by each incident.
I would negotiate a test environment for the source portal from the start, because much of the risk came from not being able to rehearse downloads without touching the real process.
Technologies
- Oracle
- Legacy code rescue
- Incident forensics

