Skip to content

Commit 4d1bba5

Browse files
committed
docs: revision of ADR item numbers
1 parent 1df54a9 commit 4d1bba5

10 files changed

Lines changed: 481 additions & 476 deletions

sandbox/postgres/README.md

Lines changed: 76 additions & 76 deletions
Large diffs are not rendered by default.

sandbox/postgres/architecture_decision_records.md

Lines changed: 216 additions & 211 deletions
Large diffs are not rendered by default.

sandbox/postgres/master_schema_ddl.pgsql

Lines changed: 85 additions & 85 deletions
Large diffs are not rendered by default.

sandbox/postgres/master_schema_dml.pgsql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
INSERT INTO identity.entity (id) OVERRIDING SYSTEM VALUE VALUES (1),(2),(3),(4),(5),(6),(7),(8);
6262
SELECT setval(pg_get_serial_sequence('identity.entity', 'id'), 8);
6363

64-
-- LIEUX — spine spatial (ADR-024 : données postales séparées dans geo.postal_address)
64+
-- LIEUX — spine spatial (ADR-017 : données postales séparées dans geo.postal_address)
6565
INSERT INTO geo.place_core (id, name, coordinates, elevation)
6666
OVERRIDING SYSTEM VALUE VALUES
6767
(1, 'Cathédrale Notre-Dame de Paris', ST_SetSRID(ST_MakePoint(2.349747, 48.853133), 4326), 210),
@@ -78,7 +78,7 @@ OVERRIDING SYSTEM VALUE VALUES
7878
(12, 'Colombey-les-Deux-Églises', ST_SetSRID(ST_MakePoint(3.782467, 48.192773), 4326), 239);
7979
SELECT setval(pg_get_serial_sequence('geo.place_core', 'id'), 12);
8080

81-
-- ADRESSES POSTALES (ADR-024 · country_code 250 = France ISO 3166-1 numérique)
81+
-- ADRESSES POSTALES (ADR-017 · country_code 250 = France ISO 3166-1 numérique)
8282
INSERT INTO geo.postal_address (place_id, country_code, street, postal_code, locality, region) VALUES
8383
(1, 250, '6 Parvis Notre-Dame - Pl. Jean-Paul II', '75004', 'Paris', 'Île-de-France'),
8484
(2, 250, '35 Rue du Chevalier de la Barre', '75018', 'Paris', 'Île-de-France'),
@@ -192,7 +192,7 @@ INSERT INTO content.body (document_id, content) VALUES
192192
-- COMMENTAIRES (sur le document 5 — Agent 327)
193193
-- Exécution via la procédure content.create_comment() : traverse le même chemin
194194
-- d'écriture (I/O) qu'en production. Valide l'absence de dead tuples structurels
195-
-- et la construction correcte des chemins ltree (ADR-012).
195+
-- et la construction correcte des chemins ltree (ADR-007).
196196
-- L'argument OUT p_comment_id est ignoré ici (variable anonyme $_).
197197
DO $$
198198
DECLARE _id INT;

sandbox/postgres/tests/01_schema_and_security.sql

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ SELECT has_extension('postgis', 'Extension postgis présente');
3030

3131

3232
-- ============================================================
33-
-- TYPES PHYSIQUES — INT8 pour les montants monétaires (ADR-022)
33+
-- TYPES PHYSIQUES — INT8 pour les montants monétaires (ADR-026)
3434
--
3535
-- NUMERIC est varlena sans exception dans PostgreSQL (en-tête 4 B, arithmétique
3636
-- émulée en base 10000, padding d'alignement forcé). INT8 est pass-by-value,
@@ -43,7 +43,7 @@ SELECT has_extension('postgis', 'Extension postgis présente');
4343
SELECT col_type_is(
4444
'commerce', 'product_core', 'price_cents',
4545
'bigint',
46-
'product_core.price_cents : bigint, pas NUMERIC (ADR-022 — densité ×2)'
46+
'product_core.price_cents : bigint, pas NUMERIC (ADR-026 — densité ×2)'
4747
);
4848

4949
SELECT col_type_is(
@@ -55,12 +55,12 @@ SELECT col_type_is(
5555
SELECT col_type_is(
5656
'commerce', 'transaction_item', 'unit_price_snapshot_cents',
5757
'bigint',
58-
'transaction_item.unit_price_snapshot_cents : bigint (ADR-022)'
58+
'transaction_item.unit_price_snapshot_cents : bigint (ADR-026)'
5959
);
6060

6161

6262
-- ============================================================
63-
-- TYPES PHYSIQUES — VARCHAR au lieu de CHAR(n) (ADR-022)
63+
-- TYPES PHYSIQUES — VARCHAR au lieu de CHAR(n) (ADR-026)
6464
--
6565
-- CHAR(n) dans PostgreSQL est varlena comme VARCHAR(n) — pas de stockage fixe.
6666
-- Surcoût : padding espace à l'écriture + stripping à la lecture.
@@ -70,19 +70,19 @@ SELECT col_type_is(
7070
SELECT col_type_is(
7171
'org', 'org_legal', 'duns',
7272
'character varying(9)',
73-
'org_legal.duns : character varying(9), pas bpchar (ADR-022)'
73+
'org_legal.duns : character varying(9), pas bpchar (ADR-026)'
7474
);
7575

7676
SELECT col_type_is(
7777
'org', 'org_legal', 'siret',
7878
'character varying(14)',
79-
'org_legal.siret : character varying(14), pas bpchar (ADR-022)'
79+
'org_legal.siret : character varying(14), pas bpchar (ADR-026)'
8080
);
8181

8282
SELECT col_type_is(
8383
'commerce', 'product_identity', 'isbn_ean',
8484
'character varying(13)',
85-
'product_identity.isbn_ean : character varying(13), pas bpchar (ADR-022)'
85+
'product_identity.isbn_ean : character varying(13), pas bpchar (ADR-026)'
8686
);
8787

8888
-- Balayage global : aucun bpchar ne doit subsister dans les cinq schémas métier.
@@ -93,12 +93,12 @@ SELECT ok(
9393
WHERE table_schema IN ('identity', 'geo', 'org', 'commerce', 'content')
9494
AND data_type = 'character' -- 'character' = bpchar dans information_schema
9595
),
96-
'Aucune colonne CHAR(n) / bpchar dans les cinq schémas métier (ADR-022)'
96+
'Aucune colonne CHAR(n) / bpchar dans les cinq schémas métier (ADR-026)'
9797
);
9898

9999

100100
-- ============================================================
101-
-- ADR-021 — Colonnes de snapshot complètes dans content.revision
101+
-- ADR-024 — Colonnes de snapshot complètes dans content.revision
102102
--
103103
-- Ces colonnes ont été ajoutées suite à un audit : save_revision ne capturait
104104
-- pas alternative_headline ni description. Un snapshot incomplet crée un
@@ -107,17 +107,17 @@ SELECT ok(
107107

108108
SELECT has_column(
109109
'content', 'revision', 'snapshot_alternative_headline',
110-
'content.revision : colonne snapshot_alternative_headline présente (ADR-021)'
110+
'content.revision : colonne snapshot_alternative_headline présente (ADR-024)'
111111
);
112112

113113
SELECT has_column(
114114
'content', 'revision', 'snapshot_description',
115-
'content.revision : colonne snapshot_description présente (ADR-021)'
115+
'content.revision : colonne snapshot_description présente (ADR-024)'
116116
);
117117

118118

119119
-- ============================================================
120-
-- INDEX BRIN — paramètre pages_per_range (ADR-017)
120+
-- INDEX BRIN — paramètre pages_per_range (ADR-010)
121121
--
122122
-- Un BRIN avec pages_per_range inadapté dégrade silencieusement l'efficacité
123123
-- des requêtes temporelles (plus de blocs candidats chargés). Ces tests figent
@@ -167,7 +167,7 @@ SELECT ok(
167167

168168

169169
-- ============================================================
170-
-- SECURITY DEFINER — toutes les procédures de mutation (ADR-020)
170+
-- SECURITY DEFINER — toutes les procédures de mutation (ADR-001)
171171
--
172172
-- Sans SECURITY DEFINER, une procédure hérite des droits de l'appelant
173173
-- (marius_user), qui n'a pas de droits DML directs. Toute procédure sans
@@ -181,7 +181,7 @@ SELECT ok(
181181
JOIN pg_namespace n ON n.oid = p.pronamespace
182182
WHERE n.nspname = 'identity' AND p.proname = 'create_account' AND p.prokind = 'p'
183183
), false),
184-
'identity.create_account : SECURITY DEFINER (ADR-020)'
184+
'identity.create_account : SECURITY DEFINER (ADR-001)'
185185
);
186186

187187
SELECT ok(
@@ -190,7 +190,7 @@ SELECT ok(
190190
JOIN pg_namespace n ON n.oid = p.pronamespace
191191
WHERE n.nspname = 'identity' AND p.proname = 'create_person' AND p.prokind = 'p'
192192
), false),
193-
'identity.create_person : SECURITY DEFINER (ADR-020)'
193+
'identity.create_person : SECURITY DEFINER (ADR-001)'
194194
);
195195

196196
SELECT ok(
@@ -199,7 +199,7 @@ SELECT ok(
199199
JOIN pg_namespace n ON n.oid = p.pronamespace
200200
WHERE n.nspname = 'identity' AND p.proname = 'record_login' AND p.prokind = 'p'
201201
), false),
202-
'identity.record_login : SECURITY DEFINER (ADR-020)'
202+
'identity.record_login : SECURITY DEFINER (ADR-001)'
203203
);
204204

205205
SELECT ok(
@@ -208,7 +208,7 @@ SELECT ok(
208208
JOIN pg_namespace n ON n.oid = p.pronamespace
209209
WHERE n.nspname = 'identity' AND p.proname = 'grant_permission' AND p.prokind = 'p'
210210
), false),
211-
'identity.grant_permission : SECURITY DEFINER (ADR-020)'
211+
'identity.grant_permission : SECURITY DEFINER (ADR-001)'
212212
);
213213

214214
SELECT ok(
@@ -217,7 +217,7 @@ SELECT ok(
217217
JOIN pg_namespace n ON n.oid = p.pronamespace
218218
WHERE n.nspname = 'identity' AND p.proname = 'revoke_permission' AND p.prokind = 'p'
219219
), false),
220-
'identity.revoke_permission : SECURITY DEFINER (ADR-020)'
220+
'identity.revoke_permission : SECURITY DEFINER (ADR-001)'
221221
);
222222

223223
SELECT ok(
@@ -226,7 +226,7 @@ SELECT ok(
226226
JOIN pg_namespace n ON n.oid = p.pronamespace
227227
WHERE n.nspname = 'org' AND p.proname = 'create_organization' AND p.prokind = 'p'
228228
), false),
229-
'org.create_organization : SECURITY DEFINER (ADR-020)'
229+
'org.create_organization : SECURITY DEFINER (ADR-001)'
230230
);
231231

232232
SELECT ok(
@@ -235,7 +235,7 @@ SELECT ok(
235235
JOIN pg_namespace n ON n.oid = p.pronamespace
236236
WHERE n.nspname = 'content' AND p.proname = 'create_document' AND p.prokind = 'p'
237237
), false),
238-
'content.create_document : SECURITY DEFINER (ADR-020)'
238+
'content.create_document : SECURITY DEFINER (ADR-001)'
239239
);
240240

241241
SELECT ok(
@@ -244,7 +244,7 @@ SELECT ok(
244244
JOIN pg_namespace n ON n.oid = p.pronamespace
245245
WHERE n.nspname = 'content' AND p.proname = 'publish_document' AND p.prokind = 'p'
246246
), false),
247-
'content.publish_document : SECURITY DEFINER (ADR-020)'
247+
'content.publish_document : SECURITY DEFINER (ADR-001)'
248248
);
249249

250250
SELECT ok(
@@ -253,7 +253,7 @@ SELECT ok(
253253
JOIN pg_namespace n ON n.oid = p.pronamespace
254254
WHERE n.nspname = 'content' AND p.proname = 'save_revision' AND p.prokind = 'p'
255255
), false),
256-
'content.save_revision : SECURITY DEFINER (ADR-020)'
256+
'content.save_revision : SECURITY DEFINER (ADR-001)'
257257
);
258258

259259
SELECT ok(
@@ -262,7 +262,7 @@ SELECT ok(
262262
JOIN pg_namespace n ON n.oid = p.pronamespace
263263
WHERE n.nspname = 'content' AND p.proname = 'create_comment' AND p.prokind = 'p'
264264
), false),
265-
'content.create_comment : SECURITY DEFINER (ADR-020)'
265+
'content.create_comment : SECURITY DEFINER (ADR-001)'
266266
);
267267

268268
SELECT ok(
@@ -271,12 +271,12 @@ SELECT ok(
271271
JOIN pg_namespace n ON n.oid = p.pronamespace
272272
WHERE n.nspname = 'commerce' AND p.proname = 'create_transaction_item' AND p.prokind = 'p'
273273
), false),
274-
'commerce.create_transaction_item : SECURITY DEFINER (ADR-020)'
274+
'commerce.create_transaction_item : SECURITY DEFINER (ADR-001)'
275275
);
276276

277277

278278
-- ============================================================
279-
-- RBAC — marius_user ne peut pas écrire directement (ADR-020)
279+
-- RBAC — marius_user ne peut pas écrire directement (ADR-001)
280280
--
281281
-- Ces tests valident que l'invariant ECS est enforced au niveau moteur, pas
282282
-- seulement documenté. Un INSERT/UPDATE/DELETE direct par le rôle applicatif
@@ -319,7 +319,7 @@ SELECT ok(
319319
JOIN pg_namespace n ON n.oid = p.pronamespace
320320
WHERE n.nspname = 'identity' AND p.proname = 'anonymize_person' AND p.prokind = 'p'
321321
), false),
322-
'identity.anonymize_person : SECURITY DEFINER (ADR-020)'
322+
'identity.anonymize_person : SECURITY DEFINER (ADR-001)'
323323
);
324324

325325
SELECT ok(
@@ -328,7 +328,7 @@ SELECT ok(
328328
JOIN pg_namespace n ON n.oid = p.pronamespace
329329
WHERE n.nspname = 'org' AND p.proname = 'add_organization_to_hierarchy' AND p.prokind = 'p'
330330
), false),
331-
'org.add_organization_to_hierarchy : SECURITY DEFINER (ADR-020)'
331+
'org.add_organization_to_hierarchy : SECURITY DEFINER (ADR-001)'
332332
);
333333

334334
SELECT ok(
@@ -337,7 +337,7 @@ SELECT ok(
337337
JOIN pg_namespace n ON n.oid = p.pronamespace
338338
WHERE n.nspname = 'content' AND p.proname = 'add_tag_to_document' AND p.prokind = 'p'
339339
), false),
340-
'content.add_tag_to_document : SECURITY DEFINER (ADR-020)'
340+
'content.add_tag_to_document : SECURITY DEFINER (ADR-001)'
341341
);
342342

343343
SELECT ok(
@@ -346,14 +346,14 @@ SELECT ok(
346346
JOIN pg_namespace n ON n.oid = p.pronamespace
347347
WHERE n.nspname = 'content' AND p.proname = 'remove_tag_from_document' AND p.prokind = 'p'
348348
), false),
349-
'content.remove_tag_from_document : SECURITY DEFINER (ADR-020)'
349+
'content.remove_tag_from_document : SECURITY DEFINER (ADR-001)'
350350
);
351351

352352
-- ============================================================
353353
-- TRIGGERS modified_at — cohérence des métadonnées temporelles
354354
--
355355
-- L'absence d'un trigger laisse modified_at figé à NULL après mutation.
356-
-- Le trigger media_core_modified_at a été ajouté suite à un audit (ADR-021) :
356+
-- Le trigger media_core_modified_at a été ajouté suite à un audit (ADR-024) :
357357
-- c'était la seule table mutable exposant modified_at sans trigger associé.
358358
-- ============================================================
359359

@@ -369,7 +369,7 @@ SELECT has_trigger(
369369

370370
SELECT has_trigger(
371371
'content', 'media_core', 'media_core_modified_at',
372-
'Trigger media_core_modified_at présent sur content.media_core (ADR-021)'
372+
'Trigger media_core_modified_at présent sur content.media_core (ADR-024)'
373373
);
374374

375375
SELECT has_trigger(
@@ -384,7 +384,7 @@ SELECT ok(
384384
JOIN pg_namespace n ON n.oid = p.pronamespace
385385
WHERE n.nspname = 'commerce' AND p.proname = 'create_transaction' AND p.prokind = 'p'
386386
), false),
387-
'commerce.create_transaction : SECURITY DEFINER (ADR-020 + ADR-023)'
387+
'commerce.create_transaction : SECURITY DEFINER (ADR-001 + ADR-016)'
388388
);
389389

390390
-- transaction_core, transaction_price, transaction_payment, transaction_delivery all exist
@@ -396,30 +396,30 @@ SELECT ok(
396396
'transaction_payment','transaction_delivery'
397397
)
398398
) = 4,
399-
'Quatre composants ECS de commande présents dans le schéma commerce (ADR-023)'
399+
'Quatre composants ECS de commande présents dans le schéma commerce (ADR-016)'
400400
);
401401

402-
-- Bits 0-20 définis dans identity.permission_bit (ADR-027)
402+
-- Bits 0-20 définis dans identity.permission_bit (ADR-004)
403403
SELECT is(
404404
(SELECT COUNT(*)::INT FROM identity.permission_bit),
405405
21,
406-
'identity.permission_bit : 21 entrées (bits 0-20, ADR-027)'
406+
'identity.permission_bit : 21 entrées (bits 0-20, ADR-004)'
407407
);
408408

409409
-- Bit 20 (export_data = 1048576) présent
410410
SELECT ok(
411411
EXISTS (SELECT 1 FROM identity.permission_bit WHERE bit_value = 1048576 AND bit_index = 20),
412-
'identity.permission_bit : export_data (bit 20 = 1048576) présent (ADR-027)'
412+
'identity.permission_bit : export_data (bit 20 = 1048576) présent (ADR-004)'
413413
);
414414

415-
-- content.tag ne doit plus avoir de colonne ltree path (ADR-026)
415+
-- content.tag ne doit plus avoir de colonne ltree path (ADR-018)
416416
SELECT hasnt_column(
417417
'content', 'tag', 'path',
418-
'content.tag : colonne path ltree supprimée (ADR-026 — Closure Table)'
418+
'content.tag : colonne path ltree supprimée (ADR-018 — Closure Table)'
419419
);
420420

421421
-- content.tag_hierarchy existe avec la PK composite attendue
422-
SELECT has_table('content', 'tag_hierarchy', 'content.tag_hierarchy présente (ADR-026)');
422+
SELECT has_table('content', 'tag_hierarchy', 'content.tag_hierarchy présente (ADR-018)');
423423

424424
-- create_tag : SECURITY DEFINER
425425
SELECT ok(
@@ -428,7 +428,7 @@ SELECT ok(
428428
JOIN pg_namespace n ON n.oid = p.pronamespace
429429
WHERE n.nspname = 'content' AND p.proname = 'create_tag' AND p.prokind = 'p'
430430
), false),
431-
'content.create_tag : SECURITY DEFINER (ADR-020 + ADR-026)'
431+
'content.create_tag : SECURITY DEFINER (ADR-001 + ADR-018)'
432432
);
433433

434434

0 commit comments

Comments
 (0)