Repository navigation
Description
Restated (2026-10-25 triage)
Migrate lexbor as a registered corpus (build/corpora.w, one Corpus record) under lib/std/engines/lexbor (D146), with a functionality-named HTML facade. The #675 blocker is gone: the corpus registry is the generic pipeline.
Original report
⛔ Blocked on #675 — start only after the manifest-driven migration build refactor is complete; lexbor lands as a manifest entry.
Goal
Migrate lexbor v3.0.0 with with migrate, following the pcre2 and zlib patterns, to give lib/std real HTML support.
Motivation
docs/impossible_oneliners.md — the "Missing HTML entity codec" section blocks two recipes (HTML-decode a string; download a page, strip HTML, decode entities). A correct decoder needs the full named-entity table, numeric references, Unicode scalar validation, legacy optional-semicolon names, and HTML's context-sensitive error recovery — a real engine's job, not a replace-chain. lexbor carries the complete entity data and a spec-conformant tokenizer/parser. Target shapes from that doc:
with -e 'use std.encoding.html;print(decode_entities("Tom & Sue"))'
with -e 'use std.encoding.html;use std.http;write(decode_entities(/<[^>]+>/g.replace_all(https_get("https://example.com"),"")))'
Model to follow (pcre2/zlib precedent)
- Engine: migrated modules land as an internal engine directory, mirroring
lib/std/re/(pcre2) andlib/std/zlib/— e.g.lib/std/html_engine/or equivalent. Module-private; With developers never touch it directly. Heed Migrated pcre2 surface is module-private; jit-unsupported contract test needs a pub API #662's lesson: decide up front which surface ispub, and it is the shim, not the engine. - Shim: hand-written, With-shaped, and named for the functionality, not the engine —
std.html(parse / text extraction / tag stripping) andstd.encoding.html(decode_entities/encode_entities), per the impossible_oneliners proposal. Nolexborin any user-facing name. - Build orchestration: follow
build/pcre2.w— pinned release tarball, SHA256 constant, scratch-dir staging, migrate-as-build-action, and a verify step proving the migrated output compiles as-is.
Policy (hard requirements)
with migrateoutput must compile as-is. If the generated code needs any change, the fix goes into the migrator, then re-migrate. Zero hand-patches to migrated files — the parallel-hand-patch failure mode from the early pcre2 work is not allowed to recur.- Migrator fixes must be generic. No lexbor-shaped special cases; every migrator change must be a robustness improvement stated in terms of the C construct it handles, with a regression fixture. A million per-project carve-outs is the anti-goal.
- No silent fallbacks (AGENTS.md): no placeholder bodies, no dropped clauses, no TODO-stubs in emitted output. A module the migrator cannot translate is a loud non-zero failure naming the function and location.
- Migrated-C semantics follow the spec: migrated globals →
global/global varunder §9.1 rules; modeled-CDroptypes get reset-on-move;gotoemission per §"with migrate may emit goto";setjmp/longjmpare unsupported — if lexbor uses them anywhere in the migrated subset, that is a migrator/spec-level decision to surface, not to work around.
Suggested phasing
- Phase 1 — entity codec: migrate the minimal lexbor module set needed for the full entity table + decoding (lexbor/core + the entities data), ship
std.encoding.html.decode_entities/encode_entities, and make both blocked one-liners work. This alone closes the impossible_oneliners HTML section. - Phase 2 — tokenizer/parser: lexbor/html tokenizer + tree builder behind
std.html(parse, walk,.text()extraction, tag stripping done properly instead of the regex approximation). - Phase 3 (optional, separate ruling): DOM/CSS selectors surface.
Deliverables checklist
-
build/lexbor.worchestration (pinned v3.0.0 tarball + SHA256, staged fetch, migrate action, compile-as-is verification wired into gates) - Migrated engine compiles as-is from
with migrateoutput; any migrator changes land as generic fixes with their own regression fixtures -
std.encoding.htmlshim:decode_entities/encode_entities, entity-table version named in the doc comment, strict vs browser-compatible malformed-reference handling specified -
std.htmlshim for phase 2 (parse / text extraction) - Behavior fixtures covering the two impossible_oneliners recipes end-to-end (via
std.httpwhere network-hermeticity policy allows, else on canned input) - docs/impossible_oneliners.md updated when the recipes become possible; spec section for the new std modules; requirements traceability by hand
Spec references
§9.1 (migrated globals under the data-race rules), §16 raw-vs-modeled C and migration completeness mode, the with migrate goto/setjmp notes, and the std-module naming conventions. Examples in tree: build/pcre2.w, build/zlib.w, lib/std/re/ + lib/std/regex.w, lib/std/zlib/.
Activity
Docs: record #672 correction and #673 in handoff
ehartford commentedon Jul 16, 2026
Plan alignment (docs/feature_plans/libs.md, libstd-spec.md):
encoding.html,html.* -> lexbor), and slot the modules into libstd-spec's sequencing table, so the plan remains the single source of truth.std.compress← zlib,std.regex← pcre2), so this follows the same Layer-1 engine / Layer-2 functionality-named module structure.http.parse_*) → ecosystem server package → fetchablewith -edependency resolution.ehartford commentedon Jul 16, 2026
Blocked on #675 (manifest-driven migration build refactor). Do not start until #675 is complete — lexbor must be wired as a
MigrationSpecmanifest entry, not as a fourth hand-rolledbuild/<lib>.wmodule. The build-wiring deliverable in this issue's checklist changes accordingly: "build/lexbor.w orchestration" becomes "lexbor manifest entry + prep hook (if any)".Docs: record migration campaign queue (#675 -> #673/#674) in handoff
[-]Migrate lexbor v3.0.0 into the stdlib: HTML engine + functionality-named shim (std.html / std.encoding.html)[/-][+]Migrate lexbor as a registered corpus: HTML engine + functionality-named facade[/+]ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): still open, and no longer blocked: #675's design landed as the corpus registry (build/corpora.w,build/corpus.w, f050a9f). No lexbor corpus exists (lib/std/enginesholds c_algorithms, mlib, pcre2, stc, tommyds, zlib).post-release: a new corpus and facade (D112, D146: it would land as
std.engines.lexborbeside a functionality-named facade).