feat(parser): scaffold parsing pipeline skeleton and static facade #89

Closed
opened 2026-07-07 09:26:11 +01:00 by TimCane · 0 comments
TimCane commented 2026-07-07 09:26:11 +01:00 (Migrated from github.com)

Parent: #77 (Phase A, step 1). Invariants live in the epic.

Stand up the pipeline shape without changing behaviour. This PR is pure
scaffolding: the facade still runs today's code path unchanged.

Anchors

  • backend/src/BillSplitter.Domain/ReceiptParser.cs - the whole static class to
    be decomposed over Phase A.
  • backend/src/BillSplitter.Domain/OcrResult.cs - OcrLine, OcrBox inputs.
  • backend/src/BillSplitter.Domain/ParsedReceipt.cs - ParsedReceipt,
    ParsedItem outputs (unchanged).
  • backend/src/BillSplitter.Infrastructure/Ocr/OcrWorker.cs:70 - the one call
    site; must stay ReceiptParser.Parse(result).

Steps

  1. Create BillSplitter.Domain/Parsing/**: Models, Normalization,
    Classification, Rules, Engine, Validation.
  2. Add scaffold models: LineType enum, ParseDecision, and move the private
    Candidate record (ReceiptParser.cs:319) into Models.
  3. Keep ReceiptParser.Parse(OcrResult) as a thin static facade that delegates
    to a new internal engine class which, for now, contains the current logic
    verbatim.

Done

  • Corpus 100% green, byte-identical output.
  • OcrWorker.cs:70 unchanged; no new dependencies; Domain stays pure.
  • docs/06 parsing section describes the new pipeline shape.
Parent: #77 (Phase A, step 1). Invariants live in the epic. Stand up the pipeline shape without changing behaviour. This PR is pure scaffolding: the facade still runs today's code path unchanged. ## Anchors - `backend/src/BillSplitter.Domain/ReceiptParser.cs` - the whole static class to be decomposed over Phase A. - `backend/src/BillSplitter.Domain/OcrResult.cs` - `OcrLine`, `OcrBox` inputs. - `backend/src/BillSplitter.Domain/ParsedReceipt.cs` - `ParsedReceipt`, `ParsedItem` outputs (unchanged). - `backend/src/BillSplitter.Infrastructure/Ocr/OcrWorker.cs:70` - the one call site; must stay `ReceiptParser.Parse(result)`. ## Steps 1. Create `BillSplitter.Domain/Parsing/**`: `Models`, `Normalization`, `Classification`, `Rules`, `Engine`, `Validation`. 2. Add scaffold models: `LineType` enum, `ParseDecision`, and move the private `Candidate` record (`ReceiptParser.cs:319`) into `Models`. 3. Keep `ReceiptParser.Parse(OcrResult)` as a thin static facade that delegates to a new internal engine class which, for now, contains the current logic verbatim. ## Done - [ ] Corpus 100% green, byte-identical output. - [ ] `OcrWorker.cs:70` unchanged; no new dependencies; Domain stays pure. - [ ] docs/06 parsing section describes the new pipeline shape.
Sign in to join this conversation.
No description provided.