]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - docs/slice-5-validation.md
docs(ctm): preserve Template Tail grammar investigation and evidence
[topic-maps.git] / docs / slice-5-validation.md
1 # Slice 5 — Validation and acceptance evidence
2
3 Base commit: `8036a2b1ce009218f33d300edcc5f715ec1d1124`.
4 Branch: `codex/ctm-slice-5`. Initial branch was `codex/ctm-slice-4`, HEAD matched
5 that base, and the working tree was clean before branch creation.
6 The original corpus/locks remain unchanged at
7 `cd165b150176c1d6842b37be9cc9051b40d4996b` (CTM draft 2010-03-31).
8
9 ## Implemented and observed
10
11 Occurrences belong to the existing TMDM Topic, with Parent/Type Topic object
12 references, lexical Value, Datatype locator and Item Identifiers. Supported
13 Scope is empty and Reifier null. Equal Occurrences are replaced according to
14 TMDM 5.6/6.5, their identifiers unioned, and retained handles resolve through
15 `canonical-occurrence`. Topic merges update actual stored Parent/Type references.
16
17 The dedicated CTM reader uses string/IRI literal kinds. Quoted content is not
18 IRI-resolved; IRI-form literals are formed/resolved under CTM 3.3.3. Datatype
19 locators are not interned as Topics. Explicit datatype-qualified strings and
20 numeric/date literals remain unsupported. Malformed inputs and unbound prefixes
21 retain specific rejection classes and source diagnostics.
22
23 CXTM represents Occurrences using §§3.5, 3.8, 3.13–3.23, 4.2–4.6 and 4.9.
24 Datatype output is not base-stripped; anyURI value output is locator-normalized.
25 String values sort before locator values under 4.2. Per-Topic Occurrence numbering
26 is separate from Name numbering. Canonicalization does not normalize/merge the
27 input model or compress retained forwarding chains.
28
29 The source texts, normative clause map, expected and actual items, public API,
30 limits and executable inspection are printed in
31 `docs/reading-first-occurrences.md`. The initial expectation table and original
32 sources were recorded before implementation, rather than inferred from generated XML.
33
34 ## Actual end-to-end comparisons
35
36 Each source was read directly from the original corpus with its deterministic
37 absolute Document IRI; CXTM used that IRI as Base Locator. Actual binary output
38 was compared with the untouched upstream binary baseline. Neither side is trimmed,
39 reparsed, rewritten or normalized before this comparison.
40
41 | Selected original source | Result | UTF-8 bytes, actual = expected |
42 | --- | --- | ---: |
43 | `ctm/in/occurrence-string.ctm` | PASS | 359 |
44 | `ctm/in/occurrence-string2.ctm` | PASS | 359 |
45 | `ctm/in/occurrence-uri-relative.ctm` | PASS | 358 |
46 | `ctm/in/occurrence-two.ctm` | PASS | 730 |
47
48 `occurrence-string.ctm` and `occurrence-string2.ctm` each produce two Topics and
49 one string Occurrence with value `Occurrence`. The relative URI case produces
50 two Topics and one anyURI Occurrence whose stored value is the absolute logical
51 corpus locator ending `/ctm/in/file.html`; only CXTM renders `file.html`.
52 The two-occurrence case produces three Topics and two Occurrences: a multiline
53 xsd:string and the original absolute TMCL HTTP resource locator as xsd:anyURI.
54 All four maps contain no Names/Associations, and all Occurrence identifier sets
55 are empty. No datatype Topics are synthesized.
56
57 The combined canonical report retains the original 24 cases unchanged and adds
58 these four. Other cases are not inferred from newly available syntax.
59
60 | Imported contracts | PASS | FAIL | UNSUPPORTED | NOT-RUN |
61 | --- | ---: | ---: | ---: | ---: |
62 | 28 selected positive CXTM contracts | 28 | 0 | 0 | 0 |
63 | All 273 imported CTM contracts | 29 | 0 | 0 | 244 |
64
65 The additional PASS is the retained `prefix-undefined.ctm` negative contract,
66 verified as UNDEFINED-PREFIX, not a generic exception. Remaining 203 positive and
67 41 negative contracts were not executed.
68
69 ## Fresh offline validation
70
71 Both complete suites used network-denying `sandbox-exec`, fresh SBCL processes,
72 no system/user init, no inherited ASDF source registry, and FASLs outside the repo.
73 The second suite ran in a newly copied checkout without `.git`/Python cache files.
74
75 | Executed checks, per runtime | SBCL 2.5.4 PASS | SBCL 2.4.10 PASS | FAIL |
76 | --- | ---: | ---: | ---: |
77 | Retained foundation | 54 | 54 | 0 |
78 | Retained identity semantics | 123 | 123 | 0 |
79 | Retained merge semantics | 646 | 646 | 0 |
80 | Retained Association/Role semantics | 657 | 657 | 0 |
81 | Retained CXTM checks | 445 | 445 | 0 |
82 | New Occurrence checks | 1,101 | 1,101 | 0 |
83 | Independent NFC oracle | 16,294 | 16,294 | 0 |
84 | Python integrity fixtures | 2 | 2 | 0 |
85
86 The new tests include actual references/values/datatypes for four original
87 sources, 144 construction permutations, 128 graph/order variants with an
88 independent connectivity oracle, duplicate and late merge identifier unions,
89 raw canonical Parent/Type references, old handles, Unicode/escaping, explicit
90 error classes/codes/positions, foreign map rejection and mutation-free failure paths.
91 The retained 445 CXTM check labels are exactly unchanged.
92
93 All six JSON report pairs are byte-identical across runtime versions/relocation:
94 validation, semantics, merging, associations, CXTM and Occurrences. The previous
95 24 semantic case records and canonical outputs equal committed Slice 4 records.
96 Python independently verifies raw CXTM bytes against the original baselines,
97 XML reference integrity and the actual Occurrence object-property observations.
98 The last Lisp block from the reading document was executed as printed, with its
99 Parent/Type EQ assertions and DESCRIBE output, in another fresh offline process.
100
101 ## Reproduction and evidence
102
103 The exact two complete validation commands were:
104
105 ```sh
106 cd /Users/rgb/workspace/topic-maps
107 '/usr/bin/sandbox-exec' '-p' '(version 1)(allow default)(deny network*)' '/usr/bin/env' 'PYTHONDONTWRITEBYTECODE=1' 'SBCL=/nix/store/hlsiblxpxr1hax3dw9x8znd6zy097ddj-sbcl-2.5.4/bin/sbcl' 'TOPIC_MAPS_REPORT=/private/tmp/ctm-slice-5-validation-tln5nucc/validation-2.5.4.json' '/Users/rgb/workspace/topic-maps/scripts/test.sh'
108 ```
109
110 ```sh
111 cd /private/tmp/ctm-slice-5-validation-tln5nucc/checkout
112 '/usr/bin/sandbox-exec' '-p' '(version 1)(allow default)(deny network*)' '/usr/bin/env' 'PYTHONDONTWRITEBYTECODE=1' 'SBCL=/nix/store/y96nx8571mpdvjd40krkdim2av0in972-sbcl-2.4.10/bin/sbcl' 'TOPIC_MAPS_REPORT=/private/tmp/ctm-slice-5-validation-tln5nucc/validation-2.4.10.json' '/private/tmp/ctm-slice-5-validation-tln5nucc/checkout/scripts/test.sh'
113 ```
114
115 The temporary relocated checkout was created by copying the repository while
116 excluding `.git`, `__pycache__` and `*.pyc`. Substitute another copied checkout
117 for future relocation runs; the logical Document IRIs do not change. Python's
118 NFC oracle requires UCD 15.0/15.1; recorded runs used 15.1.0.
119
120 `reports/slice-5/execution.json` records exact arguments, directories, exit codes,
121 Python version, counts and SHA-256 hashes. `occurrences.json` contains original
122 CTM source and actual object properties/references. `cxtm.json` contains complete
123 actual/expected XML for all 28 cases; `actual/` preserves the generated UTF-8 files.
124 Logs preserve raw process output; `describe.log` contains actual inspection output.
125 The combined CXTM report's 1,546 checks are 445 retained plus 1,101 new; they are
126 not counted a second time in the totals above.
127
128 ## Limits and decision
129
130 No excluded feature was needed by the selected four cases. No normative/corpus
131 conflict was observed for them. The inherited explicit CXTM root-LF interpretation
132 is unchanged; this is bounded evidence, not full ISO conformity.
133 Nonempty Scope, Reification, Variants, arbitrary XSD numeric/date datatypes,
134 Templates, cross-document merging and HyperDoc integration are not implemented.
135 The existing prefix/triple-quote and URI grammar limits remain documented.
136 Explicit `^^` CTM datatype qualifiers are recognized but unsupported, including
137 string/anyURI qualifiers. The model API expects already validated absolute
138 locators; it is not a complete IRI grammar validator. Reification identity
139 conflicts are rejected rather than implemented implicitly. Unicode is bounded
140 to the existing 15.1.0 tables, with explicit unsupported results for newer characters.
141
142 **Acceptance evidence: PASS for the requested Slice 5 subset.** Implementation,
143 regressions, direct object observations and genuine baseline comparisons agree.
144 No server, deployment or HyperDoc change was made. Stop after this slice and
145 await review before extending CTM or TMDM.