Skip to content

Upgrade to Unicode 18 and expand text processing and testing - #116

Merged
lukewilliamboswell merged 59 commits into
mainfrom
integration/unicode-18-testing
Nov 26, 2026
Merged

lukewilliamboswell merged 59 commits into
mainfrom
integration/unicode-18-testing

Conversation

@lukewilliamboswell

@lukewilliamboswell lukewilliamboswell commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Pin Unicode 18.0.0, Emoji 18.0, and CLDR 49. Update the Unicode rule implementations and the version-matched ICU4J, Code9, and ICU4X references.
  • Adopt the roc-pdf testing methodology in the contributor guide and repository instructions. Upgrade to roc-fuzz 0.8.0 with 13 targets, bounded Model and Solve checks, corpus replay and reduction, and locally run campaigns.
  • Keep all 42 upstream Unicode 18 and CLDR 49 inputs in a local checksum-verified cache. Routine CI uses small named seed sets, fuzz correctness oracles, focused expectations, and allocation ratchets. Fetch the pinned inputs to run full conformance or regenerate tables locally.
  • Add opt-in Thai line breaking with caller-supplied dictionaries, Unicode normalization and sentence boundaries, identifier and numeric properties, locale identifiers, and bounded German and Spanish collation profiles.
  • Add bounded collectors, enforce a checked-in public API inventory in CI, and test UTF-8 round trips for every valid scalar under Roc's development and optimized backends.

Independent worktrees were reviewed against the package design before integration.

Configuration API migration

  • Pass only the collation settings you want to override, for example
    Collation.collator(locale, { digit_order: ByNumericValue }). Pass {} for the
    standard settings. The default digit order is ByCollationWeight.
  • Pass Case.to_lower(text, { limits: budget }) for default mapping and
    Case.fold(text, { limits: budget }) for full folding. Use the profile
    field for an override and construct Case.Limits with named fields.
  • Pass Bidi.analyze_paragraph(text, { limits: budget }) for automatic base
    direction. The options also apply to Bidi.analyze_range.
  • Pass ThaiLineBreak.Dictionary.from_words(words, { revision, limits })
    to name the required dictionary revision and resource limits.

Why the diff is this size

The PR adds 25,849 lines. Generated runtime modules account for 16,499 of
those lines (64%). The raw Unicode and CLDR inputs live in the local cache.

Area Lines added Why it belongs in this PR
Generated Roc runtime modules 16,499 Pin the Unicode 18 lookup tables and supply the new normalization, collation, sentence, identifier, and numeric data. Applications use these static tables directly with bounded lookup and no downloads or runtime parsing. The generator reproduces them byte for byte from the manifest.
Handwritten Roc runtime 2,344 Implement normalization, sentence segmentation, numeric lookup, locale parsing, collation, and opt-in Thai dictionary breaking. Adapt existing APIs to the new Unicode rules and add bounded collectors using the shared source and range types.
Fuzz targets, models, and seeds 2,117 Check boundary and chunk equivalence, typed limits, normalization laws, stable collation, and other public invariants over generated inputs. A compact set of named seeds drives exploration.
Test apps and focused expectations 1,244 Exercise API contracts and allocation limits directly. The local test apps feed official conformance cases through the public entry points.
Generators and test drivers 2,217 Parse and validate the added Unicode and CLDR source formats, regenerate the tables, and drive the fuzz, conformance, and API checks.
Manifest 531 Record release and specification pins, source checksums, and the dependencies and size budgets of generated modules.
Docs, examples, and CI 733 Document public contracts and testing policy, cover the bundled examples, and run the seeded checks in CI.
Benchmarks 164 Align the grapheme reference with Unicode 18 and verify benchmark input against the pinned sources.

The two largest files are the generated collation and normalization modules.
Together they account for 9,087 added lines. Review their inputs, generator
logic, and reproduction checks alongside the handwritten algorithms.

Verification

  • A 30-minute local macOS arm64 fuzz campaign passed all 13 targets with 24,403,135 attempted inputs and no findings.

  • Full data regeneration, safety, and conformance checks passed locally on macOS arm64, including 313,358 normalization cases and 424,070 collation comparisons. CI uses shared allocation ceilings on Linux and macOS. Counts at or below the ceiling pass. The macOS arm64 allocation suite and ceiling boundary checks passed. With the same compiler pin, optimization mode, and inputs, allocation counts for pure Roc code should be identical on Linux and macOS. A difference in those counts is a compiler bug. I also ran the macOS arm64 allocation probe against the Linux x64 recording, and all 126 exact fixture counts matched.

  • Verified all 42 manifest downloads from an empty input cache. A collation fuzz example caught a deliberate reversal of stable tie ordering.

  • All 107 bundled example cases, focused API checks, allocation ratchets, deterministic models and proofs, and all 13 fuzz smoke targets passed from a checkout without the upstream source files. The smoke attempted 26,000 inputs.

  • The configuration API changes passed the allocation ratchet, all four affected fuzz targets (8,000 attempts), the bundled Bidi example, and the local Case, Bidi, and collation suites.

  • ICU4J passed 30,944 casing comparisons. Code9 passed 256 seeded bidi cases. Roc and ICU4X matched the official Unicode 18 grapheme signature.

Closes #115, closes #50, closes #46, and closes #42.

Review: /root/thai checked the guide against design.md and the upstream roc-pdf methodology. Added the planned pinned deterministic suite entry point alongside the optimized smoke command.
Adversarial design.md review found that missing list entries could be mistaken for empty normal results. Return a typed atomic fault, mark DP states as computed, and guard extraction and trie traversal progress.
Reviewed by /root/thai against design.md. Verified archival source checksums, checked final release provenance and changed default algorithms, and corrected benchmark revision metadata before approval.
Reviewed by /root/thai against design.md and the roc-pdf testing methodology.
Reviewed by /root against design.md. Resolved silent invariant recovery and guarded trie and segmentation progress before approval.
Adversarial review by /root/ucd checked the shared collectors, independently enumerated 820 short Bidi P1 histories, and found lexical checker gaps that were corrected and regression tested. In a scratch copy, rejecting E0 A0 in the UTF-8 decoder failed both the malformed-matrix and valid-endpoint expectations.
Independently reviewed by /root/ucd against design.md. Verified bounded collectors, exact public operation coverage, lexical invariant detection, and adversarial P1 and UTF-8 expectations.
Adversarial review by /root checked suite inventory and semantics, bounded seed/corpus workflow and repro provenance. Added outer subprocess time limits and model reachability checks before approval. A scratch UTF-8 truncation mutation was caught by the deterministic model.
The exact UAX #29 comparison passes all 512 official rows with every scalar-aligned two-chunk split. The independent Model visits 120 histories; ignoring lowercase resolution in a scratch copy fails at Append(Neutral), ResolveLower.
Adversarial review by /root against design.md covered well-formedness, canonical syntax, explicit casing policy, limits and ownership. Reviewed fixes add bounded parsing, audit coverage, and a parser mutation witness.
Independently reviewed by /root. Checked atomic limit oracles, replay deadlines and the real corpus reduction exercise.
Reviewed by /root against design.md. Uses SDK allocation declarations without modifying the hash-verified Unicode Code9 source.
Reviewed independently by /root/fuzz against design.md and UAX #29. Official cases include every two-chunk split, and the SB8 model exercises a targeted production mutation.
Adversarial review by /root/ucd checked UAX #15 against design.md, found the missing assigned-scalar identity condition and ASCII fast-path gaps, and approved their fixes. A scratch mutation skipping canonical ordering failed the ordered combining marks expectation. Targeted optimized checks passed 75 official records and 175 identity probes.
Independently reviewed by /root/ucd against design.md and UAX #15. Includes the assigned-scalar identity oracle and a targeted ordering mutation.
Reviewed by /root against design.md and the pinned UCD parsing contract. Includes endpoint and rational checks, an allocation-free decimal digit projection, and targeted mutation evidence.
Build keys from NFD, contiguous and unblocked nonstarter matches and explicit implicit weights. Exercise profiles, numeric ordering, case-first options, stable sort and limits. A targeted scratch mutation allowing equal combining classes to be skipped failed the independently authored Cyrillic contraction fixture. The pinned optimized build passed selected adjacent official pairs in both alternate modes.
Share the fused decimal-digit lookup. Record ICU4J 79.1, Unicode 18.0.0 and CLDR 49 and all settings on 34 differential rows, including the 254-significant-digit boundary.
Adversarial review by /root checked cross-form and concatenation identities, the independent resource counts, and the exact-budget mutation.
The official UCA archive is preserved byte-for-byte. The test driver covers both variable-weight modes, and bounded locale profiles use the stable rules from CLDR.
Reviewed by /root against the existing owned sentence range implementation.
Adversarial review by /root/ucd and generator review by /root/fuzz against design.md. Addressed false ties in the official oracle, distinguished CLDR and DUCET variable weights, guarded packed and LDML domains, and verified known contractions, ICU comparisons, and a targeted blocking mutation.
The locked optimized reference matched the manifest's official aggregate signature and all 26 individual GB9c rows. Group signatures by each implementation's Unicode version and use the official signature for matching-version implementations. Current final Go, unicode-segmentation, and libgrapheme versions still use Unicode 17.
Adversarial review by /root checked pinned ICU4X Neo construction and signature validation by Unicode version. Optimized ICU4X matched the official Unicode 18 signature and individual GB9c cases; older final releases remain diagnostic.
The public encoder's two-byte low-bit mutation produced well-formed UTF-8 for the wrong scalar. The bounded round-trip oracle detected it while the independent validator still accepted the bytes.
Reviewed by /root against design.md. Covers the complete valid scalar domain in dev and speed, retains the independent UTF-8 endpoint and rejection cases, and detects a targeted encoder mutation.
Final review found a pre-collation fixture that installed a synthetic CLDR release. The test now exercises the authoritative CLDR pin and keeps the original rejection checks. Independently reviewed by /root/ucd.
Independent review by /root/ucd confirmed the pinned release and rejection evidence.
The checked-in fixture counts are ceilings. A smaller measurement passes and can tighten the ratchet after review. Independently reviewed by /root/ucd against design.md.
Independently reviewed by /root/ucd against design.md. The optimized macOS allocation suite and ceiling boundary checks passed.
…acles

Fetch the manifest-pinned Unicode and CLDR inputs by checksum for local regeneration and conformance. Run routine CI with small named fuzz seed sets, focused expectations, and allocation ratchets. Add a collation oracle for canonical equivalence and stable ordering.

Independently reviewed against design.md by /root/ucd.
Independently reviewed against design.md by /root/ucd. Verified all 42 manifest downloads and detected inverted stable ordering in a scratch mutation.
@lukewilliamboswell
lukewilliamboswell force-pushed the integration/unicode-18-testing branch from 3afad7e to c998590 Compare November 26, 2026 00:08
The shared five-minute command timeout killed the local data test process while it was actively rendering and checking Unicode 18 data. Extend only the optional data unittest subprocess to fifteen minutes.

Independently reviewed against design.md by /root/ucd.
Independently reviewed against design.md by /root/ucd.
Default collation settings, case profiles, and Bidi base direction at the call site while keeping resource limits and Thai dictionary revisions required. Use named Case limit fields and migrate package callers, examples, fuzz targets, and test harnesses.

Independently reviewed by /root/ucd against design.md. The omitted-case-profile expectation detected a scratch mutation changing the default mapping to Turkic.
Independently reviewed by /root/ucd against design.md. Checkout-only API and allocation checks, bundled Bidi examples, the four affected fuzz targets, and local Case, Bidi, and collation conformance passed.
Use ByCollationWeight as the default and ByNumericValue to select bounded decimal-run comparison. Independently reviewed against design.md by /root/ucd. The focused test caught a scratch mutation selecting numeric order by default.
Independently reviewed against design.md. Both collation conformance suites, focused checks, and the fuzz smoke passed.
Remove the scheduled GitHub Actions campaign and document the local runner, reports, and persistent corpus.
Independently reviewed by /root/ucd against design.md. The PR smoke workflow still runs deterministic models and bounded fuzzing.
@lukewilliamboswell
lukewilliamboswell merged commit 37ac0b8 into main Nov 26, 2026
14 checks passed
@lukewilliamboswell
lukewilliamboswell deleted the integration/unicode-18-testing branch November 26, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant