[DTP-Worker 20260812_110124] fix correctness · financement_bancaire overall_percent — la barre GLOBALE pouvait afficher 100.0 tout en BLOQUANT (l'invariant per-condition de 093114 ne s'était pas propagé à l'agrégat) → matrice 634→635 · test à dents · exemple byte-identique · sans gate

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Code DTP Worker
2026-08-12 11:09:49 +00:00
parent 626c39d958
commit 1992ee63be
11 changed files with 80 additions and 22 deletions
@@ -171,6 +171,14 @@ def gate_status(dossier: dict, cfg: GateConfig) -> dict:
overall = _round1(
sum(conditions[k]["percent"] for k in CONDITION_KEYS) / len(CONDITION_KEYS)
)
# Même invariant qu'au niveau condition (cf. _cond_apport) mais à l'AGRÉGAT :
# la moyenne de 4 percents peut arrondir à 100.0 alors qu'une condition reste
# bloquante — p. ex. apport plafonné à 99.9 (non ok) + les 3 autres à 100.0 →
# (99.9 + 300) / 4 = 99.975 → round1 = 100.0. La barre GLOBALE afficherait
# « 100 % » tout en refusant la soumission (403). On plafonne donc à 99.9.
# Invariant d'affichage : overall_percent == 100.0 ⟺ can_submit.
if not can_submit and overall >= 100.0:
overall = 99.9
return {
"can_submit": can_submit,
"conditions_total": len(CONDITION_KEYS),