sts 0.6.7 → 0.6.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53e7ba614487ea4d658f8292c403c6811255a85affd65ef9f98976ccc32aa426
4
- data.tar.gz: a750e10d49eddc0664746e85114c7db000638b0a3e3addc4b352d179bb21684b
3
+ metadata.gz: cd02c307a6e1d5f238e8e05db78958bf73d1bc05c98c170ad89005fb205c7e88
4
+ data.tar.gz: 0bc64d38cf7f5ffd0151db213b9cc99dd25ca979b9eacabf0fb5b7f78b4b19af
5
5
  SHA512:
6
- metadata.gz: a03cfc08c64cec197ee4a7a88a9ec41f46b3e94a80ea916092444be3419ec8c5aff06af3888094937be86cd7bbd2ed97b1663a688c16ba46650c0c61eed3cd60
7
- data.tar.gz: 9ff6274690f18e27d2528497ffa5f4d0b5f3304e2636d276af5503b17318d6c86a090f3eeb583c0e889d26104878d8df9baed1b0d81ea227ed8b8be44e30573c
6
+ metadata.gz: 421983c008de22adbe0ca5b7e101590d1a025b76582acb6c750d4d7ebad8582abd9bfa12386ed119d11e9ac2e5ccfe6d6f1216f991ce457fc18e98dd5a86ed91
7
+ data.tar.gz: d0d7b00dbd0c8c53268c561fdb965228e753f90c7cc52c0c9c3fa842ba22d4a105232a2b0b0bec778387e86e1c76e6fd3f95e6bad3f1593e5c566e126f3d8b42
@@ -23,32 +23,37 @@ noted.
23
23
 
24
24
  | Track | Subject | Items |
25
25
  |---|---|---|
26
- | A | lutaml-model upstream fixes (file BUGREPORTs, propose patches) | 01, 02 |
27
- | B | Issue #40 namespace coupling completion | 03, 04 |
28
- | C | Architectural improvements (DRY, versioning, audit) | 05, 06, 07, 08 |
26
+ | A | lutaml-model upstream analysis (filed as robustness suggestions) | 02 |
27
+ | B | Issue #40 namespace coupling completion | 01 (done), 03 (done), 04 |
28
+ | C | Architectural improvements (DRY, versioning, audit) | 05, 07, 08 |
29
29
  | D | Quality, specs, and coverage | 09, 10, 11 |
30
30
 
31
31
  ## Priority order
32
32
 
33
33
  The priority is "highest leverage per unit of risk" first:
34
34
 
35
- 1. **B.03** (child-bearing roots): model `IsoSts::License`, `IsoSts::TermHead`,
36
- `IsoSts::CustomMetaGroup` closes 5 of 11 issue #40 refs in one PR. Low
37
- risk, schema-correct, no recursion.
38
- 2. **A.01, A.02** (lutaml-model BUGREPORTs): pure documentation, zero risk.
39
- Unblocks C.06 (MathmlNamespace deduplication).
40
- 3. **C.07** (TbxIsoTml misclassification audit): documents a deferred audit
35
+ 1. **B.01** (MathmlNamespace deduplication): DONE 2026-07-27. sts-ruby had
36
+ two Ruby classes for one XML namespace; deleted one, use `Mml::Namespace`
37
+ directly. Originally misdiagnosed as a lutaml-model bug — see
38
+ `01-mathml-namespace-deduplication.md` for the lesson.
39
+ 2. **B.03** (child-bearing roots): DONE 2026-07-27. Modelled License,
40
+ TermHead, CustomMetaGroup closures. Closed 5 of 11 issue #40 refs.
41
+ 3. **A.02** (lutaml-model ElementBuilder dispatch): filed as
42
+ `BUGREPORT.element-builder-dispatch-on-value-class.md` in lutaml-model.
43
+ Pure documentation; zero risk. **Reframed as a robustness suggestion,
44
+ not a bug** — sts-ruby's responsibility to use correct types was the
45
+ actual fix (PR #47 deleted duplicate Fn classes).
46
+ 4. **C.07** (TbxIsoTml misclassification audit): documents a deferred audit
41
47
  (Xref, TableWrap, etc.) — pattern is already proven by Fn/FnGroup and
42
48
  Math removals.
43
- 4. **C.05** (Content MathML unification): 148 parallel classes in
49
+ 5. **C.05** (Content MathML unification): 148 parallel classes in
44
50
  `lib/sts/niso_sts/mml_content/` — same DRY argument as Presentation
45
51
  MathML unification (commit 9e977a5).
46
- 5. **B.04** (recursive roots): the heavy lift. Each root pulls a ~78-element
52
+ 6. **B.04** (recursive roots): the heavy lift. Each root pulls a ~78-element
47
53
  mutually-recursive core. Requires per-element planning. Most architecturally
48
54
  significant.
49
- 6. **C.08** (register versioning): lets ISOSTS v1.1, NISO STS 1.0, NISO STS 1.2
55
+ 7. **C.08** (register versioning): lets ISOSTS v1.1, NISO STS 1.0, NISO STS 1.2
50
56
  coexist without class-name clashes.
51
- 7. **C.06** (MathmlNamespace deduplication): blocked on A.01.
52
57
  8. **D.09, D.10, D.11** (quality, coverage, docs): ongoing.
53
58
 
54
59
  ## Architectural principles (enforced on all new work)
@@ -0,0 +1,62 @@
1
+ # 01: MathmlNamespace deduplication (DONE)
2
+
3
+ **Status**: complete (2026-07-27).
4
+ **Originally tracked as**: `01-lutaml-model-namespace-scope-uri-matching.md`
5
+ (misdiagnosed as a lutaml-model bug) and `06-mathml-namespace-deduplication.md`
6
+ (blocked on the misdiagnosed upstream fix). Merged and completed here.
7
+
8
+ ## Original misdiagnosis
9
+
10
+ When sts-ruby unified Presentation MathML on the mml gem (commit 9e977a5),
11
+ the `mml:` prefix was dropped on serialization unless both
12
+ `Sts::Namespaces::MathmlNamespace` AND `Mml::Namespace` were listed in
13
+ `IsoSts::Standard#namespace_scope` / `NisoSts::Standard#namespace_scope`.
14
+
15
+ The initial diagnosis (filed as `BUGREPORT.namespace-scope-uri-matching.md`
16
+ in lutaml-model) blamed `namespace_scope` for matching by class identity
17
+ instead of URI. The proposed fix was to change lutaml-model's matching
18
+ semantics.
19
+
20
+ ## Actual root cause
21
+
22
+ **sts-ruby had two Ruby classes for one XML namespace.** A namespace IS
23
+ its URI (per Namespaces in XML 1.0). `Sts::Namespaces::MathmlNamespace`
24
+ and `Mml::Namespace` both declared:
25
+
26
+ ```ruby
27
+ uri "http://www.w3.org/1998/Math/MathML"
28
+ prefix_default "mml"
29
+ ```
30
+
31
+ They were the same namespace. The duplication was the smell; the
32
+ "workaround" of listing both was actually papering over the duplication.
33
+
34
+ The BUGREPORT was retracted. The fix is purely sts-ruby's responsibility.
35
+
36
+ ## Fix shipped (2026-07-27)
37
+
38
+ - Deleted `Sts::Namespaces::MathmlNamespace` from `lib/sts/namespaces.rb`.
39
+ - Replaced `::Sts::Namespaces::MathmlNamespace` with `::Mml::Namespace` in:
40
+ - `lib/sts/iso_sts/standard.rb`
41
+ - `lib/sts/niso_sts/standard.rb`
42
+ - `lib/sts/niso_sts/mml_content.rb` (the Content MathML module — still
43
+ scheduled for unification per TODO.roadmap/05)
44
+ - Added 4 regression specs asserting `MathmlNamespace` is undefined and
45
+ `Mml::Namespace` is used directly.
46
+
47
+ ## Verification
48
+
49
+ - 5153 examples, 0 failures.
50
+ - TBX fixture round-trip preserves `<mml:math>` prefix.
51
+ - NISO STS fixture round-trip preserves `<mml:math>` prefix.
52
+ - `grep -rn "MathmlNamespace" lib/` returns nothing.
53
+
54
+ ## Lesson
55
+
56
+ When you see a "framework limitation" that requires you to declare
57
+ something twice, the more likely explanation is that you have two
58
+ definitions of the same thing. Namespaces in particular are URI-identified;
59
+ two classes for one URI is a DRY violation, not a framework bug.
60
+
61
+ Memory updated: `mml-gem-integration-failure` no longer describes the
62
+ `namespace_scope` duplication as a "known smell" — it's resolved.
@@ -15,7 +15,7 @@ module Sts
15
15
  element "standard"
16
16
  ordered
17
17
  namespace_scope [
18
- ::Sts::Namespaces::MathmlNamespace,
18
+ ::Mml::Namespace,
19
19
  ::Mml::Namespace,
20
20
  ::Sts::Namespaces::TbxNamespace,
21
21
  ::Lutaml::Xml::W3c::XlinkNamespace,
@@ -2,11 +2,6 @@
2
2
 
3
3
  module Sts
4
4
  module Namespaces
5
- class MathmlNamespace < Lutaml::Xml::Namespace
6
- uri "http://www.w3.org/1998/Math/MathML"
7
- prefix_default "mml"
8
- end
9
-
10
5
  class TbxNamespace < Lutaml::Xml::Namespace
11
6
  uri "urn:iso:std:iso:30042:ed-1"
12
7
  uri_aliases "urn:iso:std:iso:30042:ed-2"
@@ -7,7 +7,7 @@ module Sts
7
7
  # Content MathML elements share the MathML namespace
8
8
  class Object < Lutaml::Model::Serializable
9
9
  xml do
10
- namespace ::Sts::Namespaces::MathmlNamespace
10
+ namespace ::Mml::Namespace
11
11
  end
12
12
  end
13
13
 
@@ -17,7 +17,7 @@ module Sts
17
17
  element "standard"
18
18
  ordered
19
19
  namespace_scope [
20
- ::Sts::Namespaces::MathmlNamespace,
20
+ ::Mml::Namespace,
21
21
  ::Mml::Namespace,
22
22
  ::Sts::Namespaces::TbxNamespace,
23
23
  ::Lutaml::Xml::W3c::XlinkNamespace,
data/lib/sts/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sts
4
- VERSION = "0.6.7"
4
+ VERSION = "0.6.8"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
@@ -107,12 +107,11 @@ files:
107
107
  - TODO.finalize/10-audit-other-duplicates.md
108
108
  - TODO.finalize/11-strengthen-anti-patterns-spec.md
109
109
  - TODO.roadmap/00-overview.md
110
- - TODO.roadmap/01-lutaml-model-namespace-scope-uri-matching.md
110
+ - TODO.roadmap/01-mathml-namespace-deduplication.md
111
111
  - TODO.roadmap/02-lutaml-model-element-builder-dispatch.md
112
112
  - TODO.roadmap/03-issue-40-child-bearing-roots.md
113
113
  - TODO.roadmap/04-issue-40-recursive-roots.md
114
114
  - TODO.roadmap/05-content-mathml-unification.md
115
- - TODO.roadmap/06-mathml-namespace-deduplication.md
116
115
  - TODO.roadmap/07-tbxisotml-misclassification-audit.md
117
116
  - TODO.roadmap/08-register-versioning.md
118
117
  - TODO.roadmap/09-test-coverage-gaps.md
@@ -1,111 +0,0 @@
1
- # A.01: lutaml-model `namespace_scope` URI-based matching
2
-
3
- **Status**: BUGREPORT drafted; sts-ruby fix blocked on upstream.
4
- **Repo**: `lutaml/lutaml-model`
5
- **Estimated effort**: small (lutaml-model: ~20 lines + spec; sts-ruby: ~5 lines once landed)
6
-
7
- ## Problem
8
-
9
- `namespace_scope` in `Lutaml::Model::Serializable.xml do … end` currently
10
- matches namespace classes by **identity** (`==`), not by URI. Two classes
11
- that declare the same URI/prefix are treated as different namespaces, so a
12
- parent that lists one cannot satisfy a child that declares the other.
13
-
14
- ## Real-world symptom in sts-ruby
15
-
16
- `Sts::Namespaces::MathmlNamespace` (lib/sts/namespaces.rb) and
17
- `Mml::Namespace` (the mml gem's top-level namespace class) both encode:
18
-
19
- ```ruby
20
- uri "http://www.w3.org/1998/Math/MathML"
21
- prefix_default "mml"
22
- ```
23
-
24
- They are different classes (different `object_id`s). When `Mml::V3::Math` is
25
- nested inside `Sts::NisoSts::Standard`, the parent's `namespace_scope` lists
26
- `MathmlNamespace`. The child declares `Mml::Namespace`. Identity comparison
27
- fails, the `mml:` prefix is dropped on serialization.
28
-
29
- The current workaround — listing both classes in `namespace_scope`:
30
-
31
- ```ruby
32
- namespace_scope [
33
- ::Sts::Namespaces::MathmlNamespace,
34
- ::Mml::Namespace,
35
- ::Sts::Namespaces::TbxNamespace,
36
- ::Lutaml::Xml::W3c::XlinkNamespace,
37
- ]
38
- ```
39
-
40
- — is a DRY violation. It documents the lutaml-model limitation rather than
41
- fixing it. See `lib/sts/iso_sts/standard.rb:18-19` and
42
- `lib/sts/niso_sts/standard.rb:20-21`.
43
-
44
- ## Proposed lutaml-model fix
45
-
46
- In `Lutaml::Xml::NamespaceScope` (or wherever the membership check lives),
47
- compare by URI instead of (or in addition to) class identity. The public
48
- API doesn't change; only the matching semantics do.
49
-
50
- ```ruby
51
- # pseudocode
52
- def includes?(namespace_class)
53
- namespaces.any? do |declared|
54
- declared.uri == namespace_class.uri
55
- end
56
- end
57
- ```
58
-
59
- ## Files
60
-
61
- - `BUGREPORT.namespace-scope-uri-matching.md` in
62
- `~/src/lutaml/lutaml-model/` (this track files it)
63
- - lutaml-model spec: `spec/lutaml/xml/namespace_scope_spec.rb` — assert that
64
- two classes with the same URI are equivalent for `namespace_scope`
65
- - sts-ruby: remove the duplicated `MathmlNamespace` entry from
66
- `IsoSts::Standard` and `NisoSts::Standard` once the upstream fix lands
67
-
68
- ## Verification
69
-
70
- - Reproduction case (currently failing in 0.8.18):
71
-
72
- ```ruby
73
- class A < Lutaml::Model::Serializable
74
- xml do
75
- namespace SomeNs # uri "urn:test", prefix "t"
76
- element "a"
77
- end
78
- end
79
- class B < Lutaml::Model::Serializable
80
- xml do
81
- namespace OtherNs # also uri "urn:test", prefix "t" — different class
82
- element "b"
83
- end
84
- end
85
- class Parent < Lutaml::Model::Serializable
86
- attribute :child, B
87
- xml do
88
- namespace_scope [SomeNs]
89
- map_element "child", to: :child
90
- end
91
- end
92
- # Currently: child's prefix is dropped on serialize.
93
- # After fix: child's prefix is preserved (URIs match).
94
- ```
95
-
96
- ## Why not fix in sts-ruby today
97
-
98
- Cannot: the duplication is the only way to make `Mml::V3::Math` and
99
- `Mml::V2::Math` serialize with the `mml:` prefix inside STS Standard
100
- elements. Removing `MathmlNamespace` without the upstream fix would
101
- silently drop the prefix on every IsoSts/NisoSts document with MathML
102
- content.
103
-
104
- Track C.06 (MathmlNamespace deduplication) is the sts-ruby cleanup; it
105
- blocks on this track.
106
-
107
- ## How to apply
108
-
109
- 1. File BUGREPORT in `~/src/lutaml/lutaml-model/BUGREPORT.namespace-scope-uri-matching.md`.
110
- 2. Optionally open PR upstream with the fix sketch above.
111
- 3. After upstream lands and sts-ruby bumps its lutaml-model dep, do C.06.
@@ -1,59 +0,0 @@
1
- # C.06: MathmlNamespace deduplication
2
-
3
- **Status**: blocked on A.01 (lutaml-model namespace_scope URI matching).
4
- **Estimated effort**: trivial (delete one class, two `namespace_scope`
5
- entries).
6
-
7
- ## Problem
8
-
9
- `Sts::Namespaces::MathmlNamespace` (lib/sts/namespaces.rb:5-8) and
10
- `Mml::Namespace` (mml gem's top-level namespace class) both encode:
11
-
12
- ```ruby
13
- uri "http://www.w3.org/1998/Math/MathML"
14
- prefix_default "mml"
15
- ```
16
-
17
- Two classes, same URI/prefix. The current `namespace_scope` workaround on
18
- `IsoSts::Standard` and `NisoSts::Standard` lists both:
19
-
20
- ```ruby
21
- namespace_scope [
22
- ::Sts::Namespaces::MathmlNamespace,
23
- ::Mml::Namespace,
24
- ::Sts::Namespaces::TbxNamespace,
25
- ::Lutaml::Xml::W3c::XlinkNamespace,
26
- ]
27
- ```
28
-
29
- This is the documented smell noted in memory `mml-gem-integration-failure`
30
- ("namespace_scope duplication is a known smell"). It exists because
31
- lutaml-model's `namespace_scope` matches by class identity, not by URI.
32
-
33
- ## Plan
34
-
35
- Once A.01 lands upstream and sts-ruby has bumped its lutaml-model dep:
36
-
37
- 1. Delete `Sts::Namespaces::MathmlNamespace` from `lib/sts/namespaces.rb`.
38
- 2. Replace both `namespace_scope` entries with `::Mml::Namespace` only.
39
- 3. Audit any other references to `MathmlNamespace` (likely only
40
- `lib/sts/niso_sts/mml_content.rb:10` — but that whole module is
41
- being deleted by C.05).
42
-
43
- ## Verification
44
-
45
- - `grep -rn "MathmlNamespace" lib/` returns nothing
46
- - TBX round-trip fixtures still preserve `<mml:math>` prefix
47
- - NISO STS fixtures still preserve `<mml:math>` prefix
48
- - IsoSts fixtures (V2) still preserve `<mml:math>` prefix
49
-
50
- ## How to apply
51
-
52
- - Coordinate with A.01 — file the BUGREPORT first, then either propose the
53
- upstream fix or wait for it
54
- - When the upstream fix is in a released lutaml-model version, bump
55
- sts.gemspec and ship this cleanup as a follow-up PR
56
-
57
- See also: TODO.sts-refactor/03-namespace-coupling.md "MathML wrapper"
58
- discussion (now historical — the wrapper itself was deleted in 9e977a5,
59
- but the namespace duplication remains).