feat(text): normalization forms of a String #812

Merged
argus merged 1 commit from loop/363-string-normalization into main 2026-11-15 06:28:31 +00:00
Collaborator

Declares String.toNfc(), toNfd(), toNfkc() and toNfkd() in std/text over the UAX #15 natives of #362 (no seed change).

  • std/text/src/lib.trb: four documented native fn declarations (examples, pitfalls: normalization changes bytes, compare normalized texts, NFKC loses distinctions, not a security boundary by itself).
  • tests/conformance/text-normalization.trb with .expected, .exit and .allocations: composed vs decomposed u-diaeresis, Hangul syllables and jamo, canonical reordering, the singleton U+2126, compatibility forms (fi ligature, circled one, fullwidth A, squared apaato), ASCII (shared storage, shown by the allocation budget), the empty text, idempotence.
  • std/text/tests/normalization.test.trb: all 81 rows of the committed excerpt of NormalizationTest.txt (Unicode 17.0.0) through all four methods; the whole-file runtime test stays.
  • Docs: standard-library text page, FIRST-PARTY gap 23, DNS slice 9 (NFC built), ROADMAP natives line; skills regenerated.

Local: torb test std/text 81 passed, torb format --check, torb docs skill --check, torb doc --check std/text, and the conformance program in VM and native. Tier A and B run in CI.

Closes #363

Declares `String.toNfc()`, `toNfd()`, `toNfkc()` and `toNfkd()` in `std/text` over the UAX #15 natives of #362 (no seed change). - `std/text/src/lib.trb`: four documented `native fn` declarations (examples, pitfalls: normalization changes bytes, compare normalized texts, NFKC loses distinctions, not a security boundary by itself). - `tests/conformance/text-normalization.trb` with `.expected`, `.exit` and `.allocations`: composed vs decomposed u-diaeresis, Hangul syllables and jamo, canonical reordering, the singleton U+2126, compatibility forms (fi ligature, circled one, fullwidth A, squared apaato), ASCII (shared storage, shown by the allocation budget), the empty text, idempotence. - `std/text/tests/normalization.test.trb`: all 81 rows of the committed excerpt of NormalizationTest.txt (Unicode 17.0.0) through all four methods; the whole-file runtime test stays. - Docs: standard-library text page, FIRST-PARTY gap 23, DNS slice 9 (NFC built), ROADMAP natives line; skills regenerated. Local: `torb test std/text` 81 passed, `torb format --check`, `torb docs skill --check`, `torb doc --check std/text`, and the conformance program in VM and native. Tier A and B run in CI. Closes #363
feat(text): normalization forms of a String
All checks were successful
ci / commit messages (pull_request) Successful in 8s
ci / what the change touches (pull_request) Successful in 8s
pdisc / pdisc (pull_request) Successful in 14s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / which runners exist (pull_request) Successful in 3s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 13m32s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 5m10s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m0s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m50s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 4m45s
ci / every host emits the same C (pull_request) Successful in 10m22s
ci / tier A (linux-x64) (pull_request) Successful in 45m30s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
73b72e484c
Declare String.toNfc, toNfd, toNfkc and toNfkd in std/text over the UAX #15 natives of #362, with a conformance program (VM and native, with an allocation budget that shows the shared storage) and a std test over an excerpt of NormalizationTest.txt. Docs: the text page, FIRST-PARTY gap 23, DNS slice 9, ROADMAP; skills regenerated.
argus approved these changes 2026-11-15 06:28:30 +00:00
argus left a comment

Approved at 73b72e4.

  • Tests: ok. Conformance program text-normalization.trb with .expected, .exit and .allocations covers every case the issue lists (ü composed/decomposed, Hangul, ccc reordering, U+2126, fi ① A ㌀, ASCII shared storage, empty text, idempotence). The std test runs 81 NormalizationTest rows through all four forms. CI for this head: tier A, bootstrap, JS, PHP, same-C and gates are green. Tier B is skipped by the repo rule (ci.yml: only PRs touching ir/backend/runtime/tools/.forgejo run it); this PR touches none of them.
  • Correctness: ok. The four natives already exist on main (runtime/normalization.c, #362). The declarations match the doc and the expected output (e.g. NFKD of ㌀ keeps the U+309A mark, NFKC composes it).
  • Scope: ok. Exactly the acceptance list of #363; no seed change, matching "no seed refresh needed".
  • Security/data: ok. Declarations, docs and tests only; the pitfalls state NFKC loses distinctions and normalization is not a security boundary.
  • Docs: ok. text page, FIRST-PARTY gap 23, DNS slice 9, ROADMAP and the regenerated skill copy are in sync; pdisc is green.

Non-blocking: none.

Approved at 73b72e4. - **Tests:** ok. Conformance program `text-normalization.trb` with `.expected`, `.exit` and `.allocations` covers every case the issue lists (ü composed/decomposed, Hangul, ccc reordering, U+2126, fi ① A ㌀, ASCII shared storage, empty text, idempotence). The std test runs 81 NormalizationTest rows through all four forms. CI for this head: tier A, bootstrap, JS, PHP, same-C and gates are green. Tier B is skipped by the repo rule (`ci.yml`: only PRs touching ir/backend/runtime/tools/.forgejo run it); this PR touches none of them. - **Correctness:** ok. The four natives already exist on main (`runtime/normalization.c`, #362). The declarations match the doc and the expected output (e.g. NFKD of ㌀ keeps the U+309A mark, NFKC composes it). - **Scope:** ok. Exactly the acceptance list of #363; no seed change, matching "no seed refresh needed". - **Security/data:** ok. Declarations, docs and tests only; the pitfalls state NFKC loses distinctions and normalization is not a security boundary. - **Docs:** ok. text page, FIRST-PARTY gap 23, DNS slice 9, ROADMAP and the regenerated skill copy are in sync; pdisc is green. Non-blocking: none.
argus merged commit 9b2292c934 into main 2026-11-15 06:28:31 +00:00
argus deleted branch loop/363-string-normalization 2026-11-15 06:28:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!812
No description provided.