WIP lot S : Propositions seed (I1, E1, E2 ouvertes, cran 2), amendement gardé, publication suspendue sans article en vigueur

Travail en cours, sauvegardé à la demande d'orch : le moteur, le serveur et
tests/seed_proposals.rs (verts) ; les autres tests et les e2e ne sont pas
encore repris.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-11-02 07:50:31 +01:00
co-authored by Claude Opus 5.5
parent 5cf30e0bfa
commit 6228d3913a
15 changed files with 2513 additions and 55 deletions
+30 -3
View File
@@ -22,6 +22,11 @@
//! logs. Applied, the level is written in one transaction with a line in
//! `inertia_changes` (the article says so) and, where the document publishes,
//! a row in the publication queue (`document.json` carries the levels).
//!
//! Since 2026-11-02 the seed gives E1 and E2 another starting level: put forward
//! as seed proposals, they start low (ADR 0011, `seed_proposal_amend`). The two
//! amendments of 30/10 are then superseded: decided in production, they decide
//! nothing more, and say so only in the debug logs.
use crate::AppState;
use crate::seed::SeedDoc;
@@ -43,6 +48,9 @@ pub struct InertiaAmendment {
pub to: u8,
/// Reason given to the publication queue, and so to the commit of the texts.
pub reason: &'static str,
/// The later decision whose level the seed gives instead, if any: this one then
/// decides nothing more, without an error.
pub superseded_by: Option<&'static str>,
}
pub const AMENDMENTS: &[InertiaAmendment] = &[
@@ -53,6 +61,7 @@ pub const AMENDMENTS: &[InertiaAmendment] = &[
from: 3,
to: 4,
reason: "inertie de départ relevée : E1, 3 → 4",
superseded_by: Some("2026-11-02-e1-proposition-seed"),
},
InertiaAmendment {
id: "2026-10-30-e2-inertie-4",
@@ -61,6 +70,7 @@ pub const AMENDMENTS: &[InertiaAmendment] = &[
from: 3,
to: 4,
reason: "inertie de départ relevée : E2, 3 → 4",
superseded_by: Some("2026-11-02-e2-proposition-seed"),
},
];
@@ -148,7 +158,17 @@ pub async fn apply(state: &AppState, seeds: &[SeedDoc], list: &[InertiaAmendment
fn seed_says(seeds: &[SeedDoc], a: &InertiaAmendment) -> bool {
let level = seeds.iter().find(|s| s.slug == a.doc).and_then(|s| s.units.iter().find(|u| u.code == a.unit));
match level {
Some(u) if u.inertia.get() == a.to => true,
Some(u) if u.level().get() == a.to => true,
Some(u) if a.superseded_by.is_some() => {
tracing::debug!(
amendment = a.id,
unit = a.unit,
seed_level = u.level().get(),
superseded_by = a.superseded_by,
"inertia amendment superseded: nothing decided"
);
false
}
_ => {
tracing::error!(
amendment = a.id,
@@ -267,8 +287,15 @@ async fn decide(
mod tests {
use super::*;
const A: InertiaAmendment =
InertiaAmendment { id: "test", doc: "doc", unit: "E1", from: 3, to: 4, reason: "inertie de départ relevée" };
const A: InertiaAmendment = InertiaAmendment {
id: "test",
doc: "doc",
unit: "E1",
from: 3,
to: 4,
reason: "inertie de départ relevée",
superseded_by: None,
};
fn at(raw: &str) -> Facts {
Facts { raw: raw.into(), ..Facts::default() }