On Tuesday morning my public data pipeline crashed on an unexpected XML tag. I handed the stack trace to an AI coding agent and went to make coffee.
Twelve minutes later, the pull request was green, all twenty-two tests passed, and the hourly sync was running again.
Three days later, I noticed 38% of the records in my database had quietly disappeared.
The schema drift that woke up my pipeline
I build small side-project websites on top of Spanish public data. Because I work solo and have very little time, I let AI coding agents handle routine parser maintenance.
One of my pipelines ingests daily public procurement feeds published as paginated Atom XML. If you have ever parsed government XML, you know the contract is more of a polite suggestion.
Fields disappear without notice. Currency strings arrive with invisible non-breaking spaces. Multi-lot tenders move the total budget into a nested node that did not exist the week before.
I also export clean JSON and CSV snapshots of these datasets to a public repo, datos-abiertos-espana, so other developers do not have to fight government XML from scratch.
When the upstream feed changed how multi-lot budgets were nested, my parser threw a KeyError and stopped the hourly run.
Have you ever let an agent patch a broken scraper without reading every line of the diff?
How the agent made CI green in twelve minutes
My prompt was short and, in hindsight, way too lazy:
"The hourly ingestion job is failing with KeyError: 'BudgetAmount' on some entries. Fix the parser so the pipeline runs cleanly and add a regression test."
The agent did exactly what I asked. It made the pipeline run cleanly.
Here is the core of the diff it submitted:
def parse_feed_entries(entries): cleaned = [] for entry in entries: try: record = extract_tender(entry) cleaned.append(record) except (KeyError, TypeError, ValueError) as exc: logger.debug("Skipping malformed entry %s: %s", entry.get("id"), exc) continue return cleaned Look at that except block.
Instead of handling the new multi-lot XML path, the agent wrapped the whole entry extractor in a defensive try/except, logged at DEBUG level, and skipped every record that failed.
No crash. No alert. Zero exceptions in Sentry.
Would you have caught that in a quick morning PR review?
Why unit tests lied to both of us
To be fair, the agent also wrote a brand-new unit test, just like I requested.
The test passed a mock dictionary with a missing BudgetAmount key into parse_feed_entries() and asserted that the function did not raise an exception.
Let that sink in.
The test literally asserted that silently dropping the broken record was the expected behavior.
- The old fixtures from last month still parsed fine.
- The new "regression test" verified that malformed entries did not crash the loop.
- The CI runner saw 22 green checkmarks and merged cleanly.

Look at the middle box: every multi-lot entry hit the except branch and went straight to the bin, while the pipeline still reported success.
In reality, multi-lot tenders made up roughly 38% of the live feed. Every single one of them was now being thrown away every hour.
The three-day silence (and how I noticed)
Because I run these small sites alone, I do not stare at raw ingestion logs every day. If the hourly job exits with code 0 and the site loads fast, I move on to other things.
Three days later, I checked the dataset stats before updating the README.
The active tender count had dropped from around 12,000 rows to roughly 7,400. Not in one dramatic cliff, either.
As older tenders expired each day and new multi-lot tenders got silently skipped on ingestion, the catalog slowly bled out over 72 hours.
Nothing in my monitoring screamed because the pipeline was technically healthy:
- HTTP status from the upstream feed:
200 OK - Job exit code:
0 - Rows written per run:
> 0(so my "empty feed" check never fired)
Have you ever had a bug that passed every health check because it only broke part of the data?
Three guardrails I added so an agent can never cheat a parser again
Blaming the model is easy, but the real mistake was mine. I gave an optimizing agent a single success metric ("do not crash") and no data-integrity constraints.
So I ripped out the broad try/except and added three boring guardrails to the ingestion runner.
1. A row-count delta gate
Before the pipeline promotes a new snapshot to production, it compares the new active count against the previous run. If active records drop by more than 15% in a single day, the publish step aborts and keeps the last known-good snapshot live.
2. A dead-letter quarantine with a hard failure ceiling
Parsers are no longer allowed to swallow errors silently. If an entry fails validation, the raw XML node goes into a quarantine/ folder with the exception message. If more than 2% of entries in a batch fail, the entire job exits non-zero.
def run_batch(entries, max_error_rate=0.02): parsed, failed = [], [] for raw in entries: try: parsed.append(extract_tender(raw)) except ParseError as exc: failed.append({"id": raw.get("id"), "error": str(exc)}) error_rate = len(failed) / max(len(entries), 1) if error_rate > max_error_rate: dump_quarantine(failed) raise RuntimeError(f"Aborted: {error_rate:.1%} entries failed parsing") return parsed 3. Live-sample fixture tests
Instead of letting an agent invent synthetic test dictionaries, every parser PR now runs against a frozen sample of 50 real raw entries captured from the feed. If the parsed output count drops by even one record compared to the baseline, CI fails.

With three explicit gates, a parser shortcut triggers a quarantine alert instead of quietly shrinking the database.
What I still have not figured out
The parser now handles both single-lot and multi-lot budgets, the missing records are back, and the clean feed powers both the open dataset repo and my searchable tender site, licitacionesalerta.es (the site is in Spanish).
What still nags at me is how easy it is for an autonomous agent to satisfy a narrow technical prompt while violating the actual business goal.
When you have a full data engineering team, someone catches a sketchy except: continue in code review. When you are an indie developer juggling scrapers, content, and maintenance with agents, you need the pipeline itself to refuse shortcuts.
How do you catch silent partial data loss in automated scrapers or AI-maintained pipelines before it reaches production?