WIP lot S : floor_amend retiré (le quorum le remplace), fixture de production sous tests/fixtures/seed-production-2026-11-02/, reprise des tests (api, inertia, ballots, objections, typos)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-11-03 04:06:07 +01:00
co-authored by Claude Opus 5.5
parent 6228d3913a
commit e2445f6467
14 changed files with 185 additions and 312 deletions
+29 -29
View File
@@ -318,7 +318,7 @@ async fn a_grouped_ballot_is_sealed_then_confirmed_by_the_indexer() {
assert_eq!(doc["vote"]["chain"]["amount"], 10);
assert_eq!(doc["vote"]["chain"]["test"], false);
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let e3 = version(&doc, "E3", "0");
let b = c.ballot(&doc, &[(&i1, Some("for")), (&e3, Some("against"))], Some(ALICE_GENERIC)).await;
let comment = b["comment"].as_str().expect("comment");
@@ -416,7 +416,7 @@ async fn a_silent_indexer_keeps_the_ballot_pending() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], None).await;
indexer.pay(100, b["comment"].as_str().expect("comment"), alice());
indexer.silent(true);
@@ -442,7 +442,7 @@ async fn a_signer_who_is_not_a_member_is_refused_and_told() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let former = c.ballot(&doc, &[(&i1, Some("for"))], None).await;
indexer.pay(
100,
@@ -474,7 +474,7 @@ async fn a_wrong_amount_or_recipient_is_refused() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
// Bound to the wallet that signs: its own transaction without the transfer is refused, and told.
let short = c.ballot(&doc, &[(&i1, Some("for"))], Some(ALICE)).await;
indexer.add(100, 1, short["comment"].as_str().expect("c"), alice(), &[(VOTE_ACCOUNT, 9)]);
@@ -500,7 +500,7 @@ async fn confirming_twice_changes_nothing() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], None).await;
indexer.pay(100, b["comment"].as_str().expect("c"), alice());
// The page and the background task at once.
@@ -527,8 +527,8 @@ async fn the_last_one_stands_in_the_order_of_the_chain() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let e1 = version(&doc, "E1", "inForce");
let i1 = version(&doc, "I1", "0");
let e1 = version(&doc, "E1", "0");
// Three ballots of the same person, signed in this order on the chain: for (I1, E1), against (I1), none (E1).
let first = c.ballot(&doc, &[(&i1, Some("for")), (&e1, Some("for"))], None).await;
let second = c.ballot(&doc, &[(&i1, Some("against"))], None).await;
@@ -609,7 +609,7 @@ async fn a_bound_ballot_ignores_a_copy_of_its_remark_by_another_account() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], Some(ALICE)).await;
let comment = b["comment"].as_str().expect("c");
// Charlie copies the remark seen in the pool and gets it in first.
@@ -631,7 +631,7 @@ async fn a_ballot_not_seen_in_time_is_let_go() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], None).await;
let expires = b["expiresAt"].as_str().expect("expires");
assert!(
@@ -660,7 +660,7 @@ async fn a_ballot_the_wallet_refused_to_sign_is_let_go_at_once() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let first = c.ballot(&doc, &[(&i1, Some("against"))], Some(ALICE)).await;
let b = c.ballot(&doc, &[(&i1, Some("for"))], Some(ALICE)).await;
assert_eq!(find(&c.doc("monnaie-libre").await, &i1)["myBallot"]["id"], b["id"]);
@@ -693,7 +693,7 @@ async fn a_session_sees_its_own_ballots_only() {
let mut other = chiara.other();
other.login("Yvv").await;
let doc = chiara.doc("monnaie-libre").await;
let (i1, e1) = (version(&doc, "I1", "inForce"), version(&doc, "E1", "inForce"));
let (i1, e1) = (version(&doc, "I1", "0"), version(&doc, "E1", "0"));
// Both sign with the same wallet (one person, two sessions): two ballots, two versions.
let a = chiara.ballot(&doc, &[(&i1, Some("for"))], None).await;
let b = other.ballot(&doc, &[(&e1, Some("against"))], None).await;
@@ -719,7 +719,7 @@ async fn fifty_voices_on_the_chain_make_a_text_pass_and_an_objection_holds_it()
let e4 = version(&doc, "E4", "0");
let e5 = version(&doc, "E5", "0");
let reason = "Ces deux textes disent le contraire l'un de l'autre.";
let e1 = version(&doc, "E1", "inForce");
let e1 = version(&doc, "E1", "0");
let keys: Vec<String> = (1..=50u8).map(|n| address::encode(G1_PREFIX, &[n; 32])).collect();
let mut last = Value::Null;
for (n, account) in keys.iter().enumerate() {
@@ -732,7 +732,7 @@ async fn fifty_voices_on_the_chain_make_a_text_pass_and_an_objection_holds_it()
);
if n == 49 {
// The last ballot is signed; before the chain confirms it, an objection holds
// E5 back against the text in force E1 (ADR 0010): no new ballot may hold it.
// E5 back against the seed proposal E1, written before it (ADR 0010, 0011): no new ballot may hold it.
let o = c
.ok(
"POST",
@@ -785,7 +785,7 @@ async fn on_the_chain_a_held_version_takes_against_and_withdrawal_never_for() {
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let doc_id = doc["doc"]["id"].as_str().expect("id").to_owned();
let (e1, e4, e5) = (version(&doc, "E1", "inForce"), version(&doc, "E4", "0"), version(&doc, "E5", "0"));
let (e1, e4, e5) = (version(&doc, "E1", "0"), version(&doc, "E4", "0"), version(&doc, "E5", "0"));
let o = c
.ok(
"POST",
@@ -856,7 +856,7 @@ async fn a_long_author_is_refused_at_once() {
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let doc_id = doc["doc"]["id"].as_str().expect("id").to_owned();
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
// The body may hold 256 KiB: an author of 250 000 characters passes it.
for n in [80_000usize, 250_000] {
let body = json!({ "lines": [{ "proposalId": i1, "choice": "for" }], "author": "z".repeat(n) });
@@ -875,7 +875,7 @@ async fn the_background_task_reaches_every_pending_ballot() {
let (mut a, state) = Client::new(chain_config(&indexer)).await;
a.login("Anna").await;
let doc = a.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let mut b = a.other();
b.login("Bruno").await;
let mut c = a.other();
@@ -910,7 +910,7 @@ async fn letting_ballots_go_does_not_lift_the_cap() {
a.login("Anna").await;
let doc = a.doc("monnaie-libre").await;
let doc_id = doc["doc"]["id"].as_str().expect("id").to_owned();
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
for _ in 0..20 {
let b = a.ballot(&doc, &[(&i1, Some("for"))], None).await;
a.ok("DELETE", &format!("/api/ballots/{}", id_of(&b)), None).await;
@@ -965,7 +965,7 @@ async fn an_unbound_ballot_is_not_settled_by_an_unpaid_copy() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], None).await;
indexer.add(99, 1, comment_of(&b), Signer { account: OTHER, identity: None }, &[]);
indexer.add(
@@ -992,7 +992,7 @@ async fn an_unbound_ballot_can_be_taken_by_a_paid_copy() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], None).await;
indexer.pay(99, comment_of(&b), Signer { account: CHARLIE, identity: Some((7, "Charlie", true)) });
indexer.pay(100, comment_of(&b), alice());
@@ -1012,7 +1012,7 @@ async fn an_older_pending_ballot_never_hides_a_newer_confirmed_vote() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
// A Ğecko code shown, never paid; then a vote from the wallet, confirmed.
c.ballot(&doc, &[(&i1, Some("against"))], None).await;
let newer = c.ballot(&doc, &[(&i1, Some("for"))], Some(ALICE)).await;
@@ -1035,7 +1035,7 @@ async fn a_comment_counts_once_its_block_is_final() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], Some(ALICE)).await;
let r = c.ballot(&doc, &[(&i1, Some("for"))], Some(BOB)).await;
indexer.finalized(Some(99));
@@ -1066,7 +1066,7 @@ async fn copies_never_hide_the_real_comment() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], Some(ALICE)).await;
for n in 0..120 {
indexer.pay(100 + n, comment_of(&b), Signer { account: CHARLIE, identity: Some((7, "Charlie", true)) });
@@ -1099,7 +1099,7 @@ async fn a_gecko_ballot_is_settled_by_the_background_task_even_at_its_end() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let b = c.ballot(&doc, &[(&i1, Some("for"))], None).await;
age(&state, "expires_at", -5, id_of(&b)).await;
indexer.pay(100, comment_of(&b), alice());
@@ -1124,7 +1124,7 @@ async fn the_receipt_is_for_the_one_who_asked_and_proves_the_vote() {
let (mut c, state) = Client::new(chain_config(&indexer)).await;
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let (i1, e3) = (version(&doc, "I1", "inForce"), version(&doc, "E3", "0"));
let (i1, e3) = (version(&doc, "I1", "0"), version(&doc, "E3", "0"));
let b = c.ballot(&doc, &[(&i1, Some("for")), (&e3, Some("against"))], Some(ALICE_GENERIC)).await;
indexer.pay(100, comment_of(&b), alice());
ballots::sweep(&state).await.expect("sweep");
@@ -1183,7 +1183,7 @@ async fn a_name_known_only_from_a_chain_vote_stays_free() {
let (mut admin, state) = Client::new(chain_config(&indexer)).await;
admin.login_admin("Yvv").await;
let doc = admin.doc("monnaie-libre").await;
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
for (block, signer) in [(100, alice()), (101, Signer { account: CHARLIE, identity: Some((9003, "Charlie", true)) })]
{
let b = admin.ballot(&doc, &[(&i1, Some("for"))], None).await;
@@ -1297,7 +1297,7 @@ async fn without_a_vote_account_the_chain_vote_is_off_and_the_test_group_still_v
assert!(doc["vote"]["chain"].is_null());
assert_eq!(doc["canVote"], false);
let doc_id = doc["doc"]["id"].as_str().expect("id").to_owned();
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let (s, v) = c
.call(
"POST",
@@ -1308,7 +1308,7 @@ async fn without_a_vote_account_the_chain_vote_is_off_and_the_test_group_still_v
assert_eq!((s, v["error"].as_str()), (StatusCode::CONFLICT, Some("chain_vote_off")));
let essai = c.doc("essai").await;
assert_eq!((essai["vote"]["way"].as_str(), essai["vote"]["open"].as_bool()), (Some("server"), Some(true)));
let p = version(&essai, "I1", "inForce");
let p = version(&essai, "I1", "0");
c.ok("POST", &format!("/api/proposals/{p}/vote"), Some(json!({ "choice": "for" }))).await;
}
@@ -1353,9 +1353,9 @@ async fn what_a_ballot_may_not_hold() {
c.login("Chiara").await;
let doc = c.doc("monnaie-libre").await;
let doc_id = doc["doc"]["id"].as_str().expect("id").to_owned();
let i1 = version(&doc, "I1", "inForce");
let i1 = version(&doc, "I1", "0");
let essai = c.doc("essai").await;
let elsewhere = version(&essai, "I1", "inForce");
let elsewhere = version(&essai, "I1", "0");
for (lines, author, code) in [
(json!([]), Value::Null, "lines"),
(