
# Moving from 3.x to 4.0

You run a 3.x instance and want to move to 4.0. This page says, change by change, what 4.0.0 breaks compared with 3.5 and what you have to do.

## Where things stand

- **4.0.0** is published, and **5.0.0** after it: to go further up, [move from 4.x to 5.0](passer-a-la-5-0.md). The `3.x` line no longer receives fixes.
- Only the current version is fixed: see [the maintenance policy](versioning.md#combien-de-temps-une-ligne-est-corrigée).

## Before upgrading

1. Stay on the latest 3.x and read its release notes: a 3.x release may already warn about what 4.0 removes.
2. Make a [backup](sauvegarde-et-restauration.md#2-sauvegarder-à-la-main). The schema only moves forward: a database migrated to 4.0 does not go back under a 3.x image.
3. Read the "⚠️ Attention" entry of the 4.0 release notes, then the sections below.

## What changes

Each paragraph says *before*, *after* and *what you do*.

### Environment variables

#### White labelling and legal notices: twenty-six variables become eight

- **After (4.0)**: eight variables instead of twenty-six. `BRANDING_PRODUCT_NAME`, `BRANDING_ORGANISATION`, `BRANDING_SUPPORT_EMAIL` and `LEGAL_DEMO_INSTANCE` do not change; four **grouped** variables, of the form `key=value;key=value` (a literal semicolon is written `\;`), replace the others: `BRANDING_IMAGES`, `BRANDING_COLORS`, `LEGAL_MENTIONS` and `LEGAL_ACCESSIBILITE`. The old names are read for the whole 4.x, with one startup warning per variable, and the grouped key wins if both are set; 5.0 removes them. The refusal to start without the five required notices now applies to a public instance only ([see below](#le-budget-de-calcul-la-file-et-linstance-publique)).
- **What you do**: before 5.0, replace each old variable with its key, then remove it from your environment.

| Old variable | Grouped variable, key |
| --- | --- |
| `BRANDING_LOGO_URL`, `BRANDING_MASCOT_URL`, `BRANDING_MASCOT_ICON_URL` | `BRANDING_IMAGES`: `logo`, `mascot`, `mascot-icon` |
| `BRANDING_PDF_LOGO`, `BRANDING_PDF_STRIP` | `BRANDING_IMAGES`: `pdf-logo`, `pdf-strip` |
| `BRANDING_ACCENT_COLOR` | `BRANDING_COLORS`: `accent` |
| `BRANDING_PDF_HEADLINE`, `BRANDING_PDF_MUTED`, `BRANDING_PDF_ACCENT`, `BRANDING_PDF_HIGHLIGHT`, `BRANDING_PDF_PILL` | `BRANDING_COLORS`: `pdf-headline`, `pdf-muted`, `pdf-accent`, `pdf-highlight`, `pdf-pill` |
| `LEGAL_EDITEUR`, `LEGAL_HEBERGEUR`, `LEGAL_CONTACT`, `LEGAL_BASE_LEGALE`, `LEGAL_CONSERVATION`, `LEGAL_RESPONSABLE_TRAITEMENT`, `LEGAL_DIRECTEUR_PUBLICATION` | `LEGAL_MENTIONS`: `editeur`, `hebergeur`, `contact`, `base-legale`, `conservation`, `responsable-traitement`, `directeur-publication` |
| `LEGAL_ACCESSIBILITE_ETAT`, `LEGAL_ACCESSIBILITE_DATE_AUDIT`, `LEGAL_ACCESSIBILITE_CONTENUS`, `LEGAL_ACCESSIBILITE_SIGNALEMENT` | `LEGAL_ACCESSIBILITE`: `etat`, `date-audit`, `contenus`, `signalement` |

The details and an example are in [the environment variables](variables-environnement.md#marque-et-documents) and [the legal notice](mentions-legales.md).

### The solve budget, the queue and the public instance

- **After (4.0)**:
  - **The budget is an instance setting**: `SOLVER_SECONDS_LIMIT` (900 s by default) and `SOLVER_UNIMPROVED_SECONDS_LIMIT` (180 s; `0`: never), the same for every edition, shown but not editable. `SOLVER_SECONDS_LIMIT_MAX` now only bounds what a launch requests (`?seconds=`, MCP). `SOLVER_UNIMPROVED_SECONDS_LIMIT_MAX` is retired: setting it has no effect, and startup says so in a warning. Migration `V145` removes both settings from each edition and keeps the values an edition had set in `solve_budget_avant_4_0`, which the application no longer reads and 5.0 will drop. A YAML scenario no longer sets its duration: `parametresSolveur` is ignored, and the import says so.
  - **The queue is in memory**: a restart **loses** the solves that were waiting (and the ones that were running, as before). At startup, the jobs a 3.x left queued or running become *interrupted* in the history, with the reason on the job and their number in the log; nothing restarts by itself. A solve that went to a remote compute machine is still followed.
  - **The quota only applies to a public instance**, declared by `PUBLIC_INSTANCE=true`. Without it, `SOLVER_MAX_SOLVES_PER_HOUR` and `SOLVER_MAX_QUEUED_JOBS` are ignored (with a warning if you set them). The refusal to start without the five required legal notices stays on a public instance; elsewhere it becomes a **warning**.
- **What you do**:
  - If an edition had set a duration or a plateau, find them in `solve_budget_avant_4_0` and set `SOLVER_SECONDS_LIMIT` and `SOLVER_UNIMPROVED_SECONDS_LIMIT` for the whole instance.
  - **If your instance is open to strangers (a public demo), set `PUBLIC_INSTANCE=true`**: without it, it no longer refuses to start without legal notices and no longer applies its quota. An instance that does not set it but has its quota set, or incomplete required notices, says so at startup and names the variable; `PUBLIC_INSTANCE=false` confirms it is not public and silences the warning.
  - Before a restart, check that no solve is waiting in the queue.
  - Scripts that wrote `dureeResolutionSecondes` or `plateauSecondes` through `/api/parametres-solveur` see those fields ignored; those that read `cappedFromSecondsLimit` or `cappedFromPlateauSeconds` on a job, or `maxPlateauSeconds` in the budget bounds (`instance`), no longer find them.

### The proxy header mode and the machine launcher are removed

The variables concerned have no effect any more: if one is set, startup writes a warning and carries on; the warning goes away in 5.0.

- **The proxy header mode** (`REMOTE_USER_ENABLED`, `REMOTE_USER_HEADER`, `REMOTE_USER_SECRET_HEADER`, `REMOTE_USER_SECRET`, `REMOTE_USER_ADMIN_EMAIL`): a proxy header opens nothing any more, neither the administration nor a staff member's espace. **Before upgrading**, set up [sign-in through an OIDC provider](oidc.md) or create [local accounts](comptes-locaux.md), and check that a named administrator account opens; staff members use the six-digit code sent by e-mail. Then remove the `REMOTE_USER_*` variables. Your proxy may stay in front of the instance as a network filter; it no longer replaces sign-in.
- **The on-demand machine launcher** (`SOLVER_WORKER_HOOK_URL`, `SOLVER_WORKER_HOOK_SECRET`, `SOLVER_WORKER_INSTANCE`, `SOLVER_WORKER_START_TIMEOUT`, `SOLVER_WORKER_IDLE_TIMEOUT`): the application no longer starts or stops any machine. The **permanent worker** (`SOLVER_WORKER_URL`, `SOLVER_WORKER_SECRET`, `SOLVER_WORKER_TLS_FINGERPRINT`, `SOLVER_WORKER_DEFAULT`) does not change, nor does the rule that a remote failure fails the job, nor the "On site" or "On the compute machine" choice of the *Calculate* tab. On the API side, `POST /api/machine-calcul/preparer` and `/arreter` are gone, and `GET /api/machine-calcul` returns only `configured` and `remoteByDefault`. If you used the launcher, start the machine with your host's tools, run the worker on it ([the procedure](calcul-sur-une-autre-machine.md)) and set `SOLVER_WORKER_URL` and `SOLVER_WORKER_SECRET`; without them, your solves run on site. Then remove those five variables.

### YAML scenario format

- **After**: the application writes `schemaVersion: 7` (1 in 3.x). It still reads v1 files (key absent or equal to 1) through a chain of conversions; what it cannot convert is ignored, and every ignored element appears in the warnings of the import report, never silently. The links:
  - 1 → 2: the `ninja` key of the game categories becomes `polyvalent`;
  - 2 → 3: `parametresLegaux` and `parametresQualite` move under `parametres:` (`legal` and `organisation`), `parametresSolveur` is ignored;
  - 3 → 4: opens `contraintes.niveaux`;
  - 4 → 5: the stands' opening hours become plages;
  - 5 → 6: `journeesTypes` becomes `gabarits`;
  - 6 → 7: `couverturePause` is ignored.

  Whatever the version, a key of `contraintes:` that names a merged or removed rule is read under the name that replaces it, on the most protective reading, and locks of a removed type, forced ad hoc exceptions and the hard form of the days-in-a-row rule are converted, each with a warning.
- **What you do**: nothing to read your old files, end-of-event archives or copies before a wipe. A v2 to v7 scenario cannot be imported into a 3.x ("newer format"): keep a v1 export before upgrading, it is your way back. The v1 reader is removed in 5.0.

### Planning rules: adjustable level and merged rules

- **One level per organisation rule and per edition** ([ADR 0111](repo:docs/decisions/0111-le-niveau-d-une-regle-est-le-niveau-de-son-poids.md), migration `V149`): **mandatory** (hard level: a plan that breaks it cannot be delivered) or **preference** (medium level, according to its weight). This covers the medium rules of "Organisation quality", the meal break (`coupureRepasObligatoire`), the supervision of minors by an adult (`mineurNecessiteEncadrementMajeur`) and the days in a row. Legal, assignment, ad hoc and lock rules and soft preferences have no level. The level is set with `PUT /api/constraints/{name}/niveau` (`GET /api/constraints` adds `niveauReglable` and `niveauChoisi`), with the MCP tool `modifier_contrainte` and with the `contraintes.niveaux` section of the YAML ([the details](../comprendre/scenario-yaml.md)). Each edition keeps its level and weight, hence its scores. A rule made mandatory on an edition that cannot keep it yields an infeasible plan: run the feasibility analysis before solving.
- **One days-in-a-row rule** ([ADR 0118](repo:docs/decisions/0118-une-seule-regle-de-jours-d-affilee-a-niveau-reglable.md), `V162`): `maxJoursConsecutifsTravailles`, a preference by default or mandatory. The migration makes it **mandatory** in an edition that had switched on the hard form (and switches it on again if the dosed form had been off); otherwise the level, weight and switch of the dosed form stay and **no score moves**. An edition that had both forms on now has only the mandatory rule, which no longer also pays in medium. The calendar construction order is removed: construction is by scarcity, in both engines.
  - The old name `maxJoursConsecutifsTravaillesDur` is read until 5.0, with a warning, as a level: in a YAML, `activees` reads it as `niveaux: {maxJoursConsecutifsTravailles: OBLIGATOIRE}`; through `PUT /api/constraints/maxJoursConsecutifsTravaillesDur` or `modifier_contrainte`, switching it on makes the rule mandatory and switching it off sets it back to a preference; a weight sent under that old name is refused (400). `planning.constraint-weights.maxJoursConsecutifsTravaillesDur` is no longer read: remove it.
  - **With `SOLVER_ENGINE=timefold`**, an edition that keeps the rule mandatory loses the calendar order: 6 to 8% more medium on `festival-realiste-canicule` and `scenario-complet`, up to 35% on `gamme-20` and `gamme-25`, at equal budget. The direct engine, the default, is not affected.
- **One rule per legal ceiling** ([ADR 0114](repo:docs/decisions/0114-une-regle-par-plafond-lue-selon-l-age.md), [ADR 0116](repo:docs/decisions/0116-une-regle-par-plafond-hebdomadaire-et-par-age.md), `V152` and `V154`): the ceiling is read according to the staff member's age on the date of the timeslot. `dureeQuotidienneMaxMajeur` and `…Mineur` become `dureeQuotidienneMax` (10 h for an adult, 8 h for a minor aged 16 to 18, 7 h under 16); `travailContinuMaxMajeur` and `…Mineur` become `travailContinuMax` (6 h, 4 h 30 for a minor); `dureeHebdomadaireMaxMineur` and `reposHebdomadaireMineur` disappear: `dureeHebdomadaireMax` covers both ages (48 h for an adult, 35 h for a minor, the durations of Settings › Legal) and `reposHebdomadaireMinimal` everybody (35 consecutive hours, and two consecutive days in the calendar week for a minor). The ceilings are those of the Labour Code: same breaches, same score.
- **What you do**: nothing for saved editions. The migrations merge their settings **on the most protective reading**: rule on if either of the two was, hardest level, highest weight (the row under the kept name counts for the adults' rule). The settings history and the weighting kept with each plan keep the old names. **The old names are read with a warning for the whole 4.x and removed in 5.0**, in a YAML (`contraintes` section, warning in the import report), in `planning.constraint-weights.<old name>` (warning at startup), in the `PUT /api/constraints/{name}…` routes and the MCP rule-setting tools (the answer carries the new name): rename them before 5.0. **A trap**: `dureeHebdomadaireMax` no longer means "adults only". A 3.x YAML that switched off that rule alone (the adults' ceiling) now switches it off for both ages, without a warning: reread the `contraintes` section of your exports.

The place rules (`eviterChangementEmplacementEloigne`, `limiterEmplacementsParJour`) and the load rules (`equilibrerCharge`, `equilibrerCreneauxPenibles`) are not merged: the bench ([place](../comprendre/tests-de-scenarios.md#le-banc-des-règles-de-lieu), [comfort](../comprendre/tests-de-scenarios.md#le-banc-des-règles-de-confort)) showed that a merge changed the plans. The *Planning rules* screen only groups the two place rules under the title *Spread over the day*, each keeping its name, level and switch.

### MCP tools

Tools are named `<verb>_<object>`, the verb taken from a closed set ([ADR 0100](repo:docs/decisions/0100-convention-de-nommage-des-outils-mcp.md)), and many are grouped: one tool per object and per verb, what used to tell the old tools apart being passed as an argument ([ADR 0127](repo:docs/decisions/0127-un-outil-mcp-par-objet-et-par-verbe.md)). 4.0.0 publishes 103 tools under their current name, against 157 in 3.5: 52 keep their name, 82 old names stay published beside the new one until 5.0 (same arguments and answers, description starting with "Ancien nom"), 23 are no longer published (20 grouped, 3 removed: `analyser_ouvertures_stands`, `compacter_horaires_stands`, `consulter_historique_ponderation`). The full correspondence is in [the old tool names](../comprendre/mcp-outils.md#anciens-noms-doutils).

- **Plan, solve, rules, swaps** (33 tools → 21): `consulter_planning` (`vue`), `analyser_affectation`, `simuler_affectation` and `modifier_affectation` (`mode`), `modifier_contrainte` (one setting per call: `actif`, `poids`, `poidsParDefaut` or `niveau`, which replaces `modifier_niveau_contrainte`), `modifier_foire_echanges`, `modifier_demande_echange` (`decision`). The solve has two tools, as the screen has two buttons: `lancer_calcul` (from the plan in place, `deZero` to start over) and `lancer_correction` (only the seats in breach), followed by `consulter_calcul`, `arreter_calcul` and `supprimer_calcul`; `diagnostiquer_plan` returns the detail of the hard breaches (`ecartsDurs`).
- **Settings, editions, scenarios, publication** (37 → 23): `consulter_parametres` and `modifier_parametres` (`section`), `consulter_edition`, `creer_edition` (`source` to copy an edition), `modifier_edition` (`nom` or `active`), `importer_scenario` (`nom` or `yaml`), `diagnostiquer_scenario`, `supprimer_donnees_edition`, `consulter_publication` (`vue`: `etat`, `destinataires`, `confirmations`), `publier_planning` (same call and keys), `envoyer_planning_animateur` (one person), `envoyer_relance_animateurs` (`relancer_animateurs` is its alias), `consulter_sauvegardes`. A mail send is never a mode of another tool: a forgotten `mode` would write to the whole team. Only `modifier_parametres_solveur` has no alias: the solve budget is an instance setting, and the end-of-solve e-mail is set with `modifier_parametres` (section `calcul`).
- **Diagnostic** (11 → 5): `consulter_besoin` (`section`: `borne`, `marge`, `typologie`, `volumetrie` or `faisabilite`), `consulter_risques` (`fragilite`, `former` or `tension`), `consulter_charge` (`vue`: `equite` or `heures`), `consulter_repas_pauses` (`pauses` or `enchainements`), and `changements_journee` becomes `comparer_journee`. The `fragilite` section is new: the report by ids, without the name or the sentence of the screen. An argument that only applies to one part (`mode` outside `marge`, `source` outside `heures`, `standId` outside `pauses`) is refused, not ignored.
- **Stands, staff, availabilities, timeslots** (36 → 26): `lister_stands` and `lister_animateurs` take an `id` for a single record. `creer_stand` also creates the location, the missing game categories and the opening windows, like `creer_stand_complet`. A stand's hours are an object: `creer_horaire_stand` and `supprimer_horaire_stand`, form `plage` (one dated day) or `modele` (the recurring model). `consulter_disponibilites` reads the Availabilities tab by `section` (`collecte`, `declarations` or `covoiturage`), `modifier_declaration_disponibilite` decides a declaration (`decision`: `appliquer` or `refuser`); opening the collection stays a tool of its own, `modifier_collecte_disponibilites`, because it can write to staff. `diagnostiquer_creneaux` reads the grid (`section`: `grille` or `controle`), `supprimer_creneaux` takes `ids` or filters. Locations and game categories keep their four tools.
- **Three verbs outside the convention**: `lever_consigne`, `definir_prereglage_consigne` and `configurer_collecte_disponibilites` become `supprimer_consigne`, `modifier_prereglage_consigne` and `modifier_collecte_disponibilites`, same arguments and answers.
- **What you do**: nothing right away, an assistant that reconnects reads the tool list again. A prompt, an instruction or a script that names an old tool must move to the new names before 5.0. Three plage tools born during the preparation of 4.0 (`creer_plage_stand`, `supprimer_plage_stand`, `supprimer_horaires_stand`) disappear without an alias, only the `4.0.0-rc.1` pre-release having carried them: move to `creer_horaire_stand` and `supprimer_horaire_stand`.

### The edition's settings in four sections

- **After (4.0)**: four sections, `legal`, `organisation` (the former "quality"), `notifications` and `calcul` (the former "solver", reduced to the end-of-solve mail, with the instance budget read-only). The API serves them under `GET /api/parametres` and `GET`/`PUT /api/parametres/<section>`, which refuses with 400 a field foreign to the section. Each section carries `modifieLe`, which the `PUT` returns: a section written since answers `409` (`MODIFICATION_CONCURRENTE`); without `modifieLe`, nothing is checked (migration `V150`, one column per table). Two MCP tools replace them: `consulter_parametres` and `modifier_parametres` (argument `section`). A scenario files them under `parametres:` (`legal` and `organisation`; notifications are not part of it, as before).
- **What you do**: nothing for your data or files: v1 and v2 scenarios are converted on reading. The old API roots answer as deprecated aliases (`deprecated` in the OpenAPI) for the whole 4.x: they ignore an unknown field, return `modifieLe` without checking it (the last writer wins) and go away in 5.0. For the old MCP tools, see [the old tool names](../comprendre/mcp-outils.md#anciens-noms-doutils).

On screen, *Settings* has one tab per section (*Notifications*, then *Legal*, *Organisation* and *Calculation* behind "Advanced settings"). Three addresses change, each one redirects: `/regles?onglet=calcul` becomes `/parametres?onglet=calcul`, `/parametres?onglet=emails` (and the `#emails` anchor of the *Edition* tab) becomes `/parametres?onglet=notifications`, `/parametres?onglet=legaux` becomes `/parametres?onglet=legal`. The *Legal* and *Quality* tabs of *Planning rules* merged into one *Rules* tab with three blocks, which their old addresses still open. Update your bookmarks.

### The "ninja" game category becomes "all-rounder"

- **After**: it is called "polyvalent" (all-rounder). Migration `V140` renames the column and its index and fixes the field names in the action journal. The `preserverBufferPolyvalents` rule, its weights and its switch do not change. The API, the YAML and CSV exports and the MCP tools say `polyvalent`, the derived keys follow (`polyvalentConfigure`, `typologiePolyvalenteDefinie`), the screens say "All-rounder game category". The stands' `premium` flag keeps its name.
- **What you do**: nothing for your data or files. The old names are read for the whole 4.x (`ninja` JSON and YAML key, `ninja` CSV header, flagged line by line in the import report) and removed in 5.0. Only scripts that *read* a `ninja` key of an answer or an export must change.

### Stand opening hours

- **After**: a stand carries a **list of dated plages**, one opening or one closure per day ([decision 0104](repo:docs/decisions/0104-les-horaires-d-un-stand-sont-une-liste-de-plages-datees.md)), and resolution reads nothing else. A recurrence stays the **stand's model** ("Saturday and Sunday, 10 am–6 pm"): it waits while the edition has no timeslots, then is **unfolded** into plages on the days of the event and on every day the edition gains afterwards. Migration `V159` converts your rules onto the days of each edition that has timeslots (first to last, plus the day after a timeslot that runs past midnight), **with the exact reading the application had of them**: a test replays it on every shipped scenario and compares the windows, day by day, with those of 3.x. The YAML moves to version 5: `plages` replaces `ouvertures` and `indisponibilites`, and `horaires` becomes the stand's model.
- **What you do**:
  - **Export each edition as YAML before upgrading** (Files, "Export the current data as a scenario"): it is your way back and the only way to recover the detail of your rules, the migration does not go back.
  - An edition with no timeslot keeps its rules as the model, with no conversion and no warning. The rules are never deleted or renamed: a day added later receives the stand's hours, as in 3.x.
  - **A stand's sheet** shows its recurring model at the top, editable, and its dated plages below, marked *model* or *entered*: you add an opening or a closure, remove a plage or a whole day. The day × timeslot grid of the sheet is gone: tell organisers where to enter hours. A plage laid by the model and removed by hand does not come back until the model's rules change.
  - **The "Stand hours" screens and the rule analysis are removed**: the old addresses (`/ouvertures`, `/creneaux?onglet=horaires`) open the sheet of the stand named (`stand`, or the first of `stands`), otherwise the stand list. Overlaps between rules are no longer reported, resolution reading only plages; the anomalies that still make sense (a stand never open, a window outside every timeslot, a segment too short) are counted on the home screen, in the calendar check and in the referential coherence. **"Compact the hours" is removed** (no rule left to join).
  - **API**: the sheet publishes its plages under `plages` (`id`, `mode`, `depliee`); three routes lay or remove them (`POST /api/stands/{id}/plages`, `DELETE /api/stands/{id}/plages/{plageId}`, `DELETE /api/stands/{id}/plages?date=`). `ouvertures` and `indisponibilites` are deprecated but read and returned until 5.0: a script that reads them moves to `plages` before. **No alias**: `POST /api/stands/compactage-horaires` and `GET /api/ouvertures-stands/couches` are gone, `horaireId` leaves the anomalies, `informations` leaves `ouvertures` in the edition state, and the codes `REGLES_CHEVAUCHANTES`, `REGLE_MASQUEE` and `FENETRES_CHEVAUCHANTES` disappear. `GET /api/ouvertures-stands` and `PUT /api/ouvertures-stands/grille` stay (stand list, sheet, calendar, guided creation).
  - **Assistants (MCP)**: `ajouter_ouverture_stand`, `ajouter_fermeture_stand` and `ajouter_horaire_stand` become `creer_horaire_stand` (form `plage` with `mode`, or `modele`; a rule identical to an existing one changes nothing); `effacer_plages_stand` and `effacer_horaires_stand` become `supprimer_horaire_stand` (form `plage` by `plageId` or `date`, or `modele`, which erases the model **and** the plages it unfolded but keeps hand-entered ones). `lister_stands` shows the model (`horaires`) and returns `plages` in place of `fermetures` and `ouvertures`. `compacter_horaires_stands` and `analyser_ouvertures_stands` are removed: `lister_anomalies_referentiel`, family `STANDS`, gives the anomalies. See [the old tool names](../comprendre/mcp-outils.md#anciens-noms-doutils).

### Carpooling is reduced to validated or not

- **After (4.0)**: a request is not validated (`EN_ATTENTE`) or validated (`VALIDEE`). Rejecting a request or cancelling a group arrival deletes it, with no reason and no e-mail; the only e-mail left is the validation, sent to each member. The `arriveeGroupee` rule does not change. Migration `V142` removes the rejected or cancelled requests and the reason column from the table, and keeps them in the `declaration_coequipier_avant_4_0` archive, which the application no longer reads and 5.0 will drop ([retention period](conservation-des-donnees.md#larchive-du-covoiturage-3x)). The API no longer returns `reason`, the `.../ecart` and `.../annulation` routes answer `204` with no body, and `lister_demandes_covoiturage` has only two statuses.
- **What you do**: after a cancellation, tell the group yourself, since no e-mail goes out. A script that read `ECARTEE`, `ANNULEE` or `reason` must do without. Add the archive to your record of processing, with its period ([the limits to record](rgpd-limites-a-consigner.md#les-demandes-de-covoiturage)).

### Snapshots become versions

- **After (4.0)**: a single type, the **version**, with three origins written in a column: `MANUELLE`, `AVANT_CALCUL`, `PUBLIEE` ([ADR 0108](repo:docs/decisions/0108-un-seul-type-version-a-trois-origines.md)). Migration `V143` renames the table `version_plan` without copying or changing a row, and the send traces that point at a publication still do. The routes become `/api/planning/versions`; `/api/planning/snapshots` still answers, with `automatique` beside the new `origine` field. The MCP tools become `creer_version`, `lister_versions`, `consulter_version`, `comparer_versions`, `restaurer_version` and `supprimer_version` (no alias), and say `origine`. The comparison, the purge of automatic copies (`planning.snapshots.automatiques-conservees`) and the ban on deleting the last publication, or the one that is the reference of an elapsed day, do not change. The `planning.publie` webhook keeps `instantaneId`.
- **On screen**: the word "snapshot" disappears; the *Plan versions* tab of the *Planning* page says the origin of each version (manual, before solve, published), and the comparison has its own screen, *Compare two versions* (`/comparer`), which compares two versions or, in its *Editions* view, the reference data of two editions. The old addresses follow: `/editions/comparer?a=…&b=…` leads to `/comparer?vue=editions&a=…&b=…`, and `…?onglet=versions&comparer=…` to `/comparer?vue=versions&comparer=…`.
- **What you do**: a script that calls `/api/planning/snapshots` moves to `/api/planning/versions` before 5.0, which removes the alias and `automatique`; instructions that name a `*_instantane*` tool follow [the old tool names](../comprendre/mcp-outils.md#anciens-noms-doutils). Before upgrading, the usual backup is enough: a return to 3.x goes through its restoration, 3.x not knowing `version_plan`. Update your bookmarks.

### The copy before a wipe becomes a YAML export

- **After (4.0)**: the copy is **a single YAML export** whose last section, `plan:`, carries the seats and locks; restoring is the normal import of that file, which puts the planning back ([ADR 0112](repo:docs/decisions/0112-la-copie-avant-vidage-est-un-export-yaml-avec-son-plan.md)). Migration `V147` only makes the `plan` column optional: **no row is copied, rewritten or deleted**. The 3.x copies stay restorable and downloadable, their column being read as the `plan:` section. The file of a recent copy remains a valid v3 scenario; imported by hand, it restores only the scenario (`plan:` is ignored with a warning), only the restoration puts the planning back. Rights (administrator only) and duration (the edition's, no purge) do not change.
- **What you do**: your record of processing ("scenario and planning by identifiers") stays accurate; add that the file is a complete YAML export, to keep like the database ([the copies before a wipe](rgpd-limites-a-consigner.md#les-copies-avant-vidage)). Reading the old column is removed in 5.0: before then, restore or delete the 3.x copies you still need.

### The measures of an edition have one table and one screen

- **After (4.0)**: a single table, `mesure_edition`, with a `nature` column (`INDICATEURS` or `REALISE`) ([ADR 0113](repo:docs/decisions/0113-une-table-et-un-ecran-pour-les-mesures-d-edition.md)), **with no foreign key**: the measure outlives the edition. The realised figures are still **written once** (`ON CONFLICT DO NOTHING`). One screen, *Edition measures* (`/mesures`, under *Administer*, with a link at the top of *Today*), has two views in the address: `?vue=realise` (default) and `?vue=indicateurs`. The API moves under `/api/mesures-edition` (`/indicateurs`, `/realise`, `/realise/detail`, `/realise/export`, `/realise/precedente`). The MCP tools become `lister_mesures_edition`, `supprimer_mesure_edition` and `comparer_realise_planifie`.
- **What you do**: nothing for your data. Migration `V148` copies every row (identifiers kept), then keeps the old tables as `kpi_historique_avant_4_0` and `kpi_realise_avant_4_0`: the application neither reads nor exports them and 5.0 drops them; once a return to 3.x is ruled out, `DROP TABLE` removes them with no effect. To freeze an edition again, a script writes `DELETE FROM mesure_edition WHERE nature = 'REALISE' AND edition_id = '…'`. `/api/kpi/historique` and `/api/planning/realise` answer as deprecated aliases during 4.x: move to the new paths before 5.0; the old screen addresses (`/realise`, `/aujourdhui?onglet=realise`) lead to the measures screen. For the MCP tools, see [the old tool names](../comprendre/mcp-outils.md#anciens-noms-doutils).

### The weighting history joins the action journal

- **After (4.0)**: a single journal. *Settings › History*, "Rules" filter (`GET /api/historique?nature=regles`), says which rule changed its activation, weight or level, when and by whom, **without the value**: the journal keeps none, and it expires like the rest. The two old routes and the tool are removed, with no alias. A scenario import or an edition duplication no longer leaves one line per rule, only the import or the duplication.
- **What you do**: migration `V158` **does not migrate** the old rows, which carry values the journal refuses: it renames the table `ponderation_contrainte_historique_avant_4_0`, which the application neither reads nor exports and 5.0 drops. To keep those values, export the table before upgrading; once a return to 3.x is ruled out, `DROP TABLE ponderation_contrainte_historique_avant_4_0` removes it with no effect. A script that read the two routes or the tool reads the journal, or does without the values.

### The lock has only three types

- **After (4.0)**: three types ([ADR 0109](repo:docs/decisions/0109-trois-types-de-verrou.md)): staff member + timeslot (`ANIMATEUR_CRENEAU`), stand + day (`STAND_JOUR`), day (`JOUR`). Migration `V151` converts each old lock into what it froze on the saved plan, so that the plan does not move at the next solve:

| Old lock | Becomes |
| --- | --- |
| `ANIMATEUR` | one staff member + timeslot lock per timeslot where the staff member holds a seat |
| `STAND` | one stand + day lock per day on which the stand has seats |
| `CRENEAU` | one staff member + timeslot lock per staff member who holds a seat on that timeslot |
| `JOUR`, `ANIMATEUR_CRENEAU` | unchanged |

  A lock with no matching seat froze nothing and disappears. The `animateurVerrouilleFige` rule is removed: a staff member is no longer locked "everywhere", and empty seats are not frozen (as before). The MCP tool `verrouiller` keeps its name, its `type` argument takes the three new values, and the API refuses the old ones with `400`. The `plan:` section of a YAML that names an old type is read with the same conversion, one warning per converted lock.
- **What you do**: nothing for your locks, those of old editions included; a 3.x copy before a wipe stays restorable, converted on reading. A script or prompt that laid an `ANIMATEUR`, `STAND` or `CRENEAU` lock lays one lock per timeslot or per day.

### "Exclude from the publication" is removed

- **After (4.0)**: a publication notifies **everyone** concerned. The boxes, the "Defer" button, the `exclusions` field and the MCP argument disappear; a client that still sends `exclusions` gets a `200`, the field is ignored and the answer carries `avertissements` (until 5.0). "Notify only a few people" remains (`cibles`, the two people of an accepted swap, a replacement), which defers the others as before. Exclusions in progress are **ignored**: the deferred person was already to be notified, the next publication writes to them. The home alert closes, person by person, when a publication has really notified that person; a person with no address, whose send fails or whom the publication defers, keeps it. Migration `V160` files every person whose last publication send was a deferral into `exclusion_publication_avant_4_0` (which 5.0 will drop), and the home screen shows one alert per person, recorded **by identifier only**. 3.x did not tell a deferral by exclusion from one by "notify only a few people": the archive keeps them all.
- **What you do**: before the first publication of 4.0, read the home alerts (or `SELECT animateur_id FROM exclusion_publication_avant_4_0`): these people will receive their planning, call them first if need be. A script that sent `exclusions` uses `cibles`. Add the archive to your record of processing ([retention](conservation-des-donnees.md#larchive-des-exclusions-de-publication-3x)); `DROP TABLE exclusion_publication_avant_4_0;` removes it with no effect.

### The reference data freeze becomes the phase of the edition

- **After (4.0)**: an edition has a **phase**, Preparation, Solving, Published or Finished ([ADR 0115](repo:docs/decisions/0115-la-phase-de-l-edition-remplace-le-gel.md)), and the phase is what freezes. In Solving and Finished, the four families are frozen. In Published, the structure (stands, timeslots, game categories, locations) is frozen but the staff records, skills included, stay editable; the structure can be **unblocked** for a last-minute change without leaving the phase, and the next publication freezes it again. **The first publication moves the edition to Published**; other phase changes are explicit gestures (`PUT /api/editions/courant/phase`). Consignes, availabilities, adjustments and locks stay free in every phase, and `PASSE_FIGE` remains an instance setting, unrelated to the phase.
- **Migration `V155` derives the phase from the state of each edition, and this mapping loses information**:

| 3.x state | 4.0 phase |
| --- | --- |
| At least one publication, no structure family frozen | Published, structure unblocked: nothing closes at the upgrade, the next publication freezes it |
| At least one publication, a structure family frozen | Published, structure frozen **as a whole** |
| No publication, at least one family frozen | Solving: the **four** families frozen |
| No publication, no family frozen | Preparation |

  The per-family detail is lost: an edition that had frozen only its stands sees its timeslots, game categories, locations and skills frozen too; a published edition that had frozen its skills finds them editable again; the freeze date of each family becomes a single phase date. The `gel_referentiel` table stays in place, unread and out of the SQL export, for a return to 3.x; 5.0 drops it.
- **What you do**: after the upgrade, open each ongoing edition and check its phase (home screen, "Phase of the edition" line, or Administer › Editions). If a family is frozen while you wanted it open, go back to Preparation to reopen the four families or, in Published, click "Unblock the structure" (a banner reminds you). The "Reference data freeze" card of Settings is gone. `figer_referentiel` and `lever_gel` are replaced, with no alias, by `modifier_phase_edition` (argument `phase`, or `structure` to unblock and refreeze). Until 5.0, `PUT` and `DELETE /api/editions/courant/gel/{famille}` remain aliases of the phase (freezing one family in Preparation freezes them all): move to `PUT /api/editions/courant/phase` and `/api/editions/courant/deblocage-structure`. After a publication, a script or an import that edits stands or timeslots is refused with `409 REFERENTIEL_FIGE` until the structure is unblocked.

### The day validation becomes the state of the day

- **After (4.0)**: each day has a state, **to review**, **reviewed** or **frozen** ([ADR 0121](repo:docs/decisions/0121-l-etat-de-la-journee-se-lit-sur-la-relecture-et-le-verrou.md)). Frozen means carrying a day lock: a solve no longer touches it. Reviewed freezes nothing, and the review is lost when a solve recomputes the day, as in 3.x. The state is read with `GET /api/etats-journee` and changed with `PUT /api/etats-journee/{jour}` (`A_RELIRE`, `RELUE`, `FIGEE`): only `FIGEE` lays the lock, only `RELUE` and `A_RELIRE` remove it. It depends neither on the phase nor on the active edition. Nothing is migrated. **What changes**: a day locked as a whole without having been accepted now counts as reviewed in the progress ("3 days out of 12"), the publication panel and the summary of a solve.
- **On screen**: "Reviewed and accepted" and the day lock are no longer two gestures. The review bar shows the state and opens a three-value control (To review, Reviewed, Frozen) with the review comment; "Frozen" asks for confirmation, and freezing without a comment keeps the review's. A reader sees the state, with no button.
- **What you do**: the tools `lister_validations_journee`, `ajouter_validation_journee` and `retirer_validation_journee` have no alias: `consulter_etats_journee` lists the state and the progress, `modifier_etat_journee` (`jour`, `etat`, `commentaire`) replaces the other two (`RELUE` or `FIGEE` to add, `A_RELIRE` to remove; only `FIGEE` lays the lock). Until 5.0, `GET`, `POST /api/validations` and `DELETE /api/validations/{id}` remain aliases that write the same review and lock, never removing a lock: move to `/api/etats-journee` before.

### The forced assignment and the forced unavailability are converted

- **After (4.0)**: three types of exception ([ADR 0117](repo:docs/decisions/0117-deux-types-d-exception-les-forcees-sont-converties.md)): incompatibility, affinity, grouped arrival. The `indisponibiliteForcee` and `affectationForcee` rules are removed; their names are read with a warning in a 3.x file or copy. Migration `V161` converts each exception, without touching the saved plan:

| 3.x exception | Becomes |
| --- | --- |
| forced assignment on a timeslot | one staff member + timeslot lock for each named person who holds a seat of the scope on the saved plan |
| forced unavailability on a timeslot | the **whole day** added to the unavailable days of the fiche |
| forced unavailability with no timeslot | every day carrying a timeslot, added to the unavailable days of the fiche |
| forced unavailability on a stand; forced assignment with no timeslot, or that nobody holds | nothing: reported in the migration log, kept in the `contrainte_ad_hoc_avant_4_0` archive |

- **What is lost**: a forced unavailability on **a single timeslot** becomes a **whole day**, the fiche knowing no timeslot. If the saved plan seats the person on another timeslot that day, it carries a hard availability breach (Problems page) that the next solve corrects. Each case is reported in the migration log (`RAISE WARNING`, one message per exception): read it before the first solve. Event-day mode also marks an absence by adding the **whole day** to the fiche's unavailable days.
- **What you do**: nothing for your data. The `contrainte_ad_hoc_avant_4_0` archive (`convertie` column) is neither read nor exported and 5.0 drops it; once a return to 3.x is ruled out, `DROP TABLE` removes it with no effect. A script, prompt or MCP tool that created an `INDISPONIBILITE_FORCEE` or `AFFECTATION_FORCEE` exception is refused: lock the person's timeslot (`verrouiller`, type `ANIMATEUR_CRENEAU`) or add the day to their `joursIndisponibles` (`modifier_animateur`). A 3.x YAML that carries one of these types is read with the same conversion (a forced assignment is only converted if the file carries a `plan:` where the person holds the seat), each case a warning of the import report. The built-in help gives the gesture: "How to do without a forced assignment".

### Screens are grouped, old addresses follow

These changes touch no data, variable or migration. The old addresses in the table below are read until 5.0: update your bookmarks and internal help pages before then.

- **Menu**: nine entries, in the order of the cycle: **Home**, **Prepare** (Stands, Calendar, Staff), **Files**, **Planning**, **Diagnostic**, **Rules**, **Share** (Share the planning, Swaps), **Today** and **Administer** (Settings, Editions, Edition measures, Debug, offered to the administrator account only). No address changes; *Prepare*, *Share* and *Administer* keep the folded or unfolded state given in 3.x; *Plan* and the *Today* group are gone. The "g" then a letter shortcuts do not change.
- **Calendar**: it opens at `/calendrier`, `/creneaux` redirects and keeps its parameters. The API (`/api/creneaux`) does not change.
- **Planning page**: four views under a single key, `?vue=jour|stand|personne|carte`. *Day* has two modes, `mode=rail|tableau`, and **the rail is the default mode**: an address with neither `vue` nor `mode` opens the rail, where it used to open the table. *Stand* and *Person* keep their rendering in `?rendu=` (`treemap`, `frise`). Two tabs are added: **Calculate** (`?onglet=calculer`, the former *Solver* page, whose menu entry and shortcut are gone) and **Plan versions** (`?onglet=versions`). Two solve buttons: "Calculate the schedule" (from the plan in place, with confirmation as soon as a plan exists) and "Fix after a change" (only the seats in breach). "Start over from scratch" becomes a box, unticked by default, in the confirmation of the first, followed by a second confirmation. How far the review has got shows as soon as a plan exists. The API and the MCP tools do not change.
- **Five readings leave the Planning page**: "Compare two days" is removed; the summary by person, the need by game category and the breaks and meals move to the Diagnostic; what moved since the last publication is read in *Share*, *Send* tab, and what the last solve rewrote in the result of the *Calculate* tab.
- **Diagnostic**: five tabs besides Compliance.
  - **Problems** keeps feasibility and its causes.
  - **Staffing need** gathers the exact bound, the margin per day, the need and the schedule game category by game category, and the problem's volumetry (no longer in the Solver).
  - **Risks** stacks *Fragility*, "To train" and *Tension*, each with its own filters in the address.
  - **Workload** (`?onglet=charge`) keeps the summary as it was: same columns, same choice of published or saved plan for the hours, same two CSV exports (hours for payroll, fairness).
  - **Meals and breaks** (`?onglet=repas-pauses`, one day at a time) gathers the legal breaks per stand with the relay, the meal break owed, the catering (who eats, when, where, with the CSV export of the event) and the tight walks, by the same computations read on the saved plan. The placement of the meal break is set in *Settings › Organisation*, the rule in *Planning rules*.
- **Home**: a single feed under "To handle today" gathers the plan's alerts (nightly sends, weather alert, people to notify after a removed exclusion, sleeping swaps), the hard rules the last solve did not keep (one line per rule, link to Diagnostic › Problems), the referential coherence anomalies and the messages. It is sorted by gravity then newest first, and filtered with `/?type=alertes`, `blocages`, `coherence` or `messages`. The bell leads there; a bookmark to `/#alertes-nuit` or `/notifications` lands at the top of the home screen, replace it with `/?type=alertes#a-traiter` for the alerts only.
- **Seat panel**: two "what if" gestures. "Simulate a change" brings together the repair suggestions, the move and the bench, shows the before and the after, and "Apply" writes it with the same checks as before; "Explain" says why this person is on this seat; Free, Mark absent and Lock stay. The simulation and the suggestions are reads open to a read-only user (`GET /api/postes/{posteId}/simulation?cible=|animateur=` and `GET …/suggestions`), who still cannot apply. The `POST …/deplacement/simulation` and `POST …/simulation-swap` routes work until 5.0: move scripts to `GET …/simulation`, which reads the saved plan with the edition's settings.
- **Help**: every page of the menu and every tab that answers a question has its short help ("?" icon), with the link to the guide; the detailed sections of the user guide remain. *What's new* becomes the list of versions, newest first, an `-rc.N` pre-release being marked "Pre-release"; the filter and the search are gone (`type` and `q` are ignored).

| Old address | Leads to |
| --- | --- |
| `/solveur`, `/solver` | `/journee?onglet=calculer` |
| `/solveur?onglet=versions`, `/versions` | `/journee?onglet=versions` |
| `?vue=calendrier` (table), `?vue=rail`, `/day-calendar`, `/rail-jour` | the Day view, `tableau` or `rail` mode |
| `?axe=stand\|personne` and the grid's `vue` (`treemap`, `frise`) | the 4.0 form (`?vue=` and `?rendu=`) |
| `?vue=personne&rendu=synthese`, `?axe=personne&vue=synthese`, `/hours`, `/equite` | `?onglet=charge`, with `sort`, `dir`, `colonnes`, `sansRepos`, `source` and the `q` filter (written `nom`); the other parameters of the Planning page are dropped |
| `?axe=typologie`, `/typologies-planning` | `?onglet=besoin&section=typologie` (`section=volumetrie` for the volumetry) |
| `?vue=pauses`, `/pauses`, `/intendance` | `?onglet=repas-pauses`, the day of `jour` or `date` kept; `relais` and `repas` are dropped |
| `?vue=changements` | *Share*, the day of `date` kept |
| `?onglet=fragilite\|former\|tension`, `?onglet=besoin&section=former`, `/fragilite`, `/marge?mode=apres\|tension` | `?onglet=risques&section=fragilite\|former\|tension`, other parameters kept |
| `?comparer=` and its keys (`ecarts`) | ignored |
| `/notifications` | the home feed, filtered on messages |

### The consigne is written as dated plages

- **After (4.0)**: laying a consigne **writes dated plages** on every stand of its date, marked as its own: a closure over the band, one over each timeslot added, an opening per compensation window ([decision 0125](repo:docs/decisions/0125-la-consigne-s-ecrit-en-plages-datees.md)). They are read above the stand's own, and the resulting day is the same. Lifting the consigne removes exactly its plages; a consigne plage edited by hand loses its mark and stays. The gestures, the Consignes screen and the MCP tools (`appliquer_consigne`, `supprimer_consigne`, `simuler_consigne`, `simuler_levee_consigne`) do not change. Migration `V168` writes the plages of consignes already laid, past ones included; a test compares, on every shipped scenario placed under two consignes, the windows and seats with those of 3.x.
- **What you do**: nothing for your data. A stand sheet opened before a consigne was laid or lifted is refused on save (reload it). A consigne's plages appear among the stand's (`consigne: true` in the API): a script that reads a stand's hours must read them with those. A YAML export does not carry them, it carries the consigne, and the import writes them again.

### Meals: one rule line, no more reduced-staffing relay

- **A single line, "Meal break"**, with an adjustable level (mandatory by default), linked to the `placementRepas` setting of *Settings › Organisation* ([ADR 0123](repo:docs/decisions/0123-une-seule-entree-de-repas-placement-en-parametre.md)): `FIN_MIDI_DEBUT_SOIR` (default, the former direction), `DEBUT`, `FIN` or `AUCUN`. The two rules do **not** merge in the score (merged at one level, they made four of the six shipped scenarios infeasible): `coupureRepasPlacementPrefere` stays a soft term of weight 1 under the line, which `GET /api/constraints` marks `termeDe: coupureRepasObligatoire`. `modifier_parametres` (section `organisation`) and the YAML export (`parametresQualite.placementRepas`) carry the setting. Migration `V165` gives each edition the former direction, with no score change; an edition that had switched off `coupureRepasPlacementPrefere` goes to `AUCUN` (if it saved its organisation settings; otherwise the switch stays, and `PUT /api/constraints/coupureRepasPlacementPrefere` (`{"actif": true}`) restores it). A script that writes the whole organisation settings record without `placementRepas` resets it to its default; a script that read the rule list ignores the entries that carry `termeDe`, or reads the setting.
- **The reduced-staffing meal relay is removed**: a shift is filled at the stand's full staffing, or at that of its time window when it names one. Migration `V170` drops the column from timeslots and template shifts; `couverturePause`, `contientCouverturePause`, the `RELAIS_REPAS_HORS_FENETRE` anomaly and the `misAJour` count of the generator report disappear from the API, the MCP tools and the CSV export. Nothing to do if none of your shifts was marked (shipped editions included). Otherwise the migration writes to the startup log how many carried the mark, and they now ask for full staffing: to keep a reduced staffing at noon, give it a time window with its own staffing (*Stands › Hours*). A YAML or copy that carries `couverturePause` imports, the key being ignored with a warning; a script that sends it to `POST /api/creneaux` or to the MCP tools stops doing so, and the `R` of a shift line (`12:00-13:00 R`) is refused.

### One timeslot generator

- **After (4.0)**: a single **timeslot generator** ([ADR 0126](repo:docs/decisions/0126-un-generateur-de-creneaux-unique.md)), with three gestures: a **preview** that writes nothing and checks the resulting grid, an **application**, a **withdrawal** of dates from the calendar. It starts from one of three sources: the stands' hours (model and plages), the **templates** (« gabarits ») or a recurring pattern. The day templates become the templates (name, shifts, dates): migration `V169` renames their tables (`gabarit`, `gabarit_vacation`, `gabarit_date`) without touching a row. A timeslot typed by hand does not change, and a timeslot the generator creates on a day the edition did not count unfolds the stands' model, like one typed by hand. **The grid produced does not change**: a test replays every generation on all shipped scenarios and compares the timeslots with those of 3.x.
  - API: `/api/generateur-creneaux` (`GET` the state, `POST /apercu` and `/application` with a `source`, `POST /retrait`, the templates under `/gabarits`, the calendar under `PUT /calendrier`). Five MCP tools replace the twelve: `lister_gabarits`, `modifier_gabarit`, `supprimer_gabarit`, `previsualiser_generateur_creneaux`, `appliquer_generateur_creneaux`. The YAML moves to version 6: `journeesTypes` becomes `gabarits`, entry for entry.
  - Screen: *Calendar* has a *Generate timeslots* menu offering the three sources, each with its preview before writing, and « journée type » becomes « gabarit » (template) everywhere.
- **What you do**: nothing for your data or files. A template the generator could not apply (no shift, a zero-length shift or the same shift twice) is not converted: the migration stores it, with its dates, in `journee_type_avant_4_0`, readable until 5.0, and its dates are no longer governed (their timeslots stay). The old routes remain aliases (`deprecated` in the OpenAPI) until 5.0, with their old keys (`journeesTypes`, `journeeTypeId`), like the twelve old MCP tools ([old tool names](../comprendre/mcp-outils.md#anciens-noms-doutils)); the CSV import and export of templates keep their files (`journees-types.csv`) and routes. A script or prompt that names them moves to the new names before 5.0.

### The CSV imports of the reference sets and of the stand grid are removed

- **After (4.0)**: **the YAML is the complete workbook of an edition, and the CSV is only for staff** ([decision 0128](repo:docs/decisions/0128-le-yaml-est-le-classeur-complet-le-csv-ne-sert-qu-aux-animateurs.md)). The Import tab has only four cards (Scenario, Staff, Examples, Check a file); a bookmark on a removed card (`/fichiers?cible=stands`) lands on the Scenario card. The eighteen removed routes answer **`410 Gone`**, whatever the body, with a message pointing to `POST /api/reference-data/import-scenario-fichier`: `…/typologies`, `…/emplacements`, `…/stands`, `…/creneaux` and `…/journees-types`, each as `/import-csv`, `/import-csv/analyse` and `/import-csv/exemple`, and `/api/stands/import-grille` with its siblings `/analyse` and `/exemple`. They disappear in 5.0. **The CSV exports do not change** (the *Files › Export* archive keeps its six files), nor does the skills entry grid. No MCP tool carried these imports. The removed import actions no longer have a label in the history: lines already written show under their code.
- **What you do**:
  - **A script that called one of these routes** moves to the YAML. For the five reference sets, write the `typologies`, `emplacements`, `stands`, `creneaux` and `gabarits` sections ([scenario format](../comprendre/scenario-yaml.md), [schema](repo:docs/schema/scenario-schema.json); the "Check a file" card checks without writing anything). A YAML import **replaces** the edition instead of completing it: start from an export (*Files › Export*, "Export the current data as a scenario"), edit it, import it again; a copy of the edition is kept before writing. CSVs exported by 3.x can be read again in a spreadsheet to copy their rows into the YAML, never into the application.
  - **Redoing a stand grid in YAML.** Each non-empty cell of the matrix (stands in rows, timeslots in columns, one headcount per cell) is written as one opening plage in the stand's `plages` list: the column's `date` and hours, and the cell's `effectif`.

    ```yaml
    stands:
      - id: LUDOTHEQUE
        nom: Ludothèque
        typologiesProposees: [JEUX_DE_SOCIETE]
        effectifMin: 1
        effectifMax: 3
        plages:
          - { date: 2027-07-03, mode: OUVERTURE, heureDebut: '10:00', heureFin: '12:30', effectif: 2 }
          - { date: 2027-07-03, mode: OUVERTURE, heureDebut: '14:00', heureFin: '18:00', effectif: 3 }
    ```

    A column that spans several timeslots is written as one plage per timeslot, or as a single plage as wide as the column. A spreadsheet produces these lines with a column of formulas pasted under `plages:`. For a stand open every day at the same hours, write its **model** under `horaires` instead (`mode: OUVERTURE`, `jours: TOUS`, `fenetres`): the application unfolds it into plages on the days of the timeslots.
  - **Without writing YAML**, the grid is redone on screen: *Prepare › Calendar*, the hours tab, "Entry" view (stand × timeslot, one headcount per cell), or each stand's sheet. The five reference sets likewise: create the rows on screen.

### Data and migrations

On its first start, 4.0.0 applies migrations `V140` to `V170`, described in the section of their change. A `…_avant_4_0` archive is neither read nor exported by the application and 5.0 will drop it: until then it allows a return to 3.x on a copy of the database, and it belongs in your record of processing ([retention periods](conservation-des-donnees.md)).

| Migration | What it changes in the schema | Archive kept until 5.0 |
| --- | --- | --- |
| `V140` | column `typologie.ninja` renamed `polyvalent` | none |
| `V142` | rejected or cancelled carpool requests deleted, column `motif` removed | `declaration_coequipier_avant_4_0` |
| `V143` | `plan_snapshot` renamed `version_plan`, column `automatique` replaced by the origin | none |
| `V145` | solve duration and plateau removed from the edition's settings and from the jobs | `solve_budget_avant_4_0` |
| `V147` | `plan` column of the copy before a wipe made optional | none |
| `V148` | `kpi_historique` and `kpi_realise` merged into `mesure_edition` | `kpi_historique_avant_4_0`, `kpi_realise_avant_4_0` |
| `V149` | level chosen per edition for each organisation rule, no score changes | none |
| `V150` | `modifie_le` column on the four settings tables | none |
| `V151` | `ANIMATEUR`, `STAND` and `CRENEAU` locks converted into staff member + timeslot and stand + day locks | none |
| `V152`, `V154` | adult / minor rule settings merged on the most protective reading | none |
| `V155` | reference data freeze replaced by the phase of the edition | `gel_referentiel`, kept under its name, neither read nor exported |
| `V158` | weighting history moved out of the tables that are read | `ponderation_contrainte_historique_avant_4_0` |
| `V159` | recurring stand rules unfolded into dated plages | none (the rules remain the stand's model) |
| `V160` | pending publication exclusions ignored | `exclusion_publication_avant_4_0` |
| `V161` | forced assignments and unavailabilities converted into locks and unavailable days | `contrainte_ad_hoc_avant_4_0` |
| `V162` | hard form of the days-in-a-row rule merged into the adjustable-level rule | none |
| `V165` | meal-break placement switch taken up as an edition setting | none |
| `V168` | consignes already laid rewritten as dated closure plages | none |
| `V169` | `journee_type` and its tables renamed `gabarit` | `journee_type_avant_4_0` (what cannot be converted) |
| `V170` | `couverture_pause` column removed from timeslots and templates | none (the number of shifts affected is written to the migration log) |

**What you do**: a full backup before upgrading, and a YAML export of each edition; the schema does not go back. After the upgrade, read the startup log: `V161` names there each forced exception it could not convert or that it widened to the whole day, and `V170`, if there are any, the number of shifts that lost their meal relay.
