← all branches

fix/cfdi-columns

needs attentionviewing older commit
0869f39 · fullpre-PRreviewed 2026-08-05 13:58 UTC1H · 8M · 5L · 5I
The branch
Purpose
Historical CFE bills are missing CFDI stamp metadata because the old parser never walked cfdi:Complemento. Text-typed fields were rendering as numbers. Two enterprise customers raised the issue.
Goal
Surface CFDI fiscal stamp state on all existing bills and fix column rendering for text-typed concepts
Sub-goals
  • SG-1: Extend xml-parser to read cfdi:Complemento
  • SG-2: Fix repeated-element array stringification
  • SG-3: Derive cfdiStampStatus from UUID + error presence
  • SG-4: Fix decideColumnType to use units catalog
  • SG-5: Seed 4 new concepts into 11 tariff catalogs
  • SG-6: Backfill 143k XML-backed bills
  • SG-7: Add parseOrgs + orgInFilter for per-customer ramp
The changes (whole branch)
What
XML parser extended. decideColumnType refactored. 11 tariff JSONs + CANONICAL seeded. New backfill + rollback scripts. ops-guards gets parseOrgs + orgInFilter.
Why
cfdi:Complemento was outside the parser's walk path. Repeated XML elements produced comma-joined garbage. decideColumnType defaulted to number for unknown units.
Areas
services/utility/bills/cfe+3287domains/utility+2793scripts+4480packages/database+780docs/development+1820
Blast
23 files, +1332/-7. Parser change affects all CFE XML ingestion. decideColumnType touches all bill table rendering.
CFE backfill data-migration
CI· pre-PR branchCodeRabbitcorrectnesssecurityconventionstestsimprovementseo

Findings · 9

correctness2

high

Idempotency gate skips bills with cfdiStampStatus from Lambda before backfill runs

scripts/backfill-cfdi-fiscal-concepts.ts:191

byKey.has('cfdiStampStatus') && needsRepair.length===0 short-circuits even if error fields are absent. Fix: check all needed keys, not just the sentinel.

medium

deriveStampStatus: ErrorCodigo alone does not trigger Error de timbrado

services/utility/bills/cfe/src/file-processor/xml-parser/xml-parser.ts:496

security2

medium

parseOrgs accepts unvalidated argv strings

packages/database/src/ops-guards.ts

medium

guardConnection is process-discipline, not a technical safeguard

packages/database/src/ops-guards.ts

tests4

medium

cfdiStampStatus: missing edge case — UUID placeholder + error code both present

services/utility/bills/cfe/__tests__/unit/file-processor/xml-parser.test.ts

medium

firstMeaningfulEntry: no test for whitespace-only first occurrence

services/utility/bills/cfe/__tests__/unit/file-processor/xml-parser.test.ts

medium

No test verifying CANONICAL covers all concepts in tariff JSONs

domains/utility/src/bill-concepts-catalog/__tests__/bill-concepts-catalog.decisions.test.ts

medium

decideColumnType regression coverage narrow

domains/utility/src/bill-concepts-catalog/__tests__/bill-concepts-catalog.decisions.test.ts

improvement1

medium

Second idempotency check (line 195) is structurally dead code

scripts/backfill-cfdi-fiscal-concepts.ts:195

History · 4 commits

  1. f88ee88needs attentionincremental0H · 1M · 1L2026-08-10 16:25
  2. 0869f39needs attentionfull1H · 8M · 5L2026-08-05 13:58current
  3. 74e05c5safeincremental0H · 0M · 0L2026-08-04 22:43
  4. c4c442fneeds attentionfull0H · 8M · 9L2026-08-04 17:57