polytypo 1.21.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/polytypo/data/VERSION +1 -1
  3. data/lib/polytypo/data/fixtures/bg.json +12 -4
  4. data/lib/polytypo/data/fixtures/cs.json +9 -1
  5. data/lib/polytypo/data/fixtures/de-CH.json +12 -4
  6. data/lib/polytypo/data/fixtures/de-DE.json +113 -13
  7. data/lib/polytypo/data/fixtures/el.json +28 -4
  8. data/lib/polytypo/data/fixtures/en-GB.json +23 -7
  9. data/lib/polytypo/data/fixtures/en-US.json +694 -162
  10. data/lib/polytypo/data/fixtures/es.json +1 -1
  11. data/lib/polytypo/data/fixtures/fi.json +10 -2
  12. data/lib/polytypo/data/fixtures/fr-CA.json +9 -1
  13. data/lib/polytypo/data/fixtures/fr.json +46 -13
  14. data/lib/polytypo/data/fixtures/hr.json +9 -1
  15. data/lib/polytypo/data/fixtures/hu.json +28 -4
  16. data/lib/polytypo/data/fixtures/it.json +1 -1
  17. data/lib/polytypo/data/fixtures/locale-resolution.json +1 -1
  18. data/lib/polytypo/data/fixtures/lt.json +9 -1
  19. data/lib/polytypo/data/fixtures/nl.json +17 -1
  20. data/lib/polytypo/data/fixtures/pl.json +17 -1
  21. data/lib/polytypo/data/fixtures/pt-BR.json +9 -1
  22. data/lib/polytypo/data/fixtures/pt-PT.json +9 -1
  23. data/lib/polytypo/data/fixtures/ro.json +2 -2
  24. data/lib/polytypo/data/fixtures/ru.json +38 -6
  25. data/lib/polytypo/data/fixtures/sk.json +9 -1
  26. data/lib/polytypo/data/fixtures/sl.json +9 -1
  27. data/lib/polytypo/data/fixtures/sr.json +12 -4
  28. data/lib/polytypo/data/fixtures/sv.json +12 -4
  29. data/lib/polytypo/data/fixtures/tr.json +9 -1
  30. data/lib/polytypo/data/fixtures/uk.json +1 -1
  31. data/lib/polytypo/data/locales/bg.json +9 -1
  32. data/lib/polytypo/data/locales/cs.json +2 -0
  33. data/lib/polytypo/data/locales/de-CH.json +9 -1
  34. data/lib/polytypo/data/locales/de-DE.json +9 -1
  35. data/lib/polytypo/data/locales/el.json +9 -1
  36. data/lib/polytypo/data/locales/en-GB.json +9 -4
  37. data/lib/polytypo/data/locales/en-US.json +11 -11
  38. data/lib/polytypo/data/locales/es.json +2 -0
  39. data/lib/polytypo/data/locales/fi.json +8 -3
  40. data/lib/polytypo/data/locales/fr-CA.json +9 -1
  41. data/lib/polytypo/data/locales/fr.json +3 -1
  42. data/lib/polytypo/data/locales/hr.json +3 -1
  43. data/lib/polytypo/data/locales/hu.json +9 -1
  44. data/lib/polytypo/data/locales/it.json +2 -0
  45. data/lib/polytypo/data/locales/lt.json +12 -5
  46. data/lib/polytypo/data/locales/nl.json +10 -2
  47. data/lib/polytypo/data/locales/pl.json +10 -2
  48. data/lib/polytypo/data/locales/pt-BR.json +4 -2
  49. data/lib/polytypo/data/locales/pt-PT.json +5 -3
  50. data/lib/polytypo/data/locales/registry.json +1 -1
  51. data/lib/polytypo/data/locales/ro.json +2 -0
  52. data/lib/polytypo/data/locales/ru.json +9 -17
  53. data/lib/polytypo/data/locales/sk.json +7 -5
  54. data/lib/polytypo/data/locales/sl.json +3 -1
  55. data/lib/polytypo/data/locales/sr.json +9 -2
  56. data/lib/polytypo/data/locales/sv.json +8 -6
  57. data/lib/polytypo/data/locales/tr.json +4 -2
  58. data/lib/polytypo/data/locales/uk.json +2 -0
  59. data/lib/polytypo/data/rules/modes.md +22 -5
  60. data/lib/polytypo/data/rules/nbsp.md +271 -74
  61. data/lib/polytypo/data/rules/order.json +1 -1
  62. data/lib/polytypo/data/rules/pipeline-idempotency.md +54 -7
  63. data/lib/polytypo/data/rules/quote-punctuation.md +14 -7
  64. data/lib/polytypo/data/rules/quotes.md +14 -5
  65. data/lib/polytypo/data/rules/ranges.md +7 -1
  66. data/lib/polytypo/data/rules/spaces.md +4 -2
  67. data/lib/polytypo/data/rules/symbols.md +2 -1
  68. data/lib/polytypo/data/schema/locale.schema.json +15 -1
  69. data/lib/polytypo/engine/rules/nbsp.rb +161 -11
  70. data/lib/polytypo/modes/html.rb +10 -0
  71. data/lib/polytypo/version.rb +1 -1
  72. metadata +1 -1
@@ -1,10 +1,10 @@
1
1
  # Rule: `nbsp`
2
2
 
3
3
  **Order:** 70 (last). **Default:** on. **Modes:** text, html, markdown, yaml.
4
- **Spec version:** 1.5.0 (0.1.0 for everything except §3.9's `initialBinding` change (0.6.0),
5
- §3.3's span-boundary paragraphs (1.2.0), §3.3's character-reference guard (1.3.0) and §5's `I₆`
6
- discharge against `apostrophe`'s `CLOSEDELIM` (1.5.0), noted inline — 1.5.0 adds no sub-rule and
7
- changes nothing this rule computes).
4
+ **Spec version:** 1.22.0 (0.1.0 for everything except §3.9's `initialBinding` change (0.6.0),
5
+ §3.3's span-boundary paragraphs (1.2.0), §3.3's character-reference guard (1.3.0), §5's `I₆`
6
+ discharge against `apostrophe`'s `CLOSEDELIM` (1.5.0) and N5's `spacedUnits` / `closedUnits`
7
+ insertion and deletion with guards G-U and G-R (§3.7, 1.22.0), noted inline).
8
8
 
9
9
  ---
10
10
 
@@ -30,7 +30,12 @@ that already carries the right no-break spaces.
30
30
  - `nbsp.narrowBeforePunctuation` — array of single characters that take U+202F before them
31
31
  - `nbsp.afterShortWords` — array of lowercase words
32
32
  - `nbsp.abbreviations` — array of literal multi-token abbreviations written with U+0020
33
- - `nbsp.beforeUnits` — array of units that bind to a preceding number
33
+ - `nbsp.beforeUnits` — array of units that bind to a preceding number when the author typed a space
34
+ (conversion only)
35
+ - `nbsp.spacedUnits` — array of units a locale writes with a space after the number (spec 1.22.0):
36
+ an existing space is bound, a missing one is inserted
37
+ - `nbsp.closedUnits` — array of units a locale writes closed up to the number (spec 1.22.0): a
38
+ space between the number and the unit is deleted
34
39
  - `nbsp.beforeNumber` — array of abbreviations that bind to a following **number**
35
40
  - `nbsp.beforeWord` — array of abbreviations that bind to a following **word**
36
41
  - `nbsp.afterSymbols` — array of symbols that bind to a following number
@@ -430,23 +435,112 @@ For each entry `s` in `nbsp.abbreviations`, of `k` code points:
430
435
 
431
436
  Longest match wins at a given `a`, with no backtracking (§3.5).
432
437
 
433
- ### 3.7 N5 — `beforeUnits` (U+00A0, conversion only)
434
-
435
- For each entry `u` in `nbsp.beforeUnits`, of `k` code points:
436
-
437
- 1. Find each index `a` where `cp[a … a+k-1]` matches `u` exactly (code-point equality; no
438
- case leniency — `Kg` is not `kg`).
439
- 2. **Right boundary.** `cp[a+k]` must not be in `ALNUM`. This is what stops the unit `kg`
440
- from matching inside `kgf`, and `m` from matching inside `metres`.
441
- 3. **Left side.** `cp[a-1]` must be `SP` or `NBSP`; nothing else qualifies. If it is `NBSP`,
442
- emit nothing. **If there is no space at all, this sub-rule does nothing** — see §7.2, it
443
- never inserts.
444
- 4. `cp[a-2]` must be in `DIGIT`. Let `Lrun` be the maximal `DIGIT` run ending at `a-2`,
445
- starting at index `b`. `cp[b-1]` must not be in `LETTER` (so `H2 O` does not bind).
446
- 5. Emit an edit replacing `cp[a-1]` with U+00A0.
447
-
448
- Longest match wins at a given `a`, with no backtracking (§3.5), so a locale listing both `m`
449
- and `mm` binds `5 mm` correctly and does not fall back to `m` when the `mm` match is rejected.
438
+ ### 3.7 N5 — units (`beforeUnits`, `spacedUnits`, `closedUnits`)
439
+
440
+ Three lists, one sub-rule, one scan. `beforeUnits` converts, `spacedUnits` converts and inserts,
441
+ `closedUnits` deletes. An entry is in **at most one** of the three lists, and in neither
442
+ `spacedUnits` nor `closedUnits` if it is in `afterSymbols`; `scripts/validate-spec.mjs` enforces
443
+ both. `fi`'s `§` stays in `beforeUnits` and `afterSymbols`, where the two are disjoint by their
444
+ own left and right tests (§3.8).
445
+
446
+ For each index `a` where an entry `u` of `k` code points from any of the three lists matches
447
+ `cp[a … a+k-1]` exactly (code-point equality; no case leniency — `Kg` is not `kg`):
448
+
449
+ 1. **Longest match wins at `a`, across all three lists, with no backtracking** (§3.5). A locale
450
+ listing `km` in one list and `km/h` in another binds `5 km/h` as the longer entry and never
451
+ falls back to `km` when the longer match is rejected.
452
+ 2. **Right boundary.** `cp[a+k]` must not be in `ALNUM`. This is what stops the unit `kg` from
453
+ matching inside `kgf`, and `m` from matching inside `metres`.
454
+ 3. **The separator and the number.** Exactly one of two shapes must hold, otherwise the
455
+ sub-rule does nothing:
456
+ - **Spaced:** `cp[a-1]` is `SP` or `NBSP` (for `closedUnits` also `NNBSP`), `cp[a-2]` is in
457
+ `DIGIT`, and with `Lrun` the maximal `DIGIT` run ending at `a-2` and starting at `b`,
458
+ `cp[b-1]` is not in `LETTER` (so `H2 O` does not bind).
459
+ - **Touching:** `cp[a-1]` is in `DIGIT`, and with `Lrun` the maximal `DIGIT` run ending at
460
+ `a-1` and starting at `b`, `cp[b-1]` is not in `LETTER`.
461
+ 4. **Action**, by the list the matched entry belongs to:
462
+
463
+ | List | Spaced | Touching |
464
+ | --------------- | --------------------------------------- | -------------- |
465
+ | `beforeUnits` | `SP` → U+00A0; `NBSP` already correct | nothing |
466
+ | `spacedUnits` | `SP` → U+00A0; `NBSP` already correct\* | insert U+00A0 before the unit |
467
+ | `closedUnits` | delete the separator | already correct |
468
+
469
+ \* `NNBSP` in `cp[a-1]` is not converted and not deleted by `spacedUnits`: an authored U+202F
470
+ is the right kind of space and the rule leaves it.
471
+
472
+ 5. **Guards for insertion and deletion (G-U).** Converting an existing space (`beforeUnits`,
473
+ and `spacedUnits` when a space is already there) follows steps 1-3 and nothing below applies
474
+ to it. Inserting for `spacedUnits` and deleting for `closedUnits` happen only if all of these
475
+ hold, otherwise the sub-rule does nothing for this match:
476
+ 1. **Number start.** From `b`, while `cp[b-1]` is U+002C or U+002E and `cp[b-2]` is in
477
+ `DIGIT`, move `b` to the start of the `DIGIT` run ending at `b-2` (a decimal or thousands
478
+ separator belongs to the number). Then `cp[b-1]` must be `NONE`, in `SPACELIKE`, in
479
+ `OPENISH`, in `SENTENCE-DASH`, or one of U+002B, U+00B1, U+00D7, U+2212, U+007E,
480
+ U+2248, U+003C, U+003E, U+2060 (the joiner `ranges` writes beside a dash); or U+002D when `cp[b-2]` is `NONE`, `SPACELIKE` or `OPENISH` (a sign, not a hyphen
481
+ joining `file-5kg`). This is what keeps `v2-5kg.png`, `/5km`, `?q=5kg`, `x_5kg` and `A4 km`
482
+ out of the rule, and it refuses at a span boundary marker (§3.1: the marker is in
483
+ `CLOSEISH`, not in the list above).
484
+ 2. **Right context.** `cp[a+k]` is not U+002D, U+2011 or U+005F; and not U+002E followed by a
485
+ member of `ALNUM`. A hyphen after the unit marks a compound (`0,5‰-Grenze`, `15cm-norm`,
486
+ `5-%-Klausel`) in which the author's spacing is the norm, and `5kg.png` is a file name.
487
+ 3. **Dash adjacency (G-R), for a unit whose first code point is in `CLOSED-SYMBOL`**
488
+ (`ranges.md` §3.2a: `%`, `‰`, `°`, `$` and the other currency signs). Let `b` be the number
489
+ start of step 5.1 and `e = a+k`. Skip a single run, in any mixture, of `SPACELIKE` code points that are not in `BREAK` and of
490
+ U+2060 (the walk stops at a span boundary marker, which is in `BREAK`), leftwards from `b-1` and rightwards from `e`; if the first code point reached on
491
+ either side is in `DASH` ∪ `INERT-DASH` (`dashes.md` §3.1), do nothing. Whether a symbol is
492
+ closed up to its number is what `ranges` and `dashes` read to decide that `15% - 20%` is a
493
+ range; inserting or deleting the space after both rules have run would hand the next pass a
494
+ different verdict (`15 % - 20 %` → `15%—20%`, which the next pass makes `15%⁠–⁠20%`). A
495
+ unit that is not a closed-up symbol is not read that way and is not subject to this guard.
496
+ 4. **Modulo guard (`closedUnits` only).** `cp[a+k]` is not the single code point U+0020
497
+ followed by a member of `DIGIT`: `10 % 3` is an operation, and deleting the space would
498
+ change it. Only U+0020 counts (not U+00A0 or U+202F), which is the reading §5 proves against: no
499
+ other sub-rule converts the space after a `closedUnits` entry (U4 below), so a U+0020 read here
500
+ on the first run is still a U+0020 on the second.
501
+ 5. **Multiplication guard (`spacedUnits` insertion only).** Let `b` be the number start of
502
+ step 5.1. Read leftwards from `b-1`: at most one code point of `SPACE` ∪ `NOBREAK-SPACE`,
503
+ then one `MUL-LETTER` (`symbols.md` §3.1), then at most one code point of `SPACE` ∪
504
+ `NOBREAK-SPACE`, then a code point in `DIGIT`. If the whole shape is present, do nothing:
505
+ the number is the right operand of a multiplication chain, and `symbols` declines to
506
+ convert that chain while a letter follows it (guard M3). Inserting U+00A0 would end the
507
+ chain with a non-letter and hand the next pass a chain it now converts (`2 x 3kg` →
508
+ `2 x 3⍽kg` → `2 × 3⍽kg`). A `closedUnits` entry never begins with a letter (U3 below), so deletion
509
+ cannot move M3's verdict and is not subject to this guard; nor can the insertion form a
510
+ chain link of its own, because no `spacedUnits` entry begins with a `MUL-LETTER` (U2).
511
+ 6. Emit the edit of step 4: a replacement of `cp[a-1]` with U+00A0, the deletion of `cp[a-1]`
512
+ (an edit with an empty replacement), or an insertion of U+00A0 at index `a`.
513
+
514
+ **Why the three lists differ in what they may do.** A locale file attests *membership* — which
515
+ tokens are units and how the locale's sources write them (§2.1). It cannot say how a source's
516
+ silence should be read, so it does not get to: a unit whose sources leave the spacing to the
517
+ author, or make it depend on grammar (Czech writes `14 %` for a noun and `20%ní` for an
518
+ adjective), stays in `beforeUnits` and the engine keeps the author's choice. Insertion and
519
+ deletion are a content change, so each is allowed only for a unit with a national source that
520
+ states the form, and a locale that is listed in `closedUnits` or `spacedUnits` is making that
521
+ claim in its `sources`. Where the sources permit both forms the locale chooses `closedUnits`, so
522
+ that one author's text looks the same throughout (operator decision, 2026-11-11).
523
+
524
+ Bare `°` is in no list in any locale: written closed for an angle or a latitude, and with an
525
+ unnamed scale ambiguous. Only `°C` and `°F` are units. Single-letter symbols (`m`, `g`, `s`, `h`)
526
+ are listed in no `spacedUnits` or `closedUnits` for the same reason as before: they cannot be told
527
+ from ordinary text (`1970s`, `£2m`, `18h30`).
528
+
529
+ **Data properties the argument of §5 relies on.** They are properties of the entries, not of the
530
+ algorithm, and §5 is only as good as they are. `scripts/validate-spec.mjs` enforces U1-U4.
531
+
532
+ - **U1** No entry of the three lists begins or ends with a quotation glyph the locale declares.
533
+ - **U2** No entry of the three lists begins with a member of `SPACELIKE`, `CLOSEISH`
534
+ (`beforePunctuation` and `narrowBeforePunctuation` are subsets of it, `quotes.md` §2.1 Q-P) or
535
+ `DASH` ∪ `INERT-DASH` (`dashes.md` §3.1), or with U+0022, U+0027, U+002C, U+002E, U+002F or
536
+ U+2026, or contains U+002D or U+2011. No `spacedUnits` entry begins with a `MUL-LETTER`
537
+ (`symbols.md` §3.1).
538
+ - **U3** No `closedUnits` entry begins with a `LETTER` or contains U+002E.
539
+ - **U4** No entry of `afterShortWords`, `abbreviations`, `beforeNumber`, `beforeWord` or
540
+ `afterSymbols` ends with a `DIGIT` or with the last code point of a `closedUnits` entry, and no
541
+ `abbreviations` entry has a `DIGIT` immediately before an internal space. So no sub-rule other
542
+ than N5 can claim the separator between a number and a `closedUnits` entry, or convert the space
543
+ after one.
450
544
 
451
545
  ### 3.8 N6 — `afterSymbols` (U+00A0, conversion only)
452
546
 
@@ -614,7 +708,7 @@ For each entry `s` in `nbsp.beforeNumber`, of `k` code points:
614
708
  a number after `Nr.`).
615
709
  5. Emit an edit replacing `cp[a+k]` with U+00A0.
616
710
 
617
- **Never inserts.** `Nr.5` stays `Nr.5`, for the same reason N5 never inserts: adding a space
711
+ **Never inserts.** `Nr.5` stays `Nr.5`, for the same reason N6 never inserts: adding a space
618
712
  is a content change, not a typographic one.
619
713
 
620
714
  **N9 has no equivalent of N10's guard G-D**, so a one-letter abbreviation such as `S.` binds
@@ -697,11 +791,23 @@ a changed character. This is recorded as §7.9 and must be reviewed at the M4 ga
697
791
 
698
792
  ### 3.13 Insertions and indices
699
793
 
700
- Sub-rules N1, N2 and N8 can _insert_ a code point. Because rules produce edits and the
794
+ Sub-rules N1, N2, N5 (through `spacedUnits`) and N8 can _insert_ a code point, and N5 (through `closedUnits`) can _delete_ one. Because rules produce edits and the
701
795
  pipeline applies them (ARCHITECTURE.md §7.1), every index above refers to the **input**
702
796
  array. An insertion is an edit with an empty replaced span at a given index. Two insertions
703
797
  at the same index cannot occur: the first-claim-wins rule of §3.2 forbids it.
704
798
 
799
+ The claim key of an insertion is the index it is inserted at (the index of the code point it
800
+ goes before); the key of a conversion or a deletion is the index of the code point it replaces.
801
+ Both kinds of key share one index space, so an insertion at `a` and a conversion of `cp[a]` are
802
+ the **same** key and the first claim wins. For N5's touching insertion at `a`, `cp[a]` is the
803
+ first code point of a listed unit, and neither rival can arise: a conversion or deletion of
804
+ `cp[a]` needs `cp[a]` to be a space, an N1/N2 insertion at `a` needs it to be in
805
+ `beforePunctuation` ∪ `narrowBeforePunctuation` (a subset of `CLOSEISH`), and an N8 insertion
806
+ needs a quotation glyph beside it; U1 and U2 exclude all three. N5's conversion or deletion of
807
+ the separator `cp[a-1]` is keyed `a-1`, which another sub-rule can claim only for a
808
+ `beforeUnits` or `spacedUnits` entry (N1-N4 and N6-N10 convert, and first claim wins as for any
809
+ index); for a `closedUnits` entry U4 and U2 leave N5 the only claimant.
810
+
705
811
  ---
706
812
 
707
813
  ## 4. Must not touch
@@ -721,9 +827,12 @@ of being falsified by another rule, which is then named.
721
827
  - **[P] `http://`, `12:30`, `1:2`** in a locale that lists U+003A in `beforePunctuation`. N1
722
828
  guard 2.
723
829
  - **[P] The second and later marks of `?!`, `!!!`, `?..`** — N1/N2 guard 1.
724
- - **[P] A unit with no space before it.** `5km` and `5%` stay exactly as typed; N5 converts, never
725
- inserts (§7.2).
726
- - **[P] A number written as `H2O`, `A4`, `MP3`.** N5 step 4's letter guard.
830
+ - **[P] A unit in `beforeUnits` with no space before it, and a unit in no list.** `5km` stays
831
+ exactly as typed when `km` is in `beforeUnits` or in no list; N5 inserts only for `spacedUnits`
832
+ and deletes only for `closedUnits` (§3.7 step 4).
833
+ - **[P] A unit inside a compound, a file name or an identifier.** `0,5‰-Grenze`, `15cm-norm`,
834
+ `5kg.png`, `/5km`, `x_5kg` and `10 % 3` are left as typed by N5's guards G-U (§3.7 step 5).
835
+ - **[P] A number written as `H2O`, `A4`, `MP3`.** N5 step 3's letter guard.
727
836
  - **[P] An existing U+00A0 or U+202F that is already the right character.** Every sub-rule's
728
837
  "already correct" branch emits nothing, so a correctly-typeset document round-trips
729
838
  byte-identically. This is the property PLAN.md §3.4 exists for.
@@ -747,7 +856,7 @@ target of each sub-rule is exactly the state that branch recognises:
747
856
  | N2 | `NARROW-TARGET` immediately left of the mark | §3.4 |
748
857
  | N3 | `NBSP` after the short word | §3.5 step 3 |
749
858
  | N4 | `NBSP` at every internal position of the abbreviation | §3.6 step 1 (space-lenient match) + step 3 |
750
- | N5 | `NBSP` before the unit | §3.7 step 3 |
859
+ | N5 | `NBSP` before the unit (`beforeUnits`, `spacedUnits`); no separator (`closedUnits`) | §3.7 step 4 |
751
860
  | N6 | `NBSP` after the symbol | §3.8 step 3 |
752
861
  | N7 | `NBSP` at the bound space | §3.9 |
753
862
  | N8 | `target` beside the quote glyph | §3.10 |
@@ -770,12 +879,21 @@ Guards test three kinds of thing:
770
879
  ownership of the index beside a quotation glyph by position, whatever character either
771
880
  sub-rule would have written there.
772
881
  1. **Membership in `SPACELIKE`.** Every conversion `SP → NBSP`, `SP → NNBSP`,
773
- `NNBSP → NBSP`, `NBSP → NNBSP` stays inside `SPACELIKE` (§3.1). Every insertion adds a
774
- `NOBREAK`, which is in `SPACELIKE`. So every boundary test that passed on run 1 passes on
775
- run 2, and every one that failed still fails — **provided** boundary tests never use `SP`
776
- specifically. They do not: §3.1 states this and every guard above is written against
882
+ `NNBSP → NBSP`, `NBSP → NNBSP` stays inside `SPACELIKE` (§3.1). Every insertion (N1, N2, N5
883
+ through `spacedUnits`, N8) adds a `NOBREAK`, which is in `SPACELIKE`. So every boundary test
884
+ that passed on run 1 passes on run 2, and every one that failed still fails — **provided**
885
+ boundary tests do not tell `SP` from `NOBREAK`. Every guard above is written against
777
886
  `SPACELIKE`, `ALNUM`, `UPPER`, `DIGIT`, `OPENISH`, `CLOSEISH`, `BREAK` or `NONE`, none of
778
- which gains or loses a member under a `SP`/`NOBREAK` conversion.
887
+ which gains or loses a member under a `SP`/`NOBREAK` conversion, with **two deliberate
888
+ exceptions**, each of which tests `SP` specifically: the choice between "convert" and "emit
889
+ nothing" in every sub-rule (an `NBSP` is already correct), and N5 step 5.4 (the space after a
890
+ closed unit must be U+0020). The first is the sub-rule's own post-state and is covered by the
891
+ table above. The second holds because no other sub-rule converts the space after a
892
+ `closedUnits` entry (U4) and N5 never edits it (the code point before it is the last code point
893
+ of a unit, and a separator needs a `DIGIT` before it and a unit after it), so a U+0020 read
894
+ there stays U+0020.
895
+ **N5's deletion is the one edit that removes a `SPACELIKE` member**, and it is argued in the
896
+ third length-changing case below.
779
897
  2. **Membership in `ALNUM`, `DIGIT`, `UPPER`, `LETTER`, `OPENISH`, `CLOSEISH`.** No sub-rule
780
898
  ever edits a code point in any of these classes; every edit replaces or inserts a space
781
899
  character. Unchanged.
@@ -787,7 +905,7 @@ Guards test three kinds of thing:
787
905
  very index they claimed on the first run. The _side conditions_ that read the adjacent space accept both `SP` and `NBSP`
788
906
  and distinguish them only to decide "convert" versus "emit nothing".
789
907
 
790
- Two specific insertion cases need checking because they change lengths:
908
+ Four specific cases need checking because they change lengths:
791
909
 
792
910
  - **N1/N2 insertion.** Run 1 turns `mot!` into `mot` `NNBSP` `!`. On run 2, `left` of the `!`
793
911
  is `NNBSP` → "already correct" → no edit. Note the insertion did **not** create a new
@@ -799,6 +917,34 @@ Two specific insertion cases need checking because they change lengths:
799
917
  positions hit the "already `target`" branch. Additionally the inserted `NNBSP` becomes the
800
918
  `left` neighbour of nothing punctuation-like, and the `right` neighbour of `«`, which is not
801
919
  a candidate for any other sub-rule.
920
+ - **N5 insertion (`spacedUnits`).** Run 1 turns `5km` into `5` `NBSP` `km`. On run 2 the match is
921
+ the same entry at the same index (longest match, right boundary and number start read only
922
+ `ALNUM`, `DIGIT` and `LETTER`, which the insertion does not change), `cp[a-1]` is `NBSP`, and
923
+ the table's action is "already correct" → no edit. The insertion creates no candidate for a
924
+ lower sub-rule: it sits between a `DIGIT` and a unit's first code point, which is not a mark
925
+ (U2, so not N1/N2), not a quotation glyph (U1, so not N8), and ends no short word,
926
+ abbreviation or symbol a sub-rule matches (U4); N7 needs a U+002E (C1) or a `LETTER` (C2)
927
+ before the space, not a `DIGIT`.
928
+ - **N5 deletion (`closedUnits`).** Run 1 turns `5 %` into `5%`. On run 2 the shape is touching,
929
+ and for a `closedUnits` entry the touching action is "already correct" → no edit; the match is
930
+ the same entry (the digit run and everything right of the gap are unchanged). A separator that
931
+ run 1 **declined** to delete must still be declined: the guards of step 5 read (5.1) the code
932
+ point before the number and its class, (5.2) the code point after the unit, (5.3) the first
933
+ code point beyond a run of `SPACELIKE` and U+2060 on each side, (5.4) U+0020 and a `DIGIT` after
934
+ the unit. The only edits of run 1 that can sit at those positions are conversions inside
935
+ `SPACELIKE` (a skipped run stays a skipped run), N8's insertion of a `NOBREAK` right of an
936
+ opening glyph (`OPENISH` and `SPACELIKE` are both accepted by 5.1, and 5.3 skips it), and N1/N2/
937
+ N8 insertions before a closing mark or glyph (5.2 and 5.3 accept a closing mark and a `NOBREAK`
938
+ alike); 5.4 is argued in class 1 above. No guard flips, so the same separator is declined again,
939
+ and the sub-rules after N5 see the same `SP` or `NOBREAK` they saw on run 1 and decide as
940
+ before. The same holds for an insertion that run 1
941
+ declined: 5.5 reads only `SPACE` ∪ `NOBREAK-SPACE`, a `MUL-LETTER` and a `DIGIT`, accepts a
942
+ space of either kind, and no run-1 edit changes a `MUL-LETTER` or a `DIGIT`. N5's deletion removes a `SPACELIKE` code point, so a test that read across the gap now
943
+ reads its neighbours: the digit on the left and the unit's first code point on the right, which
944
+ U2 and U3 make a non-space, non-letter, non-mark, non-dash code point. A sub-rule could anchor
945
+ at that separator only as N1/N2 (a mark at `cp[a]`, excluded by U2), as N3, N4, N6, N9 or N10 (a
946
+ match ending at the `DIGIT`, excluded by U4) or as N7 (excluded as above); N5's own test is
947
+ the one argued here.
802
948
 
803
949
  Finally, the **first-claim-wins** ordering of §3.2 is deterministic and depends only on the
804
950
  sub-rule index, not on the array contents, so the same sub-rule wins on both runs.
@@ -818,11 +964,13 @@ and a rule that oscillates:
818
964
  abbreviation is invisible to sub-rule ordering on run 2 and a lower-priority sub-rule
819
965
  (N3, say, on the word `z`) can claim the same index with a different verdict. Making the
820
966
  match space-lenient keeps N4 in control of its own indices forever.
821
- 3. **N5 and N6 had to be conversion-only.** The naive version inserts a space before a unit,
822
- turning `5km` into `5 km` — a content change, not a typographic one — and, worse, in a
823
- locale listing `%` it turns `50%` into `50 %`, which is wrong in English and right in
824
- French, i.e. it is a locale decision that `beforeUnits` alone cannot express. Restricting
825
- to conversion makes the rule safe and shifts the question to §7.2 where it belongs.
967
+ 3. **N5 and N6 had to be conversion-only, until a locale could say which form it wants.** The
968
+ naive version inserts a space before a unit, turning `5km` into `5 km` — a content change, not
969
+ a typographic one — and, worse, in a locale listing `%` it turns `50%` into `50 %`, which is
970
+ wrong in English and right in French. One list cannot express that, so N5 was restricted to
971
+ conversion. Spec 1.22.0 adds the two lists that can (`spacedUnits`, `closedUnits`), and N5
972
+ inserts or deletes only for an entry a locale has put there; `beforeUnits` and N6 stay
973
+ conversion-only.
826
974
  4. **The conflict policy had to be total and index-based.** "Whichever sub-rule runs first in
827
975
  the loop" is not a specification; it is a Go map iteration bug waiting to happen (§3.2).
828
976
 
@@ -836,19 +984,31 @@ the rule with the largest emission surface in the pipeline. It is also the rule
836
984
  defect family 2.
837
985
 
838
986
  **What this rule emits.** U+00A0 and U+202F only, either replacing a single space-like code
839
- point in place or **inserted** at one of three kinds of site: before a listed punctuation
840
- character (N1, N2), after an opening quote glyph, and before a closing quote glyph (N8). It
841
- never emits U+0020, never emits a letter, digit, dot, dash or quotation mark, and never deletes
842
- anything.
987
+ point in place or **inserted** at one of four kinds of site: before a listed punctuation
988
+ character (N1, N2), after an opening quote glyph, and before a closing quote glyph (N8), and
989
+ between a `DIGIT` and a `spacedUnits` entry (N5). It never emits U+0020, and never emits a letter,
990
+ digit, dot, dash or quotation mark. Its one removal is N5's deletion, for a `closedUnits` entry,
991
+ of the single separator (U+0020, U+00A0 or U+202F) between a `DIGIT` and the entry; nothing else
992
+ is ever deleted. Each obligation below therefore covers what is written (`E(nbsp)`) and, for the
993
+ deletion, what is no longer there. Every argument rests on the entry properties U1-U4 of §3.7.
843
994
 
844
995
  **Against `I₁` (`spaces`).** Discharged, and this is why the rule never emits U+0020: U+00A0
845
996
  and U+202F are `CONTENT` to `spaces`, which touches only U+0020. Converting a U+0020 to a
846
997
  no-break space can only _remove_ a potential `spaces` edit, never create one. An insertion adds
847
998
  a `CONTENT` code point, which cannot lengthen a U+0020 run or place a U+0020 in a stripping
848
- position.
999
+ position. N5's deletion removes a run of exactly one separator whose neighbours are a `DIGIT` and,
1000
+ by U2, a code point outside `SPACELIKE`; so no other U+0020 run is adjacent to it, none is
1001
+ lengthened, shortened or merged, and no U+0020 acquires a new left or right neighbour (S-a to S-d
1002
+ read only the immediate neighbours of a run). The one longer read, the emoticon guard's walk
1003
+ (`spaces.md` §3.6), steps only over `:` `;` `-` `^` and the mouth glyphs; the gap has a `DIGIT`
1004
+ on its left, which is in none of those sets, so a walk that stopped at the separator now stops at
1005
+ the digit.
849
1006
 
850
1007
  **Against `I₂` (`ellipsis`).** Discharged: no `DOTLIKE` code point is emitted, and insertions
851
- only push code points apart, never together.
1008
+ only push code points apart, never together. N5's deletion does close a gap, between a `DIGIT`
1009
+ and the unit's first code point, and the closure is harmless because neither side can be
1010
+ `DOTLIKE`: the left is a `DIGIT`, and the right is not U+002E or U+2026 (U2). No dot run is
1011
+ joined, and no dot run acquires a new neighbour that is part of another one.
852
1012
 
853
1013
  **Against `I₃` (`dashes`).** **This is the obligation the rule failed, twice**, and it is now
854
1014
  discharged structurally rather than by argument.
@@ -868,6 +1028,17 @@ of this rule can create a dash token, change one's spacing verdict, or revive on
868
1028
  declined. That is condition **CO-S** of `pipeline-idempotency.md` §5.1a, and it holds for every
869
1029
  input rather than for the witnesses anyone happened to test.
870
1030
 
1031
+ N5's deletion is the one operation of this rule that `E(nbsp)` does not describe, since it writes
1032
+ nothing. It cannot touch a dash token's own spacing: the deleted separator has a `DIGIT` on its
1033
+ left and a code point outside `DASH` ∪ `INERT-DASH` on its right (U2), so no dash run is adjacent
1034
+ to it. What a verdict can read across it is `ranges`' `after` and T1's first and second
1035
+ effective neighbour past a digit run, and the walk over a `CLOSED-SYMBOL`; those are covered, for
1036
+ a unit that begins with a `CLOSED-SYMBOL`, by guard G-R of §3.7 step 5 (the insertion and the
1037
+ deletion are both declined next to a dash), and, for every other unit, by the fact that those
1038
+ reads test for a dash, U+002E, U+002C or U+002F and the unit's first code point is none of them
1039
+ (U2). Under `"em-paired"` the separator is not a terminal and is not adjacent to one, so no
1040
+ segment boundary moves (`dashes.md` §3.4a). See `pipeline-idempotency.md` §3, `I₂ₐ`.
1041
+
871
1042
  The Russian direction — N1/N2 promoting the U+0020 before an em dash to U+00A0 — is covered by
872
1043
  the same statement: `dashes` declines the promoted token at its symmetry guard and emits
873
1044
  nothing, so the output `Москва⍽— столица` is stable.
@@ -882,11 +1053,24 @@ second place, which is how the two rules drifted apart in the first place.
882
1053
  listed hyphen form's boundary guards ask whether the neighbouring code point is in `WORDISH`.
883
1054
  An insertion beside such a form would change that neighbour from whatever it was to a no-break
884
1055
  space, which is not `WORDISH` — so the guard could go from _reject_ to _accept_ and a form
885
- could start matching that did not before. That would be an `I₄` violation. It is unreachable
886
- because every insertion site puts the new space next to a listed punctuation character or a
887
- quote glyph, never between two letters, and a form whose neighbour is punctuation or a quote
888
- glyph was already accepted. If a future sub-rule inserts between two letters, this obligation
889
- must be re-derived.
1056
+ could start matching that did not before. That would be an `I₄` violation. For N1, N2 and N8 it
1057
+ is unreachable because every insertion site puts the new space next to a listed punctuation
1058
+ character or a quote glyph, and a form whose neighbour is punctuation or a quote glyph was
1059
+ already accepted.
1060
+
1061
+ N5's insertion is the case that does not fit that argument: it puts a no-break space between a
1062
+ `DIGIT`, which is in `WORDISH`, and the first code point of a unit, which is usually a letter
1063
+ (`5km`). A form that begins at that letter (a prefix or a compound; a suffix begins with a hyphen,
1064
+ which U2 forbids as a unit's first code point; a form consists of letters and hyphens) was rejected on its left neighbour and would be
1065
+ accepted after the insertion. It cannot be, because N5 inserts only if the unit is matched at the
1066
+ same index and `cp[a+k]` is not in `ALNUM`. The form is made of letters and hyphens,
1067
+ and the unit contains no hyphen (U2), so the unit either ends inside the form's first word
1068
+ (`cp[a+k]` is then `ALNUM`, step 2 fails), or ends exactly at the form's first hyphen (`cp[a+k]`
1069
+ is then U+002D, which step 5.2 declines), or extends past it, which would put a hyphen inside the
1070
+ unit. N5's deletion cannot reach a form either: the code point it exposes on the right is not a
1071
+ `LETTER` (U3) and a form begins with one. If a future sub-rule inserts between two letters, or a
1072
+ future unit may contain a hyphen or begin with a letter after deletion, this obligation must be
1073
+ re-derived.
890
1074
 
891
1075
  **Against `I₅`, `I₆`, `I₇` (`quotes`, `apostrophe`, `symbols`).** Discharged by case analysis
892
1076
  over the neighbour tests; the `quotes` half is the one that matters and is written out in
@@ -908,8 +1092,24 @@ so the `»` that case 2a reads stays immediately left of the mark and the verdic
908
1092
  before and after. Pinned as a conformance fixture rather than left as prose. If a future
909
1093
  sub-rule inserts between a closing delimiter and a following mark, this paragraph must be
910
1094
  re-derived.
1095
+
1096
+ N5's insertion and deletion are no new case for `quotes` or `apostrophe`: neither side of the gap
1097
+ is a quote mark or an apostrophe candidate (a `DIGIT`; and by U1 and U2 not a quotation glyph, not
1098
+ U+0022 and not U+0027), and every read those rules make starts at such a mark and crosses
1099
+ `INLINE-SPACE` outward from it, so none reaches the gap (`quotes.md` §5.6, Lemma B item 4).
911
1100
  `symbols` reads `ALNUM`, `DIGIT` and symmetric spacing; a no-break space is already accepted as
912
1101
  spacing there (`symbols.md` §3.3 step 1), and converting U+0020 to U+00A0 leaves `lsp`/`rsp` unchanged.
1102
+ The chain scan of `symbols.md` §3.3 is the one place N5 can matter, and it matters in one
1103
+ direction for each edit. A chain is `DIGIT+ (X DIGIT+)+`, declined by guard M3 when a `LETTER`
1104
+ follows its last digit run. Insertion can lift that verdict: `2 x 3kg` is declined (`k` follows), and
1105
+ `2 x 3⍽kg` would be converted on the next pass (a no-break space follows); this is the reason for
1106
+ guard 5.5 of §3.7, which declines the insertion whenever the number is the right operand of a link
1107
+ shape, symmetric or not (declining an insertion costs only a miss, so the guard does not repeat
1108
+ M1). No other chain shape is affected: the inserted space follows the last digit run, so it never
1109
+ lies inside a link, and U2 keeps a `spacedUnits` entry from beginning a link of its own. Deletion
1110
+ cannot lift it: the code point that follows the digit run changes from a separator to the unit's
1111
+ first code point, and neither is a `LETTER` (U3), so M3's verdict, and with it every chain
1112
+ verdict, is the same on both runs.
913
1113
 
914
1114
  ---
915
1115
 
@@ -961,15 +1161,15 @@ about the engine **and** about a file in `spec/locales/`, and both halves have t
961
1161
  | 13h | `—␣в␣Москве` | `—␣в⍽Москве` | `SENTENCE-DASH` still opens a phrase, so a genuine preposition after an em dash binds normally |
962
1162
  | 13i | `в␣<em>Москве</em>` (`html`) | ⟶ | **spec 1.2.0.** N3's following-token guard asks for `ALNUM` or `OPENISH`, and for this rule the span boundary marker is in neither (§3.1). The space stays U+0020. Whether it should bind is §7 item 12 |
963
1163
 
964
- ### `de-DE` — `abbreviations: ["z. B.","d. h."]`, `beforeUnits: ["%","km","°C"]`
1164
+ ### `de-DE` — `abbreviations: ["z. B.","d. h."]`, `spacedUnits: ["%","km","°C"]` (among others)
965
1165
 
966
1166
  | # | Input | Output | Why |
967
1167
  | --- | ----------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
968
1168
  | 14 | `z.␣B.␣Berlin` | `z.⍽B.␣Berlin` | N4 binds the space inside the abbreviation. The space after `B.` is **not** bound: guard C1-a sees that the `B.` is preceded by the lower-case `z.` and declines. Previously produced `z.⍽B.⍽Berlin`, a false positive on ordinary prose |
969
1169
  | 15 | `z.⍽B. Berlin` | ⟶ | N4 space-lenient match, already correct |
970
1170
  | 16 | `Es sind 20␣km bis 5␣%` | `Es sind 20⍽km bis 5⍽%` | N5 twice |
971
- | 17 | `Es sind 20km` | ⟶ | N5 never inserts (§7.2) |
972
- | 18 | `H2␣O ist kein Wert` | ⟶ | N5 step 4: `2` is preceded by the letter `H` |
1171
+ | 17 | `Es sind 20km` | `Es sind 20⍽km` | N5 inserts for `spacedUnits` (de-DE lists `km` there) |
1172
+ | 18 | `H2␣O ist kein Wert` | ⟶ | N5 step 3: `2` is preceded by the letter `H` |
973
1173
  | 19 | `siehe Nr.␣5 und S.␣12` | `siehe Nr.⍽5 und S.⍽12` | N9 twice |
974
1174
  | 20 | `siehe nr.␣5` | ⟶ | N9 matches exactly; `nr.` is not `Nr.` |
975
1175
  | 21 | `Bonjour&#160;:␣oui` (`fr`) | ⟶ | **spec 1.3.0.** N2's character-reference guard: the `;` closes `&#160;`, so no U+202F is inserted and the reference survives. Before 1.3.0 this produced `Bonjour&#160·:␣oui` |
@@ -997,28 +1197,27 @@ Every row `fr`, and every row measured. `⍽` = U+00A0, `⍹` = U+202F.
997
1197
  | 24 | `«⍽?` | ⟶ | the fixed point of case 23 |
998
1198
  | 25 | `mot␣?` | `mot⍹?` | the ordinary case: the code point before the space is a letter, so N2 applies normally |
999
1199
 
1000
- ### `el` — every list empty, `initialBinding: "none"`, `quotes.innerSpace: "none"`
1001
-
1002
- The first locale for which this rule is a **total no-op**, in the same provable sense `hyphen` is
1003
- a no-op for a locale with empty lists. It is worth a block of its own because the claim needs
1004
- _both_ halves of `order.json`'s `"localeData": ["nbsp", "quotes"]` to hold, and only one of them
1005
- is visible in the `nbsp` object: the eight lists being empty disables N1–N7 and N9–N10, and
1006
- **`quotes.innerSpace: "none"` is what additionally disables N8**. A locale with empty lists but a
1007
- non-`none` `innerSpace` would still edit — `fr` case 23 is exactly that shape — so "all lists
1008
- empty" alone does not license the claim.
1200
+ ### `el` — `closedUnits: ["%","°C"]`, `initialBinding: "none"`, `quotes.innerSpace: "none"`
1009
1201
 
1010
- Greek is also the case that shows why N1/N2 being empty is a positive finding rather than an
1011
- unfilled field. The Greek source denies the French space-before-punctuation pattern **by name**
1012
- («πράγμα που συμβαίνει, π.χ., στα γαλλικά»), so `spaces` strips the space at order 10 and nothing
1013
- here puts one back. That is a cited decision, not a default.
1202
+ Greek is the locale where this rule does almost nothing, and the one that shows why an empty list
1203
+ is a positive finding rather than an unfilled field. The Greek source denies the French
1204
+ space-before-punctuation pattern **by name** («πράγμα που συμβαίνει, π.χ., στα γαλλικά»), so
1205
+ `spaces` strips the space at order 10 and nothing here puts one back. That is a cited decision,
1206
+ not a default. The only list that is not empty is `closedUnits`: the inter-institutional guide
1207
+ permits both forms for a percentage and a temperature, the sources examined set them tight
1208
+ (`kathimerini.gr`, `tovima.gr` and eleven other sites: 140 of 140 `%` and 41 of 41 `°C` closed),
1209
+ and a locale that is offered both chooses the closed one (§3.7). N8 stays disabled by
1210
+ `quotes.innerSpace: "none"`; a locale with empty lists but a non-`none` `innerSpace` would still
1211
+ edit — `fr` case 23 is exactly that shape.
1014
1212
 
1015
1213
  | # | Input | Output | Why |
1016
1214
  | --- | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
1017
1215
  | 26 | `Τι κάνεις;` | ⟶ | `beforePunctuation` and `narrowBeforePunctuation` are empty, so N1/N2 have no member to match. Contrast `fr` case 25, where the same shape gains U+202F |
1018
- | 27 | `10,5␣%␣φέτος` | ⟶ | `beforeUnits` is empty, so N5 is inert and the ordinary space survives as U+0020 |
1216
+ | 27 | `10,5␣%␣φέτος` | `10,5%␣φέτος` | `%` is in `closedUnits`: N5 deletes the space between the number and the sign. The space after the sign is not N5's and stays |
1217
+ | 27a | `10,5%␣φέτος` | ⟶ | already closed |
1019
1218
  | 28 | `«καλημέρα»` | ⟶ | `innerSpace: "none"`, so N8 inserts nothing. This is the half of the no-op claim that lives in the `quotes` object rather than the `nbsp` one |
1020
1219
 
1021
- Cases 2, 6b, 8, 13, 13c, 13d, 13e, 13i, 15, 17, 18, 20, 22, 24, 26, 27 and 28 are "no change"
1220
+ Cases 2, 6b, 8, 13, 13c, 13d, 13e, 13i, 15, 18, 20, 22, 24, 26, 27a and 28 are "no change"
1022
1221
  cases. (Case 4 left that list in spec 1.3.0, when the row was corrected from a fixed point to a
1023
1222
  conversion; the §3.1a rows are numbered 31-34 and are outside it.)
1024
1223
 
@@ -1030,12 +1229,10 @@ conversion; the §3.1a rows are numbered 31-34 and are outside it.)
1030
1229
  disjoint**, nor that a character appears in only one of `beforeUnits` / `afterSymbols`.
1031
1230
  §2 requires an implementation to fail loudly; a `$defs`-level constraint or a CI check
1032
1231
  would be better. Reported.
1033
- 2. **N5/N6 never insert a space.** `5km` stays `5km` and `50%` stays `50%`. For German,
1034
- Duden requires a space before `%` and before a unit, so `50%` is arguably _wrong_ input
1035
- that polytypo declines to fix. Inserting is a content change and the schema has no flag to
1036
- authorise it per locale (something like `"insertBeforeUnits": true`). Needs an operator
1037
- decision; I chose the conservative branch because of the zero-false-positive ship
1038
- criterion.
1232
+ 2. **N6 never inserts a space** (`§ 7` is bound, `§7` is not). N5 inserts and deletes since spec
1233
+ 1.22.0, per list (§3.7). Open: the units whose only support is BIPM or a paywalled standard
1234
+ (`it`, `es`, `ro`, `uk`, `pt-BR` `%`) sit in `beforeUnits`; moving one to `spacedUnits` or
1235
+ `closedUnits` needs a national source.
1039
1236
  3. **`afterShortWords` matching is "case-insensitive only for the first character"** per the
1040
1237
  schema description, which I have implemented as the Unicode **simple** uppercase mapping.
1041
1238
  That is a data table, not a locale operation, so it satisfies §4.4. **The spec pins a Unicode version —
@@ -1,5 +1,5 @@
1
1
  {
2
- "spec": "1.21.0",
2
+ "spec": "1.23.0",
3
3
  "$comment": "Single source of truth for pipeline order. Rules run in ascending `order`. Disabling a rule removes it from the sequence and never reorders the rest. Rule ids are public API (see docs/ARCHITECTURE.md section 5). \"spec\" here must track spec/VERSION exactly — it is not itself the global version source; scripts/validate-spec.mjs enforces the match.",
4
4
  "rules": [
5
5
  {