feat(parser): add in-memory parse-decision trace #107

Merged
TimCane merged 4 commits from feat/94-parse-decision-trace into main 2026-07-07 12:27:10 +01:00
TimCane commented 2026-07-07 12:10:00 +01:00 (Migrated from github.com)

Summary

  • Record a ParseDecision per priced line (winning rule, score, evidence) in the item and bill engines
  • Return the trace via internal ReceiptParseEngine.ParseTraced; the public ReceiptParser.Parse facade discards it, so OcrWorker and the ParsedReceipt wire contract are unchanged
  • Keep the trace in-memory and test-only - never on the wire, never logged (no-PII rule); separate from the existing discard Warnings
  • Expose the engine to BillSplitter.Tests via InternalsVisibleTo

Test plan

  • dotnet test green: 91 passed, the 34-fixture corpus byte-identical (no expected.json changed)
  • New ReceiptParseTraceTests asserts the deciding rule/score off the trace - e.g. UnitPriceColumnRule at score 60 winning 2 Roast Beef 27.00 54.00
  • Asserts the trace is absent from the public ParsedReceipt

Closes #94

## Summary - Record a `ParseDecision` per priced line (winning rule, score, evidence) in the item and bill engines - Return the trace via internal `ReceiptParseEngine.ParseTraced`; the public `ReceiptParser.Parse` facade discards it, so `OcrWorker` and the `ParsedReceipt` wire contract are unchanged - Keep the trace in-memory and test-only - never on the wire, never logged (no-PII rule); separate from the existing discard `Warnings` - Expose the engine to `BillSplitter.Tests` via `InternalsVisibleTo` ## Test plan - `dotnet test` green: 91 passed, the 34-fixture corpus byte-identical (no `expected.json` changed) - New `ReceiptParseTraceTests` asserts the deciding rule/score off the trace - e.g. `UnitPriceColumnRule` at score 60 winning `2 Roast Beef 27.00 54.00` - Asserts the trace is absent from the public `ParsedReceipt` Closes #94
Sign in to join this conversation.
No description provided.