Fusion de la tête du chantier (924a40d : lots B2 et F) dans le lot D

Les deux côtés gardés partout. Aux coutures :
- une objection (redit / contredit) porte sur deux articles, jamais sur un module ;
  un ordre ne se corrige pas, ni par son auteur ni par un autre ; une coquille du
  titre suit le chemin de F (l'auteur du titre, un administrateur pour le titre
  de départ, ou 3 jours), et documents.title suit à l'application ;
- votable() couvre les modules ; leurs totaux passent par shown_tally, à l'écran
  et dans document.json ;
- « Modules à voter » ne compte plus une version retenue par une objection (test
  vu rouge) ; la liste du groupe la compte toujours parmi les propositions en cours ;
- le panier : une fonction pour les articles et les modules, avec les versions
  retenues de F ; un nouvel article se propose dans une section, à sa fin, et peut
  répondre à une objection ;
- migrations 0007 (modules) puis 0008 (objections) ;
- C25 et C26 supportent un groupe d'essai où une voix suffit (dès 16 membres).

Boucle : fmt, clippy -D warnings, cargo test (227), svelte-check 0, vitest 55,
build, e2e 35 / 35 (C1–C33 et M1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-10-31 09:41:30 +01:00
co-authored by Claude Opus 5.5
82 changed files with 8285 additions and 677 deletions
+37 -6
View File
@@ -2,22 +2,27 @@
//!
//! One binary serves the JSON API under `/api`, the compiled Svelte interface,
//! and runs four background workers: the electorate refresher (size of the Ğ1
//! web of trust), the adoption sweeper, the ballot watcher (votes signed on the
//! Ğ1 chain, confirmed on the indexer) and the publisher (adopted texts pushed to the git repository
//! that client applications read).
//! web of trust), the adoption sweeper (with the deadlines of three days of
//! objections and typo fixes), the ballot watcher (votes signed on the Ğ1 chain,
//! confirmed on the indexer) and the publisher (adopted texts pushed to the git
//! repository that client applications read).
pub mod access;
pub mod adoption;
pub mod auth;
pub mod ballots;
pub mod clock;
pub mod config;
pub mod deadlines;
pub mod doc_title;
pub mod docs;
pub mod error;
pub mod indexer;
pub mod inertia_amend;
pub mod messages;
pub mod module_amend;
pub mod modules;
pub mod objections;
pub mod order;
pub mod overview;
pub mod participation;
@@ -26,6 +31,7 @@ pub mod publish;
pub mod seed;
pub mod seed_amend;
pub mod team;
pub mod typos;
pub mod util;
pub mod web;
pub mod wot;
@@ -54,6 +60,8 @@ pub struct AppState {
pub publish_wake: Arc<Notify>,
/// What is coming in the tools of each group (`seeds/upcoming/`), read at start.
pub upcoming: Arc<overview::Upcoming>,
/// The clock of the deadlines of three days (objections, typo fixes); tests move it.
pub clock: clock::Clock,
}
impl AppState {
@@ -63,7 +71,14 @@ impl AppState {
.user_agent(concat!("libreDecision/", env!("CARGO_PKG_VERSION")))
.build()?;
let upcoming = Arc::new(overview::Upcoming::load(&cfg.seed_dir).await?);
Ok(Self { db, cfg: Arc::new(cfg), http, publish_wake: Arc::new(Notify::new()), upcoming })
Ok(Self {
db,
cfg: Arc::new(cfg),
http,
publish_wake: Arc::new(Notify::new()),
upcoming,
clock: clock::Clock::default(),
})
}
}
@@ -125,15 +140,25 @@ pub fn api_router() -> Router<AppState> {
.route("/docs/{id}/proposals", post(proposals::create))
.route("/docs/{id}/votes", post(ballots::vote_many))
.route("/docs/{id}/ballots", post(ballots::create))
.route("/ballots", get(ballots::mine))
.route("/ballots/{id}", get(ballots::status).delete(ballots::drop))
.route("/ballots/{id}/receipt", get(ballots::receipt))
.route("/proposals/{id}", get(proposals::detail).patch(proposals::edit))
.route("/proposals/{id}/submit", post(proposals::submit))
.route("/proposals/{id}/withdraw", post(proposals::withdraw))
.route("/proposals/{id}/split", post(proposals::split))
.route("/proposals/{id}/vote", post(proposals::vote))
.route("/proposals/{id}/signals", post(proposals::signal))
.route("/proposals/{id}/objections", post(objections::raise))
.route("/proposals/{id}/translations/{lang}", put(proposals::translate))
.route("/signals/{id}/lift", post(proposals::lift_signal))
.route("/objections/{id}/lift", post(objections::lift))
.route("/objections/{id}/reiterate", post(objections::reiterate))
.route("/typos/{id}/validate", post(typos::validate))
.route("/typos/{id}/refuse", post(typos::refuse))
.route("/messages", get(messages::list))
.route("/messages/unread", get(messages::unread))
.route("/messages/read", post(messages::read_all))
.route("/messages/{id}/read", post(messages::read))
.route("/dev/clock", post(deadlines::dev_clock))
.route("/units/{id}/inertia", post(proposals::propose_inertia))
.route("/units/{id}/order", post(order::propose))
.route("/units/{id}/title", post(doc_title::propose))
@@ -216,6 +241,12 @@ pub async fn run() -> anyhow::Result<()> {
tracing::warn!(error = %e, "usual participation");
}
auth::bootstrap(&state).await?;
// A deadline passed while the server was stopped is dealt with now.
match deadlines::sweep(&state).await {
Ok(s) if s != deadlines::Swept::default() => tracing::info!(?s, "deadlines passed while stopped"),
Ok(_) => {}
Err(e) => tracing::warn!(error = %e, "deadlines"),
}
if let Err(e) = publish::ensure_key(&state).await {
tracing::warn!(error = %e, "publication key");
}