Repository navigation
fix: circuit breaker, estado INACTIVO y fallback SOAP apagado por defecto - #12
Merged
Merged
Conversation
…aker Un RNC inexistente es una respuesta autoritativa de la DGII, no una falla del servicio. El breaker lo contaba como fallo: tras 5 consultas seguidas de RNCs inexistentes, DgiiClient abría el circuito de scraping y cualquier consulta, incluso de un RNC real, lanzaba AllStrategiesFailedError durante 60 segundos. Ahora DgiiNotFoundError cuenta como éxito para el circuito y se sigue propagando al llamador.
El parser usaba includes('ACTIVO'), así que un estado INACTIVO se
reportaba como ACTIVO. Ahora compara el estado completo, normalizado a
mayúsculas y sin espacios sobrantes.
La DGII responde con un mensaje de campo requerido si falta el código de seguridad, igual que con el RNC comprador. Verificado en vivo con el e-NCF E310125217173 el 2026-09-22.
La DGII bloqueó el endpoint SOAP en enero 2025. Con el fallback activo por defecto, cada falla del scraping costaba una petición inútil, y si el endpoint respondiera vacío el parser SOAP lo reportaría como DgiiNotFoundError: una caída se vería como "RNC no registrado". soapFallback ahora es false por defecto; se puede activar con soapFallback: true. BREAKING CHANGE: DgiiClient ya no intenta SOAP a menos que se pase soapFallback: true.
Owner
Author
|
Agregado tras el code review: |
…casos de estado y soapFallback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué corrige
DgiiNotFoundError.ConsecutiveBreakercontaba un RNC inexistente como fallo. Tras 5 consultas seguidas de RNCs inexistentes,DgiiClientabría el circuito de scraping y toda consulta, incluso de un RNC real, lanzabaAllStrategiesFailedError("Circuito abierto") por 60 segundos. AhoraDgiiNotFoundErrorcuenta como éxito para el circuito y se sigue propagando.estadoINACTIVO.parseContribuyenteHtmlusabaincludes('ACTIVO'), así que un estadoINACTIVOsalía comoACTIVO. Ahora compara el valor completo normalizado.Cómo se verificó
npm run typecheck,npx vitest run --coverage: 313 tests, umbrales de cobertura OK.fetchsimulado contradist/: antes, las consultas 6 y 7 lanzabanAllStrategiesFailedError; ahora las 7 lanzanDgiiNotFoundError.node scripts/smoke-test.mjscontra la DGII real: 4/4.Encontrados al preparar el skill para agentes; el skill documentará el comportamiento corregido.