Lot S, phase 2 : le quorum dans le serveur (ADR 0013), vu rouge puis vert
- migration 0011 (additive ; 0010 reste au lot V) : documents.quorums (par cran,
NULL = vote_floor à chaque cran, le C d'avant), units.quorum (NULL = celui du
cran), journaux quorum_changes et quorum_amendments ;
- quorum effectif = units.quorum ?? quorums[cran] ; les propositions d'inertie et
les modules en héritent ; p0 = 2 × vote_floor / W, jamais le quorum d'un article ;
- route PUT /units/{id}/quorum { "quorum": n | null } : trustin_access::sets_quorum
(l'auteur de la première version, un administrateur pour le seed), refusée dès
qu'un vote existe (quorum::voted_units : vote du serveur, bulletin de la chaîne
en attente ou confirmé, adoption) ; bornes 2..W, 1..W dans le groupe d'essai ;
- amendement gardé 2026-11-03-quorums-par-cran : écrit les quorums du seed là où
il n'y en a pas, une fois par document, consigné, file de publication là où il
publie ;
- JSON : evaluation.quorum / yesNeeded / noNeeded ; l'unité : quorum,
quorumDefault, canSetQuorum ; doc.quorums ; levels[].quorum ; document.json
publié : quorums ; adoptions.params : quorum (plus de constant) ;
- seed : quorums 12 · 12 · 50 · 50 · 50 (Monnaie libre), 1 partout (essai).
- tests : tests/quorum.rs (5) et les règles pures ; les scénarios du groupe
d'essai qui demandaient deux voix posent le quorum 2 de l'article, comme son
auteur le ferait ; les chiffres de Monnaie libre suivent (9 au cran 2, 39 au
cran 3, 43 au cran 4).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -117,6 +117,21 @@ fn codes(doc: &Value, ids: &Value) -> Vec<String> {
|
||||
}
|
||||
|
||||
/// Two people of the test group (W = 2, C = 1): two « for » adopt.
|
||||
/// The quorum of a module or an article set to 2, as its author — an administrator, for a
|
||||
/// text of the seed — sets it before the first vote (ADR 0013). In the test group, where
|
||||
/// the quorum of every level is 1 and one voice passes, one voice of two then no longer does.
|
||||
async fn two_voices(state: &AppState, code: &str) {
|
||||
let n = sqlx::query(
|
||||
"UPDATE units SET quorum = 2 WHERE code = ? AND doc_id IN (SELECT id FROM documents WHERE group_slug = 'essai')",
|
||||
)
|
||||
.bind(code)
|
||||
.execute(&state.db)
|
||||
.await
|
||||
.expect("quorum")
|
||||
.rows_affected();
|
||||
assert_eq!(n, 1, "{code}");
|
||||
}
|
||||
|
||||
async fn two() -> (Client, Client, AppState) {
|
||||
let (mut a, state) = Client::new().await;
|
||||
a.login("Yvv").await;
|
||||
@@ -191,7 +206,8 @@ async fn a_new_base_has_its_title_and_the_order_of_each_section() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn an_order_is_proposed_with_the_articles_of_its_section_then_voted_into_force() {
|
||||
let (mut yvv, mut chiara, _) = two().await;
|
||||
let (mut yvv, mut chiara, state) = two().await;
|
||||
two_voices(&state, "ordre.conclusion").await;
|
||||
let doc = yvv.doc("essai").await;
|
||||
let conclusion = order_of(&doc, "conclusion").clone();
|
||||
let module = conclusion["id"].as_str().expect("id").to_owned();
|
||||
@@ -241,7 +257,9 @@ async fn an_order_is_proposed_with_the_articles_of_its_section_then_voted_into_f
|
||||
|
||||
#[tokio::test]
|
||||
async fn articles_that_enter_or_leave_a_section_complete_an_order_under_vote() {
|
||||
let (mut yvv, mut chiara, _) = two().await;
|
||||
let (mut yvv, mut chiara, state) = two().await;
|
||||
// The order stays under vote with one voice.
|
||||
two_voices(&state, "ordre.inertie").await;
|
||||
let doc = yvv.doc("essai").await;
|
||||
let module = order_of(&doc, "inertie")["id"].as_str().expect("id").to_owned();
|
||||
let doc_id = doc["doc"]["id"].as_str().expect("id").to_owned();
|
||||
@@ -400,6 +418,7 @@ async fn the_generic_writing_stops_at_a_module_and_an_order_is_never_corrected()
|
||||
#[tokio::test]
|
||||
async fn another_title_enters_into_force_and_its_translations_are_to_review() {
|
||||
let (mut yvv, mut chiara, state) = two().await;
|
||||
two_voices(&state, "titre").await;
|
||||
let doc = yvv.doc("essai").await;
|
||||
let module = doc["modules"]["title"]["id"].as_str().expect("id").to_owned();
|
||||
let uri = format!("/api/units/{module}/title");
|
||||
|
||||
Reference in New Issue
Block a user