MGBudapestEnglish
← Összes jelentés

Bevetés utáni jelentés · 02

Document intake: an LLM pipeline whose checks had to be checked

Invoices, delivery notes and receipts arrive through four channels, an LLM extracts their fields behind validation rules, and each customer's own automation passes the result on. Built alone with parallel AI coding agents, and verified without trusting their reports.

Ez a jelentés egyelőre csak angolul olvasható.

Ügyfél
Az ügyfél neve nem nyilvános
Szerep
Sole engineer — architecture, backend, frontend, deployment
Időszak
2026. január – 2026. október
Állapot
Átadva · Ügyfélmunka
Technológiák
TypeScript · NestJS · Prisma · PostgreSQL · BullMQ · React · Python · Docker

Situation

A client’s back office handled invoices, delivery notes and receipts by hand. Documents arrived by email, by upload, in shared folders and from the national e-invoicing system, and someone typed their fields into the next tool. The work was slow, and every typed field was a chance for an error that nobody would see until it mattered.

Mission

Build the platform end to end, as the only engineer: intake from every channel, field extraction by an LLM that is checked rather than trusted, automation each customer configures for themselves, strict separation between customers, and deployment on the client’s own infrastructure.

Execution

  • Intake. Upload, a mailbox, a watched Drive folder and a connection to the national e-invoicing API. An untrusted upload passes a virus-scanning sidecar before anything parses it, and an image sidecar prepares scans for extraction.
  • Extraction behind rules. An LLM extracts the fields, and validation rules check every one of them before it can reach a customer’s automation. I chose the production model by benchmarking candidates against a curated set of real documents, with a harness that keeps the comparison repeatable when a new model appears.
  • Automation as one document. Each customer’s chain of sources, stages and targets (ClickUp, webhooks, HTTP requests, exports, Drive or S3) is one JSON graph, edited in a visual editor and validated by the same schema on both sides. A document that fails validation is refused by name, never dropped silently.
  • Isolation that doesn’t depend on memory. The tenant filter is applied automatically below the application code, and the database refuses a row that points at another tenant’s data. A test sweep runs every model’s operations as one tenant against another’s rows and expects nothing back. Every route must name its authorization policy, and a test walks all routes to enforce it.
  • Work that survives a restart. Anything a customer is owed after a database commit is recorded as a state a sweep can find, so a restart between the commit and the follow-up work can no longer lose it.
  • Process. Parallel AI coding agents worked in separate git worktrees. Every new test guard had to be proven with a mutation probe: delete the guard, and the suite must fail.

What broke

  • The CI check never ran. The documented check was pnpm ci, which pnpm 11 treats as an alias for a clean install: it deleted the dependencies, exited with success, and never ran the project’s checks. By the time I caught it, “pnpm ci green” was the definition of done in several tickets and plan documents.
  • The agents graded their own homework. Parallel lanes reported near-perfect mutation scores. An independent re-measurement found surviving mutants in most of them. In one, a test fake returned an empty result for any query with an OR, so a whole recovery path was tested in a vacuum. The independent review also found real bugs the green suite had missed.
  • Local green and CI green measured different things. The end-to-end config reused any server already on its port. Tests ran against stale code, against another lane’s frontend, and once against the development database, where a test overwrote real e-invoicing credentials with fake ones and broke the live sync.
  • A failed image pull hid a regression. The object-storage vendor stopped publishing free container images, and even pinned tags started to fail. That red CI step masked an unrelated configuration regression for days. The storage moved to an open-source alternative.

Lessons

  • A green check is evidence only after you have seen it fail. Prove every guard with a probe, and prove the check itself runs.
  • Never accept a verification report from whoever did the work. Re-measure independently: agents and people alike.
  • Prove where a test ran. The lane’s port must refuse connections before the run and answer during it.
  • When you find a trap, search the whole repository for it, including plans and agent instructions, not just the file where it surfaced.