Skip to content

feat(import): rework invoice ingestion end-to-end#33

Open
Ngob wants to merge 1 commit into
novalend:mainfrom
Ngob:feat/refactor_import
Open

feat(import): rework invoice ingestion end-to-end#33
Ngob wants to merge 1 commit into
novalend:mainfrom
Ngob:feat/refactor_import

Conversation

@Ngob

@Ngob Ngob commented Jul 20, 2026

Copy link
Copy Markdown

Replace the ad-hoc parser with a client-driven ingestion pipeline:

  • invoice:import <client> <path> ingests all-or-nothing, journals every attempt with a four-state status, and stays idempotent on client+file+hash.
  • Decoding goes through symfony/serializer behind per-format FormatStrategy (explicit or auto-detected) and per-shape MappingStrategy, ending at DTOs.
  • Rows are validated by the Symfony Validator; amounts are checked on the literal so NUMERIC(19,4) can't silently rewrite them.
  • Fixed SQL Injection
  • Allow adding a client from YAML
  • Prevent importing the same file more than once
  • Corrected update into insert (so lines are inserted)
  • Preventing update when multiple row with same "name" are in the files
  • Add a "client", so invoices can be from multiple different emitters

If I had more time, I would:

  • change the import architecture to an event driven one
  • Allow the mangement of clients inside the database

Replace the ad-hoc parser with a client-driven ingestion pipeline:

- `invoice:import <client> <path>` ingests all-or-nothing, journals every
  attempt with a four-state status, and stays idempotent on client+file+hash.
- Decoding goes through symfony/serializer behind per-format FormatStrategy
  (explicit or auto-detected) and per-shape MappingStrategy, ending at DTOs.
- Rows are validated by the Symfony Validator; amounts are checked on the
  literal so NUMERIC(19,4) can't silently rewrite them.
- Domain flattened into technical layers; ImportAttempt encapsulated behind
  transition methods; attempt persistence split into its own repository.
- PHPStan at max level across the codebase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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