Skip to content

DraftOwner sparklesReviewed 2026-10-26

The Sparkles toolchain — Delivery plan ​

This is the milestone tracker for the toolchain specification, WASI and WebAssembly modules pages, and the tracker of the WebAssembly tech-debt catalogue below. Requirements live in those pages and evidence in testing.md; a milestone names them, it does not restate them.

Work spans three repositories. dlang.nix carries the toolchain packages, the LDC and LLVM forks carry compiler changes as atomic commits (TC3), and Sparkles carries its consumption of the toolchain, its WebAssembly modules and this specification as one pull request of atomic commits.

Milestones ​

MilestoneDeliverable and obligationsPrerequisitesAcceptance gateExclusionsState
TC-M0 SpecificationThese pages, the decision record, and the repaired pin in the shaders and test-runner specifications—Cold read of the opening; adversarial review of the requirements; sidebar, spec-evidence and glossary checks; site buildImplementationin progress
TC-M1 The dlang.nix branchdlang.nix's toolchain branch, which Sparkles pins, carries build status on every package and no obsolete WASI fork packages. Establishes TC1, TC2, TC3 and TC5TC-M0dlang.nix's CI matrix evaluates; Sparkles ci test passes on the pinned revisionMerging into dlang.nix main (TCD2); toolchain changesdone
TC-M2 nixpkgsSparkles and dlang.nix on the latest nixos-unstable; dlang.nix's nixpkgs follows Sparkles' (TC4); the host-ELF compiler wrapper and DMD wrapper removed if the glibc split is goneTC-M1Sparkles ci test, docs build and Android packages pass on the bump alone, before any toolchain changeLLVM configuration changesdone
TC-M3 The LLVM rebuildOne rebuild delivering TC6–TC14, TC16, TC17 and TC21–TC23: split outputs, shared LLVM library and trimmed tools, clang-sparkles and its stdenv, compiler-rt shipped with LDC, LDC built by its own clang, the assertions decision measured and applied, the closure table, Nix-run tests, warm cachesTC-M2TC22 tests pass on all hosts of TC21; closure table of TC16 recorded; caches warm (TC23)WASI from source; all-LLVM profiledone
TC-M4 All-LLVM runtime profilelibunwind and libc++ from the fork; the opt-in profile (TC18–TC19); static terminal, hue and font-explorer builds (TC20)TC-M3TC19 interop scenarios; the three applications' suites under the profile; size and start-up recordedmusl builds (open question Q2)done
TC-M5 WASI from sourceTCW1–TCW11: sysroots for p1, p2 and experimental p3, LTO variants, drivers, components, reactors, D runtimes per preview, runtime test suites under wasmtime; the LDC fork fixes for TCW11 and -ffile-prefix-map (TC15)TC-M3druntime and Phobos test runners pass for p1 and p2 with listed known failures; p3 probe result recordedBrowser component-model hostingdone
TC-M6 WebAssembly modulesTCM1–TCM9: dub-built reactor modules on the shared interface, one site loader, no committed binary, native-agreement check; the test runner's WASI execution modeTC-M5TCM9 check passes; site build from a clean tree; ci test --special-modes all runs @wasm tests on WASI—done

WebAssembly tech-debt catalogue ​

Recovered from the audit of the first WebAssembly toolchain. A row closes when its milestone's gate passes; rows closed by work that predates this plan name the pull request that closed them, and closed rows stay for reference.

IDDebtRepaymentMilestoneStatus
WTD1Three D compilers and three LLVMs in the closureOne fork of each (TC1, TC2), PetarKirov/sparkles#691—closed
WTD2An obsolete WASI fork of LDC duplicated upstream's WASI supportDropped; the unified fork carries upstream's support (#691)—closed
WTD3Driver patches read the sysroot from the environment and forced one link mode for every previewLink through the per-preview clang driver (TCW5)TC-M5closed
WTD4Phobos redirected to a fork that stubbed directory iterationUpstream Phobos (#691)—closed
WTD5The D runtime built for one preview, the modules compiled for anotherOne runtime per preview (TCW8)TC-M5closed
WTD6The WASI runtime is not tested in NixTCW10: druntime and Phobos runners under wasmtimeTC-M5closed
WTD7The component linker built from source with a workaround, builtins wired by absolute pathRebuilt as part of the WASI toolchain (TCW6, TCW1)TC-M5closed
WTD8The modules build only on x86_64 LinuxTCM2TC-M6closed
WTD9Duplicated WebAssembly defaults in Sparkles' compiler configurationLDC's own configuration (#691)—closed
WTD10A shell wrapper parses -mtriple to keep host linker flags off cross linksRemoved with the glibc split (TC4)TC-M2closed
WTD11Every module's references are scrubbed because __FILE__ names the toolchainTC15: the compiler maps its own paths and builds assert their absence; the WebAssembly modules' nuke-refs goes with their hand-written build (TCM1)TC-M5closed
WTD12Sparkles pinned to a stacked feature branch of dlang.nixAccepted until upstreaming (TCD2); the stack is one linear branchTC-M1accepted
WTD13The modules are built by a hand-written compiler invocation that re-derives the dependency graphTCM1TC-M6closed
WTD14The modules' entry points are compiled by no test or per-commit buildTCM1, TCM2TC-M6closed
WTD15The test runner's attribute module is on the modules' import pathResolved by dub (TCM1)TC-M6closed
WTD16The modules duplicate their memory interfaceTCM5TC-M6closed
WTD17The table module avoids exceptionsTCW9, TCM6TC-M6closed
WTD18Module constructors are assumed not to runTCW7, TCM4TC-M6closed
WTD19Command modules are used as reactorsTCM4TC-M6closed
WTD20Each site component stubs the WASI imports itselfTCM7TC-M6closed
WTD21The text module's binary is committed and never rebuiltTCM3TC-M6closed
WTD22Module sizeTCW3, TCM8TC-M6closed
WTD23Comments describe the obsolete WASI forkRewritten with the repaymentTC-M6closed
WTD24The test runner's --wasm mode is -betterC on bare wasm32WASI execution mode in the test-runner specificationTC-M6closed
WTD25The shipped modules have no testsTCM9TC-M6closed
WTD26The toolchain is pinned in the aggregate build and CI timeouts are inflated for cold buildsThe pin set holds the toolchain (TC24); the aggregate pin is gone and the timeouts are back to 30 minutesTC-M3closed
WTD27--wasm needs wasm-ld on PATHWASI links go through the WASI driver (TCW5); --wasm-bare links internallyTC-M6closed
WTD28Compile-time real arithmetic folds with x87 precision for quadruple-precision targetsTCW11TC-M5closed
WTD31LLVM assertions cost about 10 % in optimized buildsTC17TC-M3accepted
WTD32The Android LDC was a separate, stock compilerBuilt on the fork (#686)—closed
WTD33The stock LDC's closure carried its bootstrap compiler and a second LLVMThe stock LDC left the toolchain (#691)—closed
WTD35Compute-stage commits of the shader work are not on the fork's sparkles/mainRebased onto it by their owner—planned
WTD36Three LLVM fork commits reach the WASI sysroots as patches, and LLVM still installs unused toolsThe fork commits reach the sysroots through the fork itself, with a fourth for wasm-ld; ClangIR and the unused tools are off (TCD11, TC9)TC-M3closed

WTD29, WTD30 and WTD34 were fork-internal fixes (LLVM 24's exception personality, interpolated-expression precedence, the clang static analyzer build) and are recorded in the forks' commit messages.

Cache pins ​

TC24 makes nix/pin-targets.nix the pin set, and ci/toolchain-pin.d (implementation in apps/ci/src/derivation_pin*.d) applies it:

  • The set, not a catalogue. The tool evaluates legacyPackages.<system>.pinTargets for x86_64-linux, aarch64-darwin and aarch64-linux, one nix eval per system, and pins each entry as <name>-<system> from .#legacyPackages.<system>.pinTargets.<name>. A system that fails to evaluate, or evaluates to nothing, fails the run.
  • Name filters. --toolchains keeps the names with the toolchain- prefix, --android those with the -android suffix, --libs the rest; positional entry names and a repeatable --system narrow further. A name or system outside the set, or a selection that matches nothing, is an error.
  • One revision. --revisions and CI_PIN_REVISIONS default to 1 and must be positive.
  • No pin outside the set. After every selected pin succeeds, the tool lists the cache's pins (GET https://app.cachix.org/api/v1/cache/<cache>/pin) and deletes each one the whole expansion does not name (DELETE …/pin/<name>), whatever the selection, so a run narrowed to one host keeps the others' pins. A dry run lists the deletions and makes none.
  • The cap. The summary states the selected closures' non-upstream size against the cache's 10 GiB.
  • The TC23 gate. --check evaluates every selected out path, from any host for all three systems, and asks https://<cache>.cachix.org/<hash>.narinfo; it exits non-zero listing each output that is missing or unanswered. It builds nothing and needs no token.

Building aarch64-linux and aarch64-darwin outputs needs a builder for that system, so each host pins its own with --system.

CI's pin-cache job runs the gate on every trigger: nix run .#ci-minimal -- check pin-cache checks the set's toolchain-* entries for all three hosts, the outputs TC23 names. A pull request that leaves the toolchain alone passes it. One that moves the lock is planned first (TCD13): pin-plan (toolchain-pin-check --plan) lists the missing outputs, pin-build builds those within the budget, by their recorded costs (ci cache pin-costs), on a runner of their system and pushes them to R2, recording each build, and the gate then runs. An output over the budget stays red, reported with the ci/toolchain-pin.d command that builds it on a developer host. The other entries change with ordinary pull requests and are pinned after they merge, so the job leaves them to --check.

Acceptance for the plan: a lock move whose outputs no cache serves turns green through pin-build alone; an output given a cost over the budget, and an output whose closure needs it, is reported and not built. Each pin-build build is recorded as a pin-build:<pin> task, and the next plan's cost for that pin is the median of those records.

Acceptance: a dry run on each host lists exactly the set and no deletion; a real run leaves the cache's pin list equal to the set for all three hosts. --check passes before every lock move.