TOML Conformance
Lanexio™ Parser supports both TOML v1.0.0 and v1.1.0 through a single package. The conformance suite validates valid input acceptance, invalid input rejection, the official toml-test corpus, a generated fuzz corpus, and real-world TOML documents (over 2,000 test files total).
Curated toml-test gate (CI)
Section titled “Curated toml-test gate (CI)”The official toml-test reference suite is vendored-and-pinned into
corpus/toml-test/ (commit bc8f2c2cca601ea91d482046ea9fef3bf7a26c28) and gated in
CI by pnpm test:curated-suites (repo-level gate, see ADR 0034). The frozen
ledger in corpus/toml-test/expectations.json records the bootstrap-measured
baseline; it can only shrink as the parser improves, never silently grow.
- 268 valid
.tomlfiles, version-routed by directory (spec-1.0.0/→ TOML 1.0.0,spec-1.1.0/and general valid → TOML 1.1.0): 268/268 clean. - 511 invalid
.tomlfiles, version-routed (general invalid → TOML 1.0.0, conservative): 511/511 flagged with an error node. - Ledger: 0 expect-fail, 0 deferred at this pin. The earlier claim of 6
invalid/encodingdeferrals (UTF8_LENIENCY) does not reproduce against the pinned revision: all 15invalid/encodingfiles are rejected. - The
.jsonvalue-decode expectations are vendored but not gated (tagged-JSON datetime encoding is a parser-feature follow-up; see ADR 0034).
The same committed corpus also powers the package harness
(packages/parser-grammar-toml/src/conformance.test.ts), which previously read a
gitignored copy and passed vacuously in CI. It now runs 779 real official
describe-block cases.
Test results
Section titled “Test results”All tests pass across six categories:
- Official toml-test valid — 268 files, version-routed by spec-1.0.0 / spec-1.1.0
- Official toml-test invalid — 511 files, version-routed by spec-1.0.0 / spec-1.1.0
- Inline fixtures — curated valid/invalid coverage for all TOML features
- Generated corpus — fuzz-generated inputs, all parse safely
- Real-world documents — production TOML configs, all parse without error
- Cross-version fixtures — TOML 1.1.0 constructs rejected in 1.0.0 mode (\xHH escapes, seconds-less times, inline table newlines/trailing commas)
Corrected gate: every returned tree carries metadata.language === "toml"
(stamped at the single createTreeFromUint32Array call site), and the exhaustive
harness reports 12,000 / 12,000 results passing (100.00%) on the corrected gate
(2,000 test_files/toml files x 6 modes). TOML is byte-lossless: the lexer tiles
whitespace/newline/comment/delimiter runs as trivia leaves, so
emitSource(parse(x)) === x holds byte-for-byte — including a leading UTF-8 BOM
(insignificant but tiled as a leaf) and CRLF line endings. Malformed bytes (e.g.
bare CR or NUL) surface as TomlKind.Error leaves that still cover their byte
range, so losslessness holds even on malformed input.
Version selection
Section titled “Version selection”parseToml(bytes) defaults to TOML v1.1.0. Use parseToml10(bytes) or parseToml11(bytes) for an explicit version. Incompatible constructs between versions are handled by the version-aware parser.
Strict mode
Section titled “Strict mode”parseToml accepts a mode option ("lenient" or "strict"). The default is "lenient", which keeps the recovery behavior of every previous release.
In "strict" mode the parse path still never throws, and the grammar defaults to the TOML 1.0.0 rule set when no version is given. Constructs that are only valid in 1.1 are therefore rejected by rule selection:
- datetimes and times without seconds (
1987-07-05T17:45Z,17:45) - inline-table newlines and trailing commas (
{ abc = 123, }) \xbyte escapes in basic strings ("\x33")
An explicit version always wins over the strict-mode default: parseToml(bytes, { mode: "strict", version: "1.1" }) keeps the 1.1 rule set. Rejection surfaces as LexError nodes and tree.root.hasError reads true.
Four-axis bar
Section titled “Four-axis bar”| Axis | Result |
|---|---|
| never-throw | 0 throws across full corpus |
| well-formed | corpus WF = 0 |
| lossless | corpus lossless = 0, byte-exact round-trip (corrected gate; BOM-prefixed and CRLF documents round-trip byte-for-byte, malformed bytes emit Error leaves that still cover their range) |
| conformance | 2,000+ / 2,000+, 12,000 / 12,000 mode-results on the corrected gate |
Corpus conformance
Section titled “Corpus conformance”pnpm conformance:suite measured this family over the test_files/toml corpus on 2026-10-06 at
Lanexio™ Parser version 1.0.0:
| family | valid | invalid | raw | contract-subset | REAL-DEFECT |
|---|---|---|---|---|---|
| toml | 1484 | 505 | 99.5% | 100.0% (1484/1484) | 0 |
The lower raw figure reflects the large invalid-input share (505 of 1,989 classified files); the contract-subset over the valid inputs is 100.0%.