[DTP-Worker 20260812_093114] fix correctness · financement_bancaire gate — un dossier incomplet pouvait afficher percent 100.0 (barre pleine ✓) tout en BLOQUANT
Défaut latent, byte-repro-aveugle : _cond_apport arrondit percent à 1 décimale (round) tandis que ok est un test exact. Un versement dans la bande [99.95%,100%[ (ex. 19 999/20 000 USD = 99.995%) remonte à percent:100.0 alors que ok=False, remaining=1 USD → barre frontend « 100% ✓ » qui refuse la soumission + raison auto-contradictoire « reste 1 USD · 100.0% ». Seul _cond_apport atteignable (montant continu) ; documents/autorisations = ratios entiers sur listes 13/4, bande inatteignable. Fix chirurgical : garde `if not ok and pct>=100.0: pct=99.9` → invariant d'affichage percent==100.0 ⟺ ok. Échantillon commité à 67.8% (hors bande) → gate_status_example.json/out rebuild BYTE-IDENTIQUE. Test à dents test_apport_quasi_complet_ninclut_pas_100pct (mordu sans le fix). Cascade +1 test : régression 633→634/616→617, plan+MANIFEST+quality_report régénérés, fiches QA/Backend/CRM re-dérivées. run_ci 33/0/0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -94,9 +94,18 @@ def _cond_apport(dossier: dict, cfg: GateConfig) -> dict:
|
||||
required = apport_requis_usd(dossier.get("prix_usd", 0), residence, cfg)
|
||||
paid = apport_verse_usd(dossier)
|
||||
remaining = round(max(0.0, required - paid), 2)
|
||||
ok = paid + 1e-9 >= required
|
||||
pct = _round1(min(100.0, (paid / required * 100.0) if required > 0 else 100.0))
|
||||
# Un versement dans la bande [99.95 %, 100 %[ (p. ex. 19 999/20 000 USD)
|
||||
# remonterait à 100.0 par l'arrondi 1-décimale, alors que le gate BLOQUE
|
||||
# (ok=False, remaining>0). La barre de progression afficherait « 100 % ✓ »
|
||||
# tout en refusant la soumission, et la raison lirait « reste 1 USD · 100 %».
|
||||
# Invariant d'affichage : percent == 100.0 ⟺ ok — un dossier incomplet
|
||||
# plafonne à 99.9 (plus grande valeur 1-décimale strictement < 100).
|
||||
if not ok and pct >= 100.0:
|
||||
pct = 99.9
|
||||
return {
|
||||
"ok": paid + 1e-9 >= required,
|
||||
"ok": ok,
|
||||
"required": required,
|
||||
"paid": paid,
|
||||
"remaining": remaining,
|
||||
|
||||
Reference in New Issue
Block a user