]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - docs/slice-9-validation.md
Support CTM Wildcards and recursive Embedded Topics
[topic-maps.git] / docs / slice-9-validation.md
1 # Slice 9 — Date Occurrences: validation evidence
2
3 Repository `/Users/rgb/workspace/topic-maps`; initial branch `codex/ctm-slice-8`,
4 HEAD `195d5f5444d776096b765d04c815c23c3db5f84c`, clean index/tree. Created
5 `codex/ctm-slice-9` from that exact commit. The corpus remains pinned at
6 `cd165b150176c1d6842b37be9cc9051b40d4996b`; upstream inputs, baselines and
7 existing references are unchanged.
8
9 ## Normative interpretation
10
11 Rules were recorded before implementation in `reading-date-occurrences.md`:
12 published CTM §3.4.1 (XSDT validity), CTM §3.2 (BOM), TMDM §§4.3–4.4, 5.6,
13 6.5, CXTM §§3.16, 4.9, XSD Second Edition §§3.2.7.1, 3.2.9–3.2.9.2, 4.3.6,
14 D and E.1. The HTML mirror omits days 01–09 in production 35; the published
15 preview expressly requires XSDT-valid Dates. This slice admits those days in
16 accord with XSD and the selected tests, without claiming the mirror grammar
17 is correct or that the published Annex grammar was available in that preview.
18
19 Year zero, a leading plus, fewer than four year digits and extended years with
20 leading zeros are invalid. The calendar checks month lengths and Gregorian
21 4/100/400 divisibility with a bounded residue accumulator; no machine-sized
22 year, local timezone, platform calendar, floating point, or Lisp reader is used.
23 BCE leap validation applies E.1 directly to the signed lexical year. XSD 1.0's
24 BCE leap ambiguity is expressly qualified in the reading document, rather than
25 silently importing XSD 1.1 astronomical numbering or permitting year zero.
26
27 The existing Occurrence is the sole model: stored Value string, Datatype locator,
28 Parent Topic and Type Topic stay separate. Bare date literals use the existing
29 canonical-string policy; qualified strings/direct API values retain their
30 valid lexical strings. CXTM trims XML whitespace and renders the supported
31 canonical date without modifying values or handles. Equality/duplicate merging
32 remain lexical; matching canonical output does not imply TMDM equality.
33 Ordering compares stored strings, not chronology or formatted XML.
34
35 ## Original contracts
36
37 Five selected positive files match original CXTM bytes: occurrence-date (357),
38 occurrence-date2 (357), occurrence-date3 (1066), occurrence-date-negative (358),
39 occurrence-date-another-century (359). All are PASS. The two UTF-8 BOMs are read
40 through the existing byte decoder and remain unchanged in the source evidence.
41
42 Five selected negative files are PASS under their rejection contracts:
43 date-invalid-day → INVALID-DATE-DAY; date-invalid-month → INVALID-DATE-MONTH;
44 date-invalid-year, year2, year3 → INVALID-DATE-YEAR. Each is CTM-REJECTION with
45 source/character/line/column diagnostics; unsupported or I/O errors cannot pass.
46 Full sources, actual information items/references, diagnostic coordinates and
47 XML are in `reports/slice-9/dates.json` and `cxtm.json` and the reading document.
48
49 | Imported contracts | PASS | FAIL | UNSUPPORTED | NOT-RUN |
50 |---|---:|---:|---:|---:|
51 | All 273 | 59 | 0 | 0 | 214 |
52 | Positive CXTM | 51 | 0 | 0 | 180 |
53 | Negative CTM | 8 | 0 | 0 | 34 |
54
55 All 46 previously passing positive cases have identical actual object
56 observations and canonical outputs. The three prefix rejections remain PASS.
57 Only the ten selected Date contracts change NOT-RUN → PASS.
58
59 ## Complete fresh offline runs
60
61 Both runs disable user/system initialization and inherited ASDF configuration.
62 `sandbox-exec` denies network access. SBCL 2.4.10 runs in a separate relocated
63 checkout without `.git`; deterministic IRIs remain independent of file location.
64
65 | Suite | SBCL 2.5.4 | SBCL 2.4.10 relocated |
66 |---|---:|---:|
67 | Foundation | 54 | 54 |
68 | Topic Identity | 123 | 123 |
69 | Topic Merging | 646 | 646 |
70 | Associations/Roles | 657 | 657 |
71 | Retained CXTM | 445 | 445 |
72 | Occurrences | 1101 | 1101 |
73 | Prefix/explicit datatypes | 150 | 150 |
74 | Integers | 665 | 665 |
75 | Decimals | 715 | 715 |
76 | Dates | 1806 | 1806 |
77 | **Total Lisp checks** | **6362** | **6362** |
78 | Python infrastructure tests | 2 | 2 |
79 | Independent NFC comparisons | 16294 | 16294 |
80 | Independent Integer probes | 143 | 143 |
81 | Independent Decimal probes | 157 | 157 |
82 | Independent Date probes | 396 | 396 |
83 | Independent century decisions | 15 | 15 |
84 | Positive original CXTM byte comparisons | 51 | 51 |
85 | **Failures** | **0** | **0** |
86
87 All ten report pairs are byte-identical. The 4882 checks in the combined CXTM
88 report are already included above, not additional tests. Python's separate
89 calendar oracle uses arbitrary-precision integers and calendar.isleap, not
90 platform-local dates/timezones. Probes include 10,000-digit years, valid
91 month/year combinations, explicit XML whitespace, negative years and centuries.
92 Date tests also cover invalid year/month/day forms, lexical/grammar boundaries,
93 QName distinction, duplicate replacement, Topic merges, canonical raw reference
94 slots, retained handles, construction-order independence, lexical order rather
95 than chronology and mutation-free serialization.
96
97 Retained assertions formerly testing unsupported Dates were adapted one-for-one:
98 DateTime remains an excluded fixture; explicit Date now uses a valid date and
99 expects canonical output. All prior suite totals and original-case observations
100 are preserved. Initial development compilation/fixture corrections precede the
101 final successful full runs; the final logs contain no test failures.
102
103 The public Lisp inspection example was executed successfully under the same
104 network-denied policy. Exact commands, versions, exit codes, input digest and
105 64 artifact digests are in `reports/slice-9/execution.json`. Original reports and
106 baselines were neither rewritten nor substituted.
107
108 ## Reproduction
109
110 ```sh
111 python3 /Users/rgb/workspace/topic-maps/scripts/validate-slice-9.py \
112 --sbcl-254 /nix/store/hlsiblxpxr1hax3dw9x8znd6zy097ddj-sbcl-2.5.4/bin/sbcl \
113 --sbcl-2410 /nix/store/y96nx8571mpdvjd40krkdim2av0in972-sbcl-2.4.10/bin/sbcl \
114 --output /private/tmp/topic-maps-slice-9-reproduction
115 ```
116
117 Actual validation used `--output reports/slice-9`. It requires the already
118 installed runtimes, Python with UCD 15.0/15.1 and macOS sandbox-exec; it provisions
119 nothing. To run one fresh complete suite:
120
121 ```sh
122 /usr/bin/sandbox-exec -p '(version 1)(allow default)(deny network*)' \
123 /usr/bin/env PYTHONDONTWRITEBYTECODE=1 \
124 SBCL=/nix/store/hlsiblxpxr1hax3dw9x8znd6zy097ddj-sbcl-2.5.4/bin/sbcl \
125 TOPIC_MAPS_REPORT=/private/tmp/topic-maps-slice-9.json \
126 /Users/rgb/workspace/topic-maps/scripts/test.sh
127 ```
128
129 Valid explicitly qualified date zones are stored/validated but CXTM signals
130 `:DATE-TIMEZONE-CANONICALIZATION` as unsupported. Bare CTM date zones are not in
131 the date grammar. DateTime, zone conversion, Variants, nonempty Scope, Reification,
132 Templates, CTM `*`, cross-document merging and HyperDoc integration remain out of
133 scope. No server or deployment was used. Slice 10 is not begun.