v3 : les versions d'un même instant gardent l'ordre où elles ont été écrites

Les variantes d'un seed partagent la même seconde : la liste les ordonnait par leur
identifiant aléatoire, donc différemment d'une base à l'autre (E3 : 0.4.0-draft avant
1.0.0 une fois sur deux, vu par C14). Dernier départage : l'ordre d'insertion (rowid).
Le moteur classe les rivales lui-même ; seul l'affichage change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-10-30 11:22:23 +01:00
co-authored by Claude Opus 5.5
parent edc88111e0
commit 1503e579ba
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -289,9 +289,11 @@ pub async fn load_state(state: &AppState, doc_id: &str) -> AppResult<DocState> {
.bind(doc_id)
.fetch_all(&state.db)
.await?;
// Same second (the variants of a seed): the order they were written in, not their
// random identifiers. The engine ranks rivals on its own; this order is what people see.
let proposals = sqlx::query_as::<_, ProposalRow>(&format!(
"{PROPOSAL_SELECT} WHERE p.unit_id IN (SELECT id FROM units WHERE doc_id = ?)
AND p.status IN ('open', 'in_force', 'draft') ORDER BY p.submitted_at, p.created_at, p.id"
AND p.status IN ('open', 'in_force', 'draft') ORDER BY p.submitted_at, p.created_at, p.rowid"
))
.bind(doc_id)
.fetch_all(&state.db)
+3 -1
View File
@@ -115,7 +115,9 @@ async fn the_seed_a_minima_and_the_open_proposals() {
// Every other article is an open proposal at zero votes, standard inertia.
let e3 = unit(&doc, "E3");
assert!(e3["inForce"].is_null());
assert_eq!(e3["proposals"].as_array().expect("p").len(), 2, "E3 and its 0.4.0 variant");
// In the order of the seed, whatever their random identifiers.
let labels: Vec<&str> = e3["proposals"].as_array().expect("p").iter().filter_map(|p| p["label"].as_str()).collect();
assert_eq!(labels, ["1.0.0", "0.4.0-draft"], "E3 and its 0.4.0 variant");
assert_eq!(e3["inertia"], "standard");
// Translations seeded.
assert!(e1["translations"]["en"]["body"].as_str().expect("en").contains("commit"));