Skip to content

ETQ usager, je peux déposer un dossier même si la vérification du Siret est temporairement indisponible#13255

Closed
E-L-T wants to merge 9 commits into
mainfrom
feat/dossier-submission-with-external-data-pending
Closed

ETQ usager, je peux déposer un dossier même si la vérification du Siret est temporairement indisponible#13255
E-L-T wants to merge 9 commits into
mainfrom
feat/dossier-submission-with-external-data-pending

Conversation

@E-L-T

@E-L-T E-L-T commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Ref #12997

Contexte

Aujourd'hui, si l'API Entreprise est en mode dégradé ou renvoie une erreur technique au moment de la vérification du SIRET, l'usager ne peut pas déposer son dossier.

Ce que fait cette PR

  • Classifie les erreurs du champ SIRET en deux catégories : :not_found (SIRET inexistant, bloquant) et :technical_error (API indisponible, non bloquant)
  • Le validateur laisse passer les erreurs techniques et les états pending pour le champ SIRET uniquement — le comportement des autres champs avec données externes est inchangé
  • Affiche un message informatif non bloquant (fr-info-text) sous le champ quand la vérification est en cours ou temporairement indisponible

Périmètre

Uniquement SiretChamp. Les autres champs avec données externes (RNF, RNA, référentiel…) seront traités dans des PRs à venir.

Points d'attention pour la revue

  • ExternalDataException a un nouveau champ kind (requis). Les exceptions legacy en base désérialisent avec kind: nil, traité comme non-bloquant dans le validateur.
  • handle_result dans ChampExternalDataConcern garde des fallbacks sans kind pour les services pas encore migrés.
  • lenient_external_data_validation? permet à un champ d'opter pour le comportement non-bloquant — seul SiretChamp l'active pour l'instant.

@E-L-T
E-L-T force-pushed the feat/dossier-submission-with-external-data-pending branch 6 times, most recently from 9f15161 to d857c85 Compare June 9, 2026 08:56
@E-L-T E-L-T changed the title ETQ usager, je peux déposer mon dossier même si un champ connecté n'a pas pu récupérer sa donnée ETQ usager, je peux déposer un dossier même si la vérification du Siret est temporairement indisponible Jun 9, 2026
@E-L-T
E-L-T force-pushed the feat/dossier-submission-with-external-data-pending branch from d857c85 to b0d7f5d Compare June 9, 2026 09:12
@E-L-T
E-L-T force-pushed the feat/dossier-submission-with-external-data-pending branch 10 times, most recently from 6e3394d to dd8b3d2 Compare July 3, 2026 08:49
E-L-T added 9 commits July 6, 2026 15:37
Required to distinguish :not_found (business error) from :technical_error
(API down / 5xx) when deciding whether to block dossier submission.

kind: defaults to nil so existing call sites for other champs (RNA, RNF,
Référentiel, quotient familial) keep working unchanged.
Returns false by default. Will be overridden later when a procedure has a
logic condition that depends on a champ's value_json (SIRET/RNA/RNF).
…technical_error

API Entreprise not_found (code 404) is the only blocking case. Degraded
mode and other technical errors are now classified as :technical_error
so the validator can let the user submit anyway.
…idate_etablissement

validate_etablissement predates the kind/lenient rework and blocked on
any missing etablissement regardless of kind, defeating the point of
#12997 for external_error states: a technical_error still got a
blocking :not_found error on external_id, independently of
ExternalDataChampValidator's lenient logic.

Skip this validation on external_error too (already skipped on
pending): blocking on external_error is now exclusively
ExternalDataChampValidator's job, which is kind-aware.

Also fixed two specs that asserted `be_valid` after an explicit
validate(:champs_public_value): be_valid re-triggers validation with
no context, which should_validate_in_current_context? always rejects,
silently no-oping the assertion. Assert on the already-populated
errors instead.
…ed etablissement

champ_blank_or_invalid? checked Siret.new(siret: champ.value), but
value is only populated by a successful fetch (update_external_data!).
For a mandatory SIRET champ, this meant the dossier's mandatory-field
check (Dossier#check_mandatory_and_visible_champs_for) always blocked
submission while pending or in a non-blocking technical_error,
regardless of ExternalDataChampValidator's kind-aware logic.

Check external_id's format instead: it's set as soon as the user types
a SIRET and survives resets, so a mandatory field is satisfied by a
syntactically valid input. Whether that SIRET actually exists is
ExternalDataChampValidator's separate, kind-aware concern.
For a SIRET champ, the non-blocking technical_error banner (added below
the input) and this component's own external_error warning were both
rendered at once, contradicting each other visually (blue info + red
warning for the same non-blocking state). The warning branch is
unreachable for :not_found (validation errors take precedence in the
template) and now redundant for :technical_error, so it's removed along
with its now-unused translations.
@E-L-T

E-L-T commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

fermé au profit d'une approche sans nouveau champ kind : #13435

@E-L-T E-L-T closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant