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)