ETQ usager, je peux déposer mon dossier même si la vérification du SIRET est temporairement indisponible#13435
Conversation
3f58eb0 to
5a370cc
Compare
e09ec54 to
80e128d
Compare
mfo
left a comment
There was a problem hiding this comment.
lgtm, je te propose 3 patches :
- côté remontée quand l'API est down/429, je pense qu'on peut rester sur l'input_status_message_component, c'est son role
- plus discutable (a prendre ou aps), pas certains qu'on souhatie laisser passer des 401/403 etc...
- il y avait un angle mort côté dependant_conditions, je pense que tu peux embarquer ce patch les yeux fermer
| @@ -34,17 +52,33 @@ def ready_for_external_call? | |||
|
|
|||
| def fetch_external_data | |||
| case APIEntrepriseService.create_etablissement_with_fallback(self, external_id.delete(" "), dossier.user&.id) | |||
There was a problem hiding this comment.
on creait déjà l'etb en mode degradé quand api down ou 429, j'ai donc pas trop compris ces changements (on gere les 401/403/409/422/451...). Or dans ces cas la, je ne suis pas certains qu'on souhaite passer le dossier (a la limite, le 409 arrive quand on requete le meme objet au mm moment, limite faudrait remonter le cas dans APIEntrepriseService.create_etablissement_with_fallback).
Propale pour simplifier :
0001-simplify-siret_champ-remove-redundant-degraded-mode-.patch
There was a problem hiding this comment.
Effectivement, c'est peut-être pas une bonne idée de laisser passer sans distinction tout ce qui est 401/403/409/422/451...
Peut-être qu'il faut traiter différemment selon les erreurs.
Vu que le but de la fonctionnalité est de diminuer la gêne pour les usagers dans des cas où ça peut être rattrapé ensuite, je verrais bien :
- 401 (Unauthorized) / 403 (Forbidden) / 409 (collision de requête) -> dépôt possible avec degraded_mode (par ex. via create_etablissement_with_fallback) + sentry -> rattrapé par les jobs mais surtout par le cron Cron::BackfillSiretDegradedModeJob une fois que le problème est réparé côté administration.
- 451 (indispo pour raison légale) / 422 (requête invalide) : blocage du dépôt + sentry
| transitions from: [:fetching], to: :fetched | ||
| # waiting_for_job: a champ can converge to fetched from the retry_on | ||
| # exhaustion block (see #handle_exhausted_external_data_retries!) | ||
| transitions from: [:fetching, :waiting_for_job], to: :fetched |
There was a problem hiding this comment.
Je suis un peu embété d'avoir un état fetched pour un champ ... qui ne l'ai pas. De plus, on va chercher a étendre cette mécanique à d'autres champs connectés.
Du coup, je te proposerai bien, dans la machine à état, d'introduire un nouvelle état degraded et une nouvelle transition exhausted_retry! qui irait de waiting_for_job -> degraded
cc757c1 to
4ebf9ab
Compare
Legacy services produce a Failure without a code key, which raised NoMatchingPatternKeyError in handle_result. Persist the exception with a nil code and move the champ to external_error instead.
Lenient validation for Champs::SiretChamp: only a 404 (nonexistent SIRET) blocks submission; pending and technical errors do not, and a syntactically valid SIRET satisfies the mandatory check. Ref #12997
…n is unavailable SiretChamp#external_data_status_message returns :technical_error on a non-404 fetch failure; the SIRET component renders an informative banner. The old red warning on external_error is removed.
Instead of converting the degraded Success into a retryable 503, keep the champ fetched: submission works naturally and instructeurs are already blocked by Dossier#any_etablissement_as_degraded_mode?.
…ition A condition can target a column of a SIRET champ (value_json), so it cannot be evaluated until the data is fetched. In that case the historical blocking validation is restored via dependent_conditions?.
Exhausted retries or a non-retryable non-404 failure now create a degraded etablissement (champ fetched) so acceptance stays blocked and backfill jobs recover the data. Only a 404 ends in external_error.
OCRService was the only fetch_external_data producer returning a Failure without a code key. Fix it at the source and remove the code-less pattern-match arm from ChampExternalDataConcern.
…ons depending on public champs
…mponent The degraded-mode message was rendered directly in SiretComponent, bypassing the component that owns the a11y contract (fr-messages-group, aria-describedby). Move it into the :siret branch, keeping it hidden when the champ feeds a condition since submission is then blocked. Co-authored-by: mfo <mfo@users.noreply.github.com>
4ebf9ab to
4999040
Compare
Same structure, clearer vocabulary: lenient_validate -> permissive_validate, legacy_validate -> strict_validate, lenient_external_data_validation? -> permissive_external_data_validation?.
4999040 to
29472ae
Compare
Résumé
Voir #12997 (périmètre SIRET)
any_etablissement_as_degraded_mode?, données rattrapées par les jobs de backfill existants.Pour tester
http://localhost:3000/profil?context=administrateur)127.0.0.1 entreprise.api.gouv.frdans/etc/hosts. Saisir un SIRET valide, puis attendre ~2 minutes (3 tentatives du job avec backoff : ~3 s, ~18 s, ~83 s). À l'épuisement, le hook converge vers le mode dégradé. Penser à retirer la ligne de /etc/hosts ensuite.Ce qu'on doit observer pour un dossier en erreur technique