Files
decision/crates/ld-server/migrations/0005_inertia_levels.sql
T
YvvandClaude Opus 5.5 d762301706 v3 : inertie à cinq crans — moteur, données, serveur (L10)
Moteur (ld-engine/inertia.rs) : cinq crans, M_k = 50, 50, 55, 60, 66 % ;
s_k = 60, 67, 75, 83, 90 % de « pour » au-delà de C à la participation
habituelle p̃ ; G_k = ln(1 − (s_k − M_k)/(1 − M_k)) / ln(p̃). p̃ = médiane
des votants des propositions du groupe (au moins 5, votées dans l'année),
sinon la référence 2C/W ; bornée à [1 %, 50 %]. Le changement d'inertie
hérite du cran de l'article (remplace « inertie + »). Un seuil qui tombe
sur un entier n'y gagne plus une voix par arrondi.

Données : migration 0005 (les quatre mots deviennent 2 à 5, gardés tels
quels dans *_legacy ; adoptions intactes ; journaux inertia_changes et
inertia_amendments). Seed : 3 partout, 4 pour E1 et E2. Amendement
d'inertie gardé (E1, E2 : 3 → 4, seulement si aucun vote n'a changé leur
inertie ; une proposition d'inertie ouverte reste ouverte, votée au
nouveau cran), journalisé, une seule fois, republié.

Serveur : participation mesurée une fois par jour (settings), échelle
dans les seuils, le balayage et l'adoption ; crans, M, G, s_k, p̃ et sa
source servis au client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:14:40 +01:00

51 lines
2.7 KiB
SQL

-- Inertia in five levels (2026-10-30, ADR 0007). Additive: nothing is lost.
--
-- The four words of before become levels: low → 2, standard → 3, high → 4,
-- max → 5 (level 1 is new, below them). Each word is first kept as it was, in a
-- column of its own, then its level is written in its place. The adoptions are
-- left as they are: their `params` hold the M and G each was judged by. The
-- server still reads the four words (a row written by an older image).
ALTER TABLE units ADD COLUMN inertia_legacy TEXT; -- the word before 2026-10-30, as it was
UPDATE units SET inertia_legacy = inertia WHERE inertia IN ('low', 'standard', 'high', 'max');
UPDATE units SET inertia = CASE inertia
WHEN 'low' THEN '2' WHEN 'standard' THEN '3' WHEN 'high' THEN '4' WHEN 'max' THEN '5' END
WHERE inertia IN ('low', 'standard', 'high', 'max');
ALTER TABLE proposals ADD COLUMN inertia_target_legacy TEXT; -- the word before 2026-10-30, as it was
UPDATE proposals SET inertia_target_legacy = inertia_target WHERE inertia_target IN ('low', 'standard', 'high', 'max');
UPDATE proposals SET inertia_target = CASE inertia_target
WHEN 'low' THEN '2' WHEN 'standard' THEN '3' WHEN 'high' THEN '4' WHEN 'max' THEN '5' END
WHERE inertia_target IN ('low', 'standard', 'high', 'max');
-- Every change of the inertia of an article from now on, by a vote or by an
-- amendment of the seed: what the article says of its own inertia.
CREATE TABLE inertia_changes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
unit_id TEXT NOT NULL REFERENCES units(id),
doc_id TEXT NOT NULL REFERENCES documents(id),
from_level TEXT NOT NULL,
to_level TEXT NOT NULL,
cause TEXT NOT NULL, -- vote | amendment
proposal_id TEXT, -- the change of inertia voted
amendment_id TEXT, -- the amendment applied
at TEXT NOT NULL
);
CREATE INDEX inertia_changes_unit ON inertia_changes(unit_id);
-- Inertia amendments (src/inertia_amend.rs): a starting level of the seed raised
-- in an existing base, decided once per document and only on an article whose
-- inertia no vote ever changed. Each decision is kept here: applied, refused
-- (and why), or already present.
CREATE TABLE inertia_amendments (
amendment_id TEXT NOT NULL,
doc_id TEXT NOT NULL REFERENCES documents(id),
unit_code TEXT NOT NULL,
from_level TEXT, -- the level found
to_level TEXT NOT NULL,
outcome TEXT NOT NULL, -- applied | refused | present
reason TEXT, -- why it was refused
at TEXT NOT NULL,
PRIMARY KEY (amendment_id, doc_id)
);