Debug: two invoices on charge 01a1ea63-391b… were classified as OTHER instead of INVOICE

Aperta
#5,038 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Start by checking accounter_schema.documents for both IDs and tracing the stored files and charge through Deel sync, OCR, manual edits, and Green Invoice sync. Read packages/server/src/modules/deel/helpers/deel.helper.ts and packages/server/src/modules/app-providers/anthropic.ts; identify which path assigned OTHER, then add a regression test for that cause. Done means both records are INVOICE with the correct creditor and debtor, the charge ledger is regenerated, and the fix is merged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Two documents on charge 01a1ea63-391b-79dc-9be9-be1d04d7bb72 were saved with type = OTHER ("Other document"). They are invoices and should have been INVOICE.

Document ID Charge ID
01a1ea63-a06d-757e-aac7-ee24279b91c0 01a1ea63-391b-79dc-9be9-be1d04d7bb72
01a1ea63-5a60-7e9c-8a62-097e88150092 01a1ea63-391b-79dc-9be9-be1d04d7bb72

Because the type is OTHER, both documents have no creditor or debtor (figureOutSides returns {} for OTHER). They are also left out of VAT, ledger and match scoring as accounting documents.

Steps

  1. Find which path created the documents. Check accounter_schema.documents for both IDs: file/image URLs, file_hash, creation time, and whether a Deel or Green Invoice record is linked to them. Also check whether the charge has an email-ingestion record.
  2. Check the path's type logic. These are the places in packages/server that can set OTHER:
    • Deel sync: src/modules/deel/helpers/deel.helper.ts, around line 198. It sets DocumentType.Other whenever match.breakdown_contract_type === 'prepaid_billing'. If these are Deel invoices, this is the most likely cause. Confirm whether that rule is right for these invoices.
    • OCR (upload, email ingestion, re-OCR): src/modules/app-providers/anthropic.ts → extractInvoiceDetails. The model picks type from z.enum(DocumentType), so it may have returned OTHER itself. Re-run OCR on the stored files and look at the raw type returned. Then check whether the prompt needs guidance on when to use OTHER versus INVOICE.
    • Manual edits: check whether the type was changed after insert (e.g. by updateDocument).
    • Green Invoice sync: src/modules/green-invoice/helpers/green-invoice.helper.ts maps unknown types to UNPROCESSED, not OTHER, so this path is unlikely. Rule it out anyway.
  3. Fix the cause and add a regression test. Correct the two existing documents' types afterwards (with creditor and debtor) and regenerate the charge's ledger.

Acceptance criteria

  • We know which path set OTHER and why
  • The fix is merged, with a test covering this case
  • Both documents are INVOICE, with correct creditor and debtor
Lingua principale
TypeScript
Stelle
30
Fork
10
Merge medio
2g 12h
PR unite (30g)
276

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Urigo/accounter-fullstack

Tutte le issue di Urigo/accounter-fullstack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.