
# Input warnings

Some inconsistencies do not justify a refusal: the row is written and a warning travels in the success response. You will know which routes return them, what each `type` means and why none names a person. The principle: refuse only what is certainly unsatisfiable ([ADR 0020](repo:docs/decisions/0020-avertir-dans-la-reponse-d-ecriture.md)). Writes that fail are in [writing the referentials](api-referentiels.md).

## Where they appear

The response wraps the entity, `avertissements` always being present and empty when all is well:

```json
POST /api/animateurs  →  200
{
  "animateur": { "id": "A12", "prenom": "…", … },
  "avertissements": [
    { "type": "MINEUR_PENDANT_EVENEMENT",
      "message": "L'animateur A12 est mineur du 2026-07-08 au 2026-07-08 et devient majeur le 2026-07-09 …",
      "targets": [ { "screen": "STANDS_RESERVE_MAJEURS", "ids": [] },
                   { "screen": "VERROUILLAGES_ANIMATEURS", "ids": ["A12"] },
                   { "screen": "ANIMATEURS", "ids": ["A12"] } ] }
  ]
}
```

Five resources answer this way: staff members, timeslots and stands (`POST` and `PUT`), ad hoc constraints and locks (`POST`), as `{ <entity>, avertissements }`. The other referentials answer the bare entity: an absent key means nothing to report. The scenario import emits none (its impact report says what it changes), and MCP tools answer the entity alone, apart from `RESOLUTION_EN_COURS` ([writing during a solve](api-referentiels.md#écrire-pendant-un-calcul)). Bulk edit emits one `PUT` per row and groups the warnings into a single message.

## The types

| `type` | What triggers it |
| --- | --- |
| `INDISPONIBILITE_HORS_EVENEMENT` | An unavailability day outside `[first timeslot, last timeslot]`: it protects nobody. |
| `INDISPONIBILITE_JOUR_SANS_CRENEAU` | An unavailability day inside the interval but with no timeslot (a break Monday): the animateur space will not show it and the first applied declaration will erase it. CSV import refuses the row, manual entry warns. |
| `MINEUR_PENDANT_EVENEMENT` | The animateur is a minor at least one day of the event; the message says from when they are an adult. Emitted only when the write sets or changes the birth date: repeating it at every edit teaches people to ignore it. |
| `AGE_TRES_BAS` | The animateur would be under 8 on the first day of the event: almost always a year typo. Emitted only when the write sets or changes the birth date; the message says the identifier only. A birth date in the future or more than 120 years back is refused (400) instead, by the screen, the API, the MCP tool and the scenario file. |
| `MINEUR_SANS_REPRESENTANT` | A minor's contacts have no legal representative. Never refused (optional), but the compliance report lists these people. Emitted by the contacts write. |
| `CRENEAU_HORS_OUVERTURE_STANDS` | No stand is open a single minute of the timeslot: it will open no seat. |
| `CRENEAU_DEBORDE_OUVERTURE_STANDS` | The timeslot starts before all stands open, or ends after they have all closed, by at least a quarter of an hour. |
| `STAND_FENETRE_SANS_EFFET` | A stand window (extended rule or dated exception) overlaps no timeslot of its day. The message cites up to five days. |
| `STAND_EXCEPTION_HORS_EVENEMENT` | A dated exception names a day outside `[first timeslot, last timeslot]` (the day after a timeslot crossing midnight is not). |
| `STAND_JAMAIS_OUVERT` | After the write, the stand is open on no timeslot. |
| `STAND_SANS_EMPLACEMENT` | The stand has no location while its neighbours share one: same name root ("Buvette 3", "Buvette B"), failing that same game categories; at least two placed neighbours and a location held by more than half. Emitted only when the write changes the location, name or categories, never on an edition without locations. A suggestion, never a write (`GET /api/stands/suggestions-emplacement` gives the same reading for the whole edition). |
| `ARRIVEE_GROUPEE_JOURS_DIVERGENTS` | The members of a grouped arrival do not share the same unavailability days: those days, the group cannot arrive together ([ad hoc exceptions](exceptions-ad-hoc.md)). |
| `VERROUILLAGE_SUR_VIOLATION_DURE` | The lock freezes situations that already break a hard rule in the last analysis. Written anyway: a lock freezes without exempting ([ADR 0003](repo:docs/decisions/0003-verrouillage-par-pin-natif.md)). Nothing is said on an edition no solve has analysed. |

## Where a warning leads

`type` is the stable code. `targets` says where to look, as typed screens and row identifiers, never as a sentence to parse: the UI turns them into a « Go to… » link that opens the screen filtered on the row, and writes nothing on the user's behalf. Every type has at least one target (`ANIMATEURS`, `STAND`, `CRENEAUX`, `STANDS_RESERVE_MAJEURS`, `VERROUILLAGES`, `VERROUILLAGES_ANIMATEURS`); `MINEUR_PENDANT_EVENEMENT` leads to the adults-only stands, to the locks naming the person and to their fiche. Targets carry identifiers only, and MCP tools receive the code alone ([warning codes](mcp-outils.md)).

## Only what the write changes is reported

On a modification, each rule is read against the record as it was: an unavailability day already saved and an untouched birth date produce nothing. Bulk edit sends one `PUT` per row carrying the whole merged record; without this comparison, adding a competence to thirty volunteers would cite every minor of the selection. At creation, everything is examined. The three stand-hours warnings (`STAND_FENETRE_SANS_EFFET`, `STAND_EXCEPTION_HORS_EVENEMENT`, `STAND_JAMAIS_OUVERT`) are emitted only if the write touches the hours; the entry grid `PUT /api/ouvertures-stands/grille` emits none, its windows following the timeslots by construction.

## The event's bounds are derived

An `Edition` carries neither dates nor an "ongoing" flag: the event runs from the first to the last timeslot. An edition without timeslots has no bounds and emits no warning: inventing one would produce a false positive on the very screen a new edition starts with.

## What the messages do not say

A warning names an animateur by identifier alone, never by name, first name or birth date: the browser copies every message into a `localStorage` log that survives sign-out (see [data protection](../installer/rgpd.md)). On one type, the UI goes further: the `MINEUR_PENDANT_EVENEMENT` sentence is shown but not logged, since naming the 18th-birthday day would allow recomputing the birth date.
