]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - docs/slice-6-validation.md
Canonicalize DateTime timezone offsets with explicit baseline discrepancies
[topic-maps.git] / docs / slice-6-validation.md
1 # Slice 6 — Validation and acceptance evidence
2
3 Base commit: `437ad53ea7539d36db3fa871d0931650b7a6a03e`.
4 Observed initial branch: `codex/ctm-slice-5`; HEAD matched the base and
5 `git status --short --branch` contained no changed/untracked files. Created
6 `codex/ctm-slice-6` at that commit. The corpus remains pinned at
7 `cd165b150176c1d6842b37be9cc9051b40d4996b`; all corpus/reference bytes are unchanged.
8
9 ## Scope and normative basis
10
11 [CTM](https://www.isotopicmaps.org/ctm/ctm.html) §§3.2, 3.3.3–3.3.5, 3.4.1–3.4.2,
12 3.10, 3.16.1; [TMDM](https://www.isotopicmaps.org/sam/sam-model/2006-06-18/)
13 §§4.3–4.4, 5.6, 6.5; [CXTM](https://www.isotopicmaps.org/cxtm/cxtm.html)
14 §§3.8, 3.14, 3.16, 3.18–3.20, 4.2–4.5, 4.9.
15 The detailed interpretation, original source texts, expected/actual objects,
16 public API and an executed DESCRIBE example appear in
17 `reading-prefixes-and-datatypes.md`. The published standards were consulted
18 before implementation; no conflict with the selected draft-era cases was found.
19 This remains a bounded implementation, not a claim of complete ISO conformance.
20
21 The parser owns its prefix environment; bindings are processed in source order,
22 with exact locator comparison on rebinding. QName identity and literal locator
23 contexts share resolution but only identity contexts intern Topics. Quoted
24 Occurrence qualifiers retain the escape-decoded string and resolved datatype
25 locator. No datatype Topic is synthesized. The ordinary TMDM model is retained.
26
27 CXTM now permits arbitrary datatype locators under §3.16's Other rule, retaining
28 existing escaping/NFC, datatype ordering and non-base-stripped datatype output.
29 The four special integer/decimal/date/dateTime canonicalizations remain explicit
30 CXTM-UNSUPPORTED cases. There are no filename-dependent serialization rules.
31 Canonicalization does not mutate maps or retained replacement-object handles.
32
33 ## Original contracts and local observations
34
35 Each source is deserialized from `vendor/cxtm` with the Slice 0 deterministic
36 Document IRI, also used as CXTM Base Locator. Binary output is compared directly
37 with the unchanged original binary baseline; neither side is preprocessed.
38
39 | Original file | Actual relevant properties | Contract/result |
40 | --- | --- | --- |
41 | `ctm/in/occurrence-explicit-datatype.ctm` | Two Topics (local topic/occtype); one Occurrence, Parent EQ topic, Type EQ occtype, Value `Occurrence`, Datatype `http://www.w3.org/2001/XMLSchema#string` | CXTM-EQUAL PASS; 359 bytes |
42 | `ctm/in/occurrence-datatype-unknown.ctm` | Two Topics (local topic/occtype); one Occurrence, Parent EQ topic, Type EQ occtype, Value `BOGUS`, Datatype `http://example.com/bogus` | CXTM-EQUAL PASS; 339 bytes |
43 | `ctm/in/prefix-duplicate.ctm` | One Topic, SI `http://psi.example.org/fake`, no II/SL | CXTM-EQUAL PASS; 141 bytes |
44 | `ctm/in/prefix-duplicate2.ctm` | Two Topics, SIs `http://psi.example.org/fake`, `http://psi.example.org/fake2`, no II/SL | CXTM-EQUAL PASS; 260 bytes |
45 | `ctm/in/prefix-multiline.ctm` | One Topic, SI `http://psi.example.org/fake`, no II/SL | CXTM-EQUAL PASS; 141 bytes |
46 | `ctm/invalid/prefix-collision.ctm` | PREFIX-COLLISION subclass of CTM-REJECTION, code :PREFIX-COLLISION, offset 43, line 2, column 9 | CTM-REJECTION PASS |
47 | `ctm/invalid/prefix-undefined2.ctm` | UNDEFINED-PREFIX subclass of CTM-REJECTION, code :UNDEFINED-PREFIX, offset 136, line 6, column 15 | CTM-REJECTION PASS |
48
49 All five positive maps have no Names/Associations; Occurrence identifier sets are
50 empty. The first two maps use only the absolute local Item Identifiers
51 `DocumentIRI#topic` and `DocumentIRI#occtype`, with no SI/SL. Datatypes are locator
52 strings, never extra Topics. Canonical Topics are type=1/owner=2 in the first
53 two cases and fake=1/fake2=2 in prefix-only cases. Relative baseline locators
54 follow the existing CXTM §3.18 base policy; datatype locators remain full IRIs.
55
56 | Imported status | PASS | FAIL | UNSUPPORTED | NOT-RUN |
57 | --- | ---: | ---: | ---: | ---: |
58 | All 273 cases | 36 | 0 | 0 | 237 |
59 | Positive CXTM contracts (231) | 33 | 0 | 0 | 198 |
60 | Negative CTM contracts (42) | 3 | 0 | 0 | 39 |
61
62 Only these seven new contracts changed status: all NOT-RUN → PASS. The old
63 `prefix-undefined.ctm` remains PASS. No unexecuted imported contract is inferred
64 to pass or to be unsupported from semantic tests. `reports/slice-6/cxtm.json`
65 contains all 33 executed IDs, full actual/expected XML and byte counts;
66 `reports/slice-6/actual/` contains their actual octets. All preceding 28 case
67 records and canonical outputs match Slice 5 exactly. The prior five identity,
68 11 merge, eight Association and four Occurrence object-observation records are
69 also unchanged; these separate semantic records do not assert CXTM equality.
70
71 ## Fresh-process, network-denied regression results
72
73 All entries below were executed again for this slice. Each SBCL process starts
74 without user/system initialization and without inherited ASDF registry settings.
75 `/usr/bin/sandbox-exec` denies network operations. The 2.4.10 run uses a copied
76 checkout under a new `/private/tmp/ctm-slice-6-validation-.../checkout` directory.
77
78 | Suite | SBCL 2.5.4 | SBCL 2.4.10, relocated |
79 | --- | ---: | ---: |
80 | Foundation | 54 PASS | 54 PASS |
81 | Retained identity | 123 PASS | 123 PASS |
82 | Retained merging | 646 PASS | 646 PASS |
83 | Retained Associations/Roles | 657 PASS | 657 PASS |
84 | Retained CXTM checks | 445 PASS | 445 PASS |
85 | Retained Occurrences | 1,101 PASS | 1,101 PASS |
86 | Prefix/explicit datatype checks | 150 PASS | 150 PASS |
87 | Total Lisp checks | 3,176 PASS / 0 FAIL | 3,176 PASS / 0 FAIL |
88 | Python integrity tests | 2 PASS | 2 PASS |
89 | Independent NFC oracle comparisons | 16,294 PASS | 16,294 PASS |
90 | Byte-exact original CXTM contracts | 33 PASS | 33 PASS |
91
92 The 150 new checks cover order/scope/rebinding, case/Unicode/numeric QName local
93 parts, all three Topic identity categories, Association/Role references, datatype
94 versus Type identity, arbitrary datatype lexical preservation, explicit/default
95 string equality, duplication, Parent/Type merge replacement, stored references,
96 construction-order independence, canonicalizer purity and specific errors/positions.
97 Ad hoc integer/decimal/date/dateTime canonicalization checks verify explicit
98 unsupported outcomes; these do not change imported corpus statuses.
99
100 Obsolete expectations were adapted one-for-one: the identity exclusion fixture
101 now checks `%include` rather than supported `%prefix`; the Occurrence explicit
102 xsd:string diagnostic becomes a successful datatype assertion; the API invalid
103 fixture now checks a relative datatype locator rather than forbidding integer
104 storage. Their suite totals remain 123 and 1,101. The original 445 canonical
105 check labels/results are retained unchanged.
106
107 All seven report pairs (main, semantics, merging, Associations, CXTM, Occurrences,
108 prefixes) are byte-identical between runtimes/locations. Independent Python
109 checks verify original CTM source bytes, actual object-reference ordinals,
110 datatypes/values, negative positions, UTF-8 baseline equality, XML canonical form
111 and reference integrity. The public inspection example was separately executed
112 under network denial and passed. There were no compiler warnings/test failures
113 in either final run. The inherited NFC compiler note is harmless unreachable-code
114 elimination, not a warning.
115
116 `reports/slice-6/execution.json` records exact commands, runtime paths, exit codes,
117 totals, qualification and SHA-256 of every evidence artifact. The two complete
118 raw test logs and `describe.log` are included. The final runs supersede development
119 runs used to correct fixture parentheses/offsets; no failed final run is hidden
120 or counted as passing.
121
122 ## Reproduction
123
124 From any working directory, using the installed runtimes on this host:
125
126 ```sh
127 python3 /Users/rgb/workspace/topic-maps/scripts/validate-slice-6.py \
128 --sbcl-254 /nix/store/hlsiblxpxr1hax3dw9x8znd6zy097ddj-sbcl-2.5.4/bin/sbcl \
129 --sbcl-2410 /nix/store/y96nx8571mpdvjd40krkdim2av0in972-sbcl-2.4.10/bin/sbcl \
130 --output /private/tmp/topic-maps-slice-6-reproduction
131 ```
132
133 The script checks runtime versions, runs both complete suites offline, relocates
134 the second checkout, compares all reports and retained observations, executes
135 the documented inspection and writes logs/evidence to the given output. It
136 provisions no software and does not commit or alter the corpus. Python needs
137 UCD 15.0/15.1 for the inherited oracle; observed Python was 3.13.2, UCD 15.1.0.
138 macOS `sandbox-exec` is required for this network-denial workflow.
139
140 For one fresh offline run, the exact test invocation shape is:
141
142 ```sh
143 /usr/bin/sandbox-exec -p '(version 1)(allow default)(deny network*)' \
144 /usr/bin/env PYTHONDONTWRITEBYTECODE=1 \
145 SBCL=/nix/store/hlsiblxpxr1hax3dw9x8znd6zy097ddj-sbcl-2.5.4/bin/sbcl \
146 TOPIC_MAPS_REPORT=/private/tmp/topic-maps-slice-6.json \
147 /Users/rgb/workspace/topic-maps/scripts/test.sh
148 ```
149
150 ## Changed implementation locations and limits
151
152 - `src/ctm/lexer.lisp:115`: QName local-part grammar; `:128`: prefix terminal.
153 - `src/ctm/reader.lisp:3`: parser-local environment; `:14`: QName resolution;
154 `:25`: directives/rebinding; `:109`: qualified values; `:245`: top-level dispatch.
155 - `src/ctm/conditions.lisp:19`, `src/ctm/package.lisp`: exported PREFIX-COLLISION.
156 - `src/tmdm/occurrences.lisp:55`: absolute datatype locators without whitelisting.
157 - `src/cxtm/canonicalizer.lisp:121`: datatype validation and explicit special-rule
158 exclusions; existing value/ordering/serialization paths implement Other.
159 - `tests/ctm-prefixes.lisp:10`, `:95`, `:149`, `:193`: original contracts, semantic,
160 datatype, and merge/order tests; `scripts/check-prefixes.py`: independent checker.
161 - `topic-maps.asd`, `scripts/fresh-sbcl.lisp`, `scripts/test.sh`, report checkers:
162 new test system and accurate 33-positive/3-negative reporting.
163 - `scripts/validate-slice-6.py`: reproducible dual-runtime/relocation evidence.
164
165 Remaining scope limits are not test failures: special numeric/date canonicalization,
166 nonempty Scope, Reification, Variants, Templates, include/mergemap/cross-document
167 merging, typed Names, triple-quoted strings and HyperDoc integration. Datatype
168 value spaces are not generally validated/interpreted. Model locator arguments
169 must be validated/resolved by the caller; the inherited scheme predicate is not
170 a complete RFC 3987 validator. Unicode bounds/ambiguous normalized Topic-key
171 rejection and the documented root-LF interpretation remain unchanged.
172 No selected case depends on an excluded feature. No server/deployment was used.
173
174 Acceptance recommendation: **PASS for Slice 6's selected subset**. Stop and
175 await review; Slice 7 is not started.