Build graph — Delivery plan
Companion to SPEC.md. Each milestone is independently green, and its gate names the oracles in testing.md it must pass.
The first consumer is apps/ci, whose ci test command moves onto the build graph after E3 (see the apps/ci commands plan). Until then, every gate here runs through a test-only driver in this package, not through a ci command. The executor that runs the actions is specified in the task DAG.
E0: Feasibility spikes and compiler support
Each spike states a question and a decision criterion. Its result is recorded in decisions.md.
- Relocation.
- Question: does LDC's prefix map, with root-relative sources, remove every absolute worktree path from objects, archives and test binaries, including
-covand-checkaction=contextbuilds? - Question: do the repository's 53 uses of
__FILE_FULL_PATH__still work with the root mapped to.and test actions run in their worktree's root? - Decision: any surviving path, or any use that cannot be fixed, puts the root path in the affected variants' keys.
- Question: does LDC's prefix map, with root-relative sources, remove every absolute worktree path from objects, archives and test binaries, including
- Complete dependency output: moved to E3, where the input manifest (§5) first reads it.
- dub as a library.
- Question: which resolved fields does
dub describenot expose, and can the pinned dub be linked as a library to obtain them? - Decision: the oracle's second source, or a recorded gap.
- Question: which resolved fields does
- Directive scan. Scan every recipe in scope for directives and variable references, and complete BGR2's list.
Gate: each spike's result is recorded.
Done: spikes 1, 3 and 4 are recorded as D18–D21. The fork's dependency output was never a spike. No milestone before E3 reads a compiler's dependency output, so it moved to E3, beside the fork's content digests (BGK2).
E1a: The pinned test runner (superseded)
Superseded with D16 and BGT4 by the test runner's out-of-process model (TRD1, TRD9 and TRM8 in docs/specs/test-runner/), which the test runner's own plan delivers. Its aim stands: every source include of the runner's implementation is replaced by an ordinary dependency on the shim, so BGR8 holds without an exception.
E1: Recipe resolution and the oracle
dub_manifestrejects unknown directives, reads registry packages'dub.json, and represents every form BGR2 lists.- Resolved settings (§2) for every directive BGR2 lists, following dub's configuration steps (BGR3).
- Registry packages from both lockfiles, with Nix (BGR4), and
pkg-configfor compiles and links (BGR5). BGR4's fetch without Nix comes with the store, in E3. - The hidden-edge report (BGR8), the repository's recipes fixed to declare their dependencies, and test-only reaches moved (D15).
- The dub agreement oracle over every package and request in scope, comparing unpruned settings: pruning, and with it D13's divergent-mode lint, is E2's.
Gate: oracle 1 has zero unaccepted disagreements, and oracle 13 passes: its fixture is reported, and the repository reports no hidden edge. dub test :build-primitives is green.
Done: strict reading, resolution, the registry and libraries are delivered, and oracle 1 covers all 631 requests in scope, single-file packages included, with zero unaccepted disagreements. The repository's recipes now declare their sparkles:math dependencies, the DQL test moved out of ui, and ui's tests no longer compile dql's sources. The out-of-process runner (TRD1) removed the test runner's source includes, and the counters' tests moved into the harness, which depends on the counters, so BGR8 reports no hidden edge. ui-app reads its specification through a link in the package (D24), and the migration comparison snippets are out of scope (D25).
E2: Variants and the action graph
- Variant keys with pruned downward versions, and roles (BGV1–BGV3), with dedup across requests. D13's divergent mode gains its lint, which rejects a dependency whose sources test a version withheld from it, on the same source lexer. Pruning scans string import roots and string literals, and lints
isVersionarguments. - The unittest layout rule and its lint (BGV4–BGV5). The repository's remaining violations are fixed first, so the lint gates from its first commit.
- The action graph and its task-node exposure (BGA1–BGA3, BGA8), without execution.
- Planning's read set (BGP1), checked against
ci's invalidators (CIC5). - File access through the VFS (§12): planning reads through the roots BGF2 names (BGF1–BGF3), and every listing is a fileset resolution (BGF5). The resolver's half is delivered: the fileset-native workspace's W1–W4 moved discovery and resolution onto the capability VFS, with listings as shared fileset resolutions and digests in the read set (fileset-native workspace, D55). What remains is planning's own reads: the source scans of BGV1 and BGV5.
Gate: a test-only planner prints a deterministic action graph for the repository's test selection, with one compile per variant. Oracle 8's planning scenarios, oracle 14, oracle 20 and oracle 24's planning steps pass.
Done: variant keys, roles, pruning and dedup across requests are delivered (build_graph/variants.d), with the isVersion and divergent-mode lints, on sparkles:d-source (D56). Over this repository's 75 test roots, 1,053 targets plan to 167 variants, against 393 without pruning; the scan follows imports (D57). The layout lint (sparkles:unittest-layout) gates planning through a callback, after the repository's 190 in-tree violations were fixed; findings in registry packages are reported (D58). The action graph (build_graph/actions.d) lowers the variants to compile, archive, link, generate and test actions, exposed as task nodes in OBD2's id form, with coverage attempts and their plain fallbacks (CIC7). Planning reads through a tree over BGF2's roots, records the links it crosses and its pkg-config queries, and resolves libraries (D59).
The test-only planner is apps/ci/tools/plan-graph.d; --check runs the gate over this repository's test selection: 168 variants (one a generator's tool), 168 compiles and 488 actions. Oracle 8's planning scenarios, oracle 14's two scenarios, oracle 20's three steps (a trace of about 196,000 lookups, 20 edits, and 2,372 reads against ci's invalidators) and oracle 24's planning steps (1–4) pass. What the gate leaves to E3: oracle 8's revert check, oracle 24's store step, and a stored result serving both graphs of invariant 7.
E3: Local execution and the shared store
Compile, archive, link and test actions on the task-DAG executor, with the explicit environment, relocation and argument normalization (BGA4–BGA7), the publication rules for failed and interrupted actions (BGA9), and deterministic archives (BGA10).
Declared keys, manifests and result keys (§5), with the execution-time hidden-edge check (BGK8) and the library search inputs (BGK9).
The shared store (§6): staging, leases, eviction with digest records and separate bounds, format versions, inspection and repair, miss explanations and the determinism check (BGS1–BGS10), on the VFS beneath its own root (BGF4).
Digest caching and stat proxies from the VFS's
Stat(BGF6), after the VFS's identity amendment to VFO6 is delivered.Registry sources without Nix: fetched by the lockfile's URL into the store and verified by its hash (BGR4).
Typed generators, the test-root module and content-addressed generated sources (§7), with the shader compiler's direct invocation mode and its specification amended. The shader compiler is keyed by its manifest (BGG5) and built as a build-platform variant (BGG6).
Toolchain identity (§8), with the toolchain's store paths remapped (BGA11).
The LDC fork: its dependency output is completed, with each addition tested by a test that fails without it, and the toolchain is bumped to the result. The additions are:
- the ImportC headers in
--makedeps; - an opt-in list of absent candidates;
- coverage registration that honours the prefix map;
- for each file, the content digest of the bytes the compiler read (BGK2).
BGK7's check then compares those digests. A gap the fork cannot close keeps BGK6's conservative key for the affected compiles.
- the ImportC headers in
Isolation spike (D39): Landlock write confinement and an unshared network namespace for local build actions, with the list of test actions that write into the tree and a decision for each. The result is recorded in D39 before E3's gate.
Test actions with declared runtime inputs, no reuse, and the test runner taking its import paths, string import paths, dflags, versions and probe directory as arguments, never calling dub (BGX1–BGX2). This includes making
sparkles.base.source_uriwork with root-relative__FILE_FULL_PATH__.
Gate:
- The LDC fork's tests pass in the toolchain the flake pins.
- Oracles 2–5, 7, 9, 10 and 16–19, steps 1–2 of oracle 11, oracle 13's execution-time scenario, oracle 8's revert check and oracle 24's store step pass through the test-only driver. Oracle 3 includes its write check.
- Oracle 21 passes over a replay of at least the last 50 commits of
mainand a seeded run of its edit sequences. - Oracle 4's mid-compile scenarios (step 5) pass, before the store is shared by more than the test-only driver.
- A second run of the driver in another worktree, with no source change, compiles nothing.
- An edit to one
sparkles:basemodule recompiles only the variants whose manifests contain it.
Progress, by the gate's items:
- Execution:
build_graph/execute.druns an action graph on the task-DAG executor with BGA4's complete environment (TMPDIRthe action's own), its tools by absolute path, the root mapped to.(BGA5) and the compiler's own tree to/ldc(BGA11). A library's LDC compile writes its archive (-lib), byte-identical across run directories. Tests run in the root with the runner's arguments and never call dub (BGX1, oracle 11 step 1). - Generators:
dmd'sconfig.d(D60) and the shader compiler (shader build SHP11) are typed generators built by the graph; the shader compiler is keyed on its import roots (BGG5). - The store (
build_graph/store.d): declared keys with consumed outputs by digest, manifests from the fork's dependency output (BGK2,7bee3fbdeb), conservative keys without it and for ImportC compiles (BGK6), library search keys (BGK9), reads outside the declared roots failing (BGK8), a digest cache (BGK5), publication by rename with leases and adoption of a winner (BGS2–BGS4), eviction with digest records (BGS5), verification, removal and inspection throughplan-graph --cache-op(BGS6, BGS7), miss explanations (BGS8) and the determinism check (BGS9). The toolchain identity is the tools' store-path closure (BGT1, BGT2). - Registry sources without Nix (BGR4):
plan-graph --fetch-sourcesbuilds and tests from a fetched tree equal to Nix's. - Isolation (D39): builds and tests confined by Landlock and a network namespace at no measurable cost. Over the whole test selection, no test writes into the tree; the one that writes elsewhere,
dmd-lsp's through its declared dub, may write beneathDUB_HOME. - The LDC fork: its lit tests, the dependency output's among them, pass in the toolchain the flake pins (dlang.nix's
toolchain-ldc, built through this flake's lock). - Gate checks so far: a second run in another worktree compiles nothing; an edit to one
sparkles:basemodule recompiles exactly the compiles whose manifests list it; oracle 3 passes forbuild-primitivesandui-app(--trace-compiles), and its mutation scenarios pass. The test-only driverapps/ci/tools/graph-oracles.druns the oracles on fixture packages and prints a verdict per step. Oracles 2 (its falsifying scenarios, and every package's test root againstdub test), 4, 5, 7, 8's revert check, 9, 10, 11 steps 1–2, 13, 16–19, 21 (its edit sequences, its revert check, and the replay of the last 50 commits ofmainforversionsandbuild-graph) and 24 pass, on this repository's development hosts, but for the steps no host here can stage: oracle 4's two clock steps (a file system whose clock is set apart) and oracle 16 step 6 (a power cut between a rename and the next write). Oracle 7 requires its races to have been reached, and they are: on one run, 50 of 2,636 verifications began with a publication in flight. The oracles found, and these commits fix: manifests never pruned, a generator's tool planned for its reader's platform, a compile without the prefix map sharing a key across worktrees, the test runner in every build action's key, materialized producers not counted as executed, no sampled rehash of hits (BGS6), anddmd-lsp's tests calling dub, which a test may now declare (D62).
The gate is met. The two steps above are gaps until a NixOS VM test stages them, a follow-up of its own: oracle 4's clock steps against an NFS server whose clock is set apart, and oracle 16 step 6 by replaying a dm-log-writes log of a build's writes to every flush point. Oracle 5 step 5 runs since the examples build on the graph (E7).
Follow-up, after the gate: ci commits build-each through the graph. At each commit of the range it plans the packages it builds, their application configurations included (hue, ui-gallery and diagram with their GUI arms), and executes them against the shared store, so a commit compiles only the actions whose keys it changes: an unchanged package and closure cost a plan and the lookups, and a change no compile reads costs nothing more. A package whose recipe the graph cannot model builds with dub, and the report names it. It is the store's heaviest user, so it waits for oracles 4 and 7, and it replaces no gate item.
Delivered as ci task-DAG CIC21: every commit of the range is one part of a single run (runActionsAcross), each in its own worktree, and an action predicted to share its key with the previous commit's waits for it and hits. Since E5 it builds the WebAssembly modules on the graph too, for each host the toolchain table lists.
Follow-up: the key audit. Oracle 9's key audit lists every input of each action kind, of toolchain identity, of plan reuse and of the whole-run record, with where its key covers it and the test that changes it alone. It found inputs no key covered, each now covered: a library's bytes outside the Nix store and the linker's static, exact-name and Darwin candidates (BGK9), the files arguments name (version scripts, $ROOT/ operands, files outside the worktree; BGK1), with the forms whose inputs no key can establish (response files, linker scripts, the C driver's options but an allow-list) left unkeyed, a generator's environment (BGK1), an in-process generator's code (BGT1), the C include roots' other spellings and links beneath a root, and roots outside the worktree and the store, which leave a compile without a key (BGK2, BGK6); the audit lists what remains. A coverage build instruments the repository's packages only (ci CIC7).
Oracle 17 step 9 runs the store's odd states, each a miss or ignored. A result whose record is missing, malformed, cut short or another key's, or of another kind, now moves to trash/ and is published again, where it was missed on every run (BGS6); records end with an end line (format 3), in store layout 5.
E4: The Nix backend
- Content-addressed source inputs, and derivations created without evaluation (BGN1–BGN4), with BGN2's constrained narrowing.
- Diagnostics in outputs, garbage-collector roots, and infrastructure failures kept apart from action failures (BGN6–BGN8).
- Remote builders from
/etc/nix/machines. - Sandboxed test actions whose results may be reused, recording the machine they ran on (BGX3).
- Shared verdicts for reusable test results (BGX4).
Gate:
- Oracles 6, 12 and 22, and step 3 of oracle 11, pass for the repository's test roots on x86_64-linux, with one remote builder of another system type.
- Measurements: the per-derivation overhead with the sandbox on, the number of derivations, the bytes staged, and the edit loop's time against the local backend's are measured and recorded. They are D2's revisit measurement. Their definitions belong to the build-primitives observability specification (
docs/specs/build-primitives/observability/), which this plan does not restate.
E5: Cross-compilation
The graph builds a request for any host platform its toolchain table names (SPEC §8.1), in the vocabulary of nixpkgs' cross-compilation: build and host platforms named by config, a host per request, a generator's tool built for the build platform, and native compilation as the case where the two agree.
- Platforms (BGH1): the platform record, derived from its
config: thesystemdouble, the compiler's triple, dub's identifiers, and whether the build platform executes the host's programs. - The toolchain table (BGH4):
SPARKLES_TOOLCHAINS, exported by the dev shells from the flake'spkgsCrossand dlang-nix packages, with entries for the build platform,wasm32-unknown-wasip1,wasm32-unknown-wasip2and Android on aarch64 and x86_64. It replaces finding the toolchain onPATHand$SPARKLES_WASI_LDC. - Planning (BGH2, BGH3, BGH6): a host per request, libraries on the dependent's host, generator tools on the build platform,
libsthrough the host entry'spkg-config, and refusals that name what is missing. - Lowering and keys (BGH5, BGH7): the host's triple, archiver and link driver per action; each key over its own toolchain. Every stored result misses once.
- Tests (BGH8): skipped when the build platform cannot execute the host's programs; no emulator runs yet.
- Callers:
--hostforci test --build-onlyandci commits build-each; the WebAssembly modules and their previews listed bynix/packages/wasm-modules.nix, so build-each builds them on the graph and dub only what planning refuses.
Gate:
- One plan holds a WebAssembly variant and the build-platform variant of the generator tool it reads; their keys differ by host; a host without an entry, and a WebAssembly recipe needing a library its entry lacks, are refused with the reason named.
- The four modules build for
wasm32-unknown-wasip1, and the three that import no host function of the Nix evaluator (all butdub-manifest-nix-wasm) forwasm32-unknown-wasip2, and each validates (wasm-tools validate; a component for wasip2, TCW6). hue's andterminal's Android libraries link for aarch64 and x86_64 from theirandroidconfigurations, and export the same dynamic symbols as the Nix packages' dub builds of them (buildSparklesAndroidLib).ci commits build-eachover a range builds the modules on the graph, and a second run reuses every action.
Done: every gate bullet holds on x86_64-linux (2026-11-30). BGH8, the skip a host's tests report, is deferred, and no gate bullet names it: --host needs --build-only (cli.TestCommand.conflict), so no test of another host is planned, and none can pass in place of a skip.
- One plan, its refusals:
build_graph.actions.planActions.hostPlatformplans a WebAssembly request with the generator its library reads: the request's actions on the host's compiler, triple and archiver under the host's toolchain identity, the generator's tool on the build platform's;build_graph.variants.hostPlatformskeeps the two WASI previews' variant keys apart, and refuses a host without a toolchain (no toolchain) and a library its host's entry cannot resolve (namingfreetype2and the host);build_graph.platforms.parseToolchainTable.refusalscovers a malformed table. Throughci,ci test --build-onlyrefuses--host wasm32-unknown-wasip3, naming the hosts the table has, andnix-evalforwasm32-unknown-wasip1, naming the six Nix libraries the host's toolchain cannot resolve; an Android plan of hue holds the shader compiler for the build platform beside the host's variants. - The modules:
ci commits build-each, given the four modules by--packages, plans every one on the graph over two commits, dub building none: 37 compiles and 7 links.wasm-tools validate(1.239) passes all seven: the four wasip1 modules, and the three wasip2 ones, which are components. - Android:
ci test --build-only -b checked --from hue --from terminal, with--hostnamingaarch64-unknown-linux-androidandx86_64-unknown-linux-androidand the Android toolchain table, links all four libraries;-bbuilds themchecked, as the Nix packages do (thedebugbuild that--hostbuilds without it differs from them by some 7 % of the D symbols). Each needs the same system libraries aslibhue-androidandlibterminal-android, and exports exactly their dynamic symbols: hue 28,228 on x86_64 and 27,596 on arm64, terminal 27,799 and 27,166. The graph maps the worktree to.in source paths (--ffile-prefix-map, so a result does not depend on where the worktree is), andbuildSparklesAndroidLibmaps its source root the same way: with absolute paths,prettyprint's type-name links resolve at compile time, and with relative ones at run time throughsparkles.base.source_uri, which then links that module in; terminal's Nix library exported 29 symbols fewer before..#hue-apkand.#terminal-apkbuild with the mapped libraries. The Android shell (.#android) has neithercinor the shader compiler's LDC, so the graph's Android builds run in the default shell withSPARKLES_TOOLCHAINSset to thetoolchainTableAndroidpackage. - Reuse: a second
ci commits build-eachover the same range executed nothing: each commit's 37 compiles and 7 links were reused, in 74 ms.
E6: A warm run in 100–200 ms
A warm ci test --build-only of every package, all 406 actions served by the store, takes as long as the work it skips is small: the target is 100–200 ms on a 32-core host, the time of a no-op ninja. Measured on pc2-local (32 cores) with the LDC fork's --makedeps-probes, before this milestone:
| Phase | Wall time |
|---|---|
planning (planRepository: recipes, lint, variants) | 15.5 s |
| the graph run: 406 lookups, all hits | 11.0 s |
| total | 27.0 s |
ci's own CPU over such a run was 104 s against its children's 2 s: 44 % of its samples spin in sched_yield, 12 % on the GC's lock.
Stages, each measured as it lands:
Quick wins. Each recipe text parsed once per process, not once per request; each archive's
pragma(lib)names read once per run, not by every link above it;readBytessized from the file and left unzeroed; a lease's recency written without an fsync (D38: recency only orders eviction). The run 11.0 s → 3.8 s, the total 27.0 s → 17.0 s.Plan reuse (BGP2).
ci testkeeps each request's plan with its read set beside the store and takes it while every entry holds: a file by its identity, unread, on the device of the cache's clock; a probe, listing or link made again; a variable read; apkg-configquery unasked while all it searches lies in the Nix store, else asked again. A warm run 17.1 s → 4.4 s: 2,680 entries checked and no file read, the kept plan 11.7 MB of JSON; the graph run is 3.7 s of it. A test leg's-tis bound by the run (BGA8), so the host's load is no part of the request, and the first run on a fresh cache keeps its plan too: the warm--build-onlyright after a cold one 10.4 s → 2.2 s, and so at 24, 19 and 11 workers (the last under forced load) and at--jobs 5, one plan throughout (8.7 s of planning each before).--build-onlybuilds the-covattemptsci testruns, so theci testafter it takes that plan and executes no build action: 188 compiles and 85 links (105 s) and a 10.6 s plan → none. A warm--build-onlyso looks up 593 actions, not 406: 1.5 s of its 2.2 s.The run's cost per hit. What each of the 406 lookups still costs: the lease, the manifest check, linking the outputs into the run directory, the preimage, and the run's records. Listings validated parent first through kept handles, a missing directory answered by its parent's listing, and each archive's
pragma(lib)names kept in its result's record: the run 3.7 s → 2.3 s, a warm total of 3.1 s (2.1 s and 2.7 s before the review fixes, which made the listings sound; the 0.2 s is not yet attributed).No spinning. The event loop's idle workers park on a futex instead of yielding in a loop (
raw_pool.d,job_queue.d).Less allocation. The GC's lock stops being contended: the hot paths allocate once per run, or per thread.
Optionally, a resident process. Below 100 ms needs no planning and no lookups at all: a process that keeps the plan and the store's answers between runs and learns what changed from the file system's events (the fileset workspace's watch).
Admission that keeps the host busy (beside the warm path: the cold build and the test phase). Ready nodes by the longest chain of predicted durations, backfilling with a bounded reservation (task-DAG TDM8, T17); each test leg claiming and running the threads its last run used (ci CIC11, T18); a compile weighing one token; cold memory defaults at a high percentile (CIC23). On pc2-local, one run each:
Run Before After cold ci test --build-only121.4 s 112.9–113.6 s the same, the store empty, timings kept — 106.3–116.3 s cold --build-onlyin a 25 GiB scope230.1 s 139.8–146.5 s ci test's test phase, warm306.7 s 96.9–155.9 s ci testright after--build-only416.4 s 296.1–310.2 s Legs now overlap (up to 8 at once, against 2), but the test phase stays above its 60–70 s floor: a leg's claim equals its threads, and legs use their threads in bursts, so the tokens fill while the CPU sits at 30–45 %. The cold build is held by the many compiles memory and SMT share, not by order: the executor model (
sim2.awk's successor, fed the runs' own durations) gives 89 s for the new policy against 142 s for the old, and the runs themselves pay ~10 s of planning and 25–45 % more compile time under contention.Then a leg's claim was parted from its threads (CIC11, T18): it claims
ceil(p)tokens, at most half the capacity, and runsceil(1.25 p) + 1threads, at least 8 after a 10 s run, under a thread budget of twice the capacity (TDM10); and the executor reports every admission decision (TDO10,ci test --trace-admission). The warm test phase over 11 runs: 79–118 s, against 97–156 s with the claim equal to the threads. The trace ties the spread to the capacity, whichhwParallelismcaps by the host's load: 79 s at 26 tokens, 84 s at 20, 95 s at 16, 108 s at 13. In each, the head waits on tokens or the thread budget 95–100 % of the time; the floor is wired's 59 s leg and the CPU the other legs need. A cold--build-only, which now builds the coverage variants too (329 compiles), waits on the memory budget (45–65 % of the time: test roots' 4 GiB defaults) and on the memory-pressure hold (31–53 %).A run that reports itself (ci CIC28, CIC29; task-DAG TDO11). The live view's admission line, a
Plannedline before the run, and a summary after it, kept assummary.json: phases, executed and reused actions by kind, the critical path, the slowest actions, the admission waits by reason, the disks' change and the memory peak. On pc2-local, a fully warmci test --build-onlyover one cache, the two binaries alternating, 12 runs each: 1.955–2.058 s (median 1.99 s) without it, 1.923–2.014 s (median 1.97 s) with it; an earlier round of 8 each, 1.96–2.07 s against 1.98–2.10 s. No change beyond the runs' spread. Its phases on that run: startup 43–67 ms, toolchain 94–103 ms, the kept plan's check 227–233 ms, preparing 119 ms, the run 1.5 s, the store's end 11 ms. A warm run's summary shows what the 1.5 s still holds: no action executes, yet the head waits on memory 79 % of the time and on tokens 19 %, with the tasks charged 35.1 GiB of the 35.2 GiB budget at once (the scope's real peak: 283 MiB), because each lookup is admitted with the claim of the action it may run.Work once per run, not once per hit. On pc2-local, a fully warm
ci test --build-onlyover one cache, 6–7 runs per commit, medians:Commit Wall before 1.97 s each probe block, each lookup under a root and each directory once (BGK2) 1.20 s arguments and preimages copied by span, actions by index 1.04 s a hit makes no measure/directory and its link's parents once0.99 s a store toolchain's identity kept (BGT5) 0.91 s the kept plan read without validating its text 0.89 s large mallocblocks kept in the heap0.86 s the kept plan in a binary form 0.83 s The phases after: startup 50–70 ms, toolchain 0.3 ms (100 ms), the kept plan's check 160 ms (225 ms), preparing 33 ms (120 ms), the run 0.49–0.59 s (1.4 s), the store's end 20 ms. The probe blocks had been most of the run (800 ms): 331 manifests share 164 blocks, and each expanded into every absent candidate. What the run still costs per hit, though nothing changed: the preimage (84 ms in all), the manifest list and its check (108 ms),
Store.find(101 ms, of it the lease and recency 48 ms and BGS6's sample 23 ms on average) and the link (61 ms). The next stages: one lease journal per run instead of a lease and a recency file per hit, and a run whose every input holds by identity taking the last all-hit run's result keys without deriving them.A run with nothing changed decides once. On pc2-local, a fully warm
ci test --build-onlyover one cache, one pass, 7 runs per commit, medians:Commit Wall before 0.847 s the whole-run record (BGS12): every fact checked, no key or lookup 0.605 s a lease is a line in the run's journal (layout 4) 0.492 s the record's facts on threads, its sample and links beside the run 0.424 s no eviction scan after a run that published nothing 0.378 s a reused task's trace row drawn only when shown 0.355 s the kept plan's read set checked on threads 0.314 s the reviews' fixes (facts by entries' kinds, journals by generation) 0.298 s the recipes read for test legs only 0.283 s the files a lookup parses checked by their bytes; full-disk leases 0.295 s The record holds the 593 results and the 4.7k facts their keys and lookups rested on; a run that finds every one holding links each action to its result: 15 ms in all, 10 of it the links. The phases at the last commit: startup 51–68 ms, toolchain 0.4 ms, the kept plan's check 106–149 ms, preparing 19–20 ms, the run 63–87 ms, the store's end 0.1 ms.
ci testright after--build-onlyruns no compile or link, and its test phase, the two binaries alternating, is unchanged (base 87.4 s and 92.6 s, after 92.1 s and 95.7 s;wired's leg, 1.2–1.3 min, the critical path in every run).What is left, toward 200 ms (no resident process): the startup's transient scope (about 45 ms of 60: the
systemd-runprobe, itself a scope, and the re-execution into one; the probe could be remembered per user session); the kept plan's check (decode about 20 ms, then its 208 listings, each a fileset resolution, and 2,083 file identities, now on threads: a listing could be checked by the identities of the directories it walked instead, and the resolver's storage, zero-filled per listing, reused); preparing the nodes (executionNodes, about 19 ms); and the executor's own cost per task (events, the summary's observer) in the run phase, about 40 ms. Themalloptthresholds stay: the listings still allocate their storage per resolution.The kept plan held by its directories, the scope asked for in process. On pc2-local, a fully warm
ci test --build-onlyover one cache, 7 runs per commit, medians (the second column the same binaries alternating, run for run, where measured):Commit Wall Alternating before 0.298 s 0.303 s the scope asked of the user manager in process (CIC22) 0.298 s 0.291 s a kept plan's listings held by their directories' identities (BGP2) 0.207 s each checking thread's files identified in one pass 0.200 s packages named from the root recipe alone; the tree's top without git 0.174 s the resolver's arenas mapped afresh 0.174 s 0.175 s the malloptthresholds dropped0.178 s 0.170 s the reviews' fixes 0.179 s 0.175 s a run's fibers made as it spawns them 0.170 s 0.162 s the second review's fixes (the scope ends only on the manager's word) 0.178 s 0.179 s A kept plan holds, for each listing, the directories it listed and the way down to it, with their identities; a warm run checks them in one pass and lists again only what a directory changed under (on pc2, 195 of 208 listings held, the rest meet a link). The startup's scope is one request to the user manager over its own socket, its process named as the sender; the
systemd-runprobe and the re-execution remain the fallback. Dropping themalloptthresholds alone cost 20 ms (the listings still walked faulted their storage in afresh); with the resolver's arenas mapped and committed only as written, it costs nothing. The phases at the last commit: startup 26–36 ms, toolchain 0.3 ms, the kept plan's check 52–66 ms, preparing 20–21 ms, the run 45–59 ms. A warmdub test :versionsthrough the forwardingdub(E7): 0.213–0.229 s before, 0.130–0.144 s after. Planning afresh (the kept plans deleted): 10.0–10.1 s before, 9.9 s after.ci testright after--build-onlyruns no compile or link, and one changed file rebuilds the same actions with and without the whole-run record (a leaf file 2, abasefile 104).A last round of 9, the three alternating: before 0.316 s, the fibers' commit 0.170 s, the last 0.179 s.
What is left at about 175 ms, all but the last only a resident process removes: the process and its scope (startup about 30 ms, 20 of it the user manager's job, which moves the process into the new cgroup); the kept plan's bytes (read 10 ms, digest 4.5 ms, decode 4 ms, restoring the plan 6 ms), its 2.7k entries' identities on 8 threads (20–28 ms) and the directories' (2 ms); preparing the nodes (20 ms); the whole-run record's facts (15 ms) and links (11 ms); and the executor's own cost for 678 tasks, about 15 ms, with the process's exit after the summary about 15 ms.
Gate:
- Oracle
bgp2: a second request with nothing changed takes the kept plan, equal to the fresh one; an edited module, a module added to a listed directory, a path planning found absent appearing, a changed variable and a changed.pcfile outside the Nix store each plan again; the first request on a missing cache keeps its plan, and one at another capacity takes it; a dry run keeps no plan. - A warm
ci test --build-onlyof every package on pc2-local within 200 ms, its phases recorded here at each stage.
E7: dub retired
Every build, test and run the repository asks for goes through ci and the graph; dub stays only as the resolver of registry packages' recipes, a library ci reads, never a process a workflow starts. Three surfaces carry the replacement:
- The package commands.
ci build,ci testandci runtake whatdub build|test|runtakes for an in-repository package::<package>(or a path),-c <configuration>,-b <build type>,--compiler, and forrunthe arguments after--, handed to the program unchanged. Each plans that one request on the graph and executes it against the shared store, so a second invocation with nothing changed costs a warm run (E6), and its exit status is the program's own. A configuration or build type the graph cannot model is refused with the directive that blocks it, never built with dub behind the user's back. - Single-file packages. A file carrying an inline recipe (
/+ dub.sdl:or/+ dub.json:after a#!/usr/bin/env dubshebang) is a package of its own:ci run <file.d> [-- args]resolves its recipe, plans it beside the repository's packages it names bypath=, and runs it. Every runner of such files in the repository — the Markdown examples (ci examples), the standalone examples,ci docs verify, the tools underapps/ci/tools, the guideline snippets — plans them on the graph, one run for all of them, sharing their dependencies' actions. - A
dubin the development shell. The shells put adubonPATHthat forwardsbuild,testandrun(anddub run --single, and a shebang file executed directly) toci, so the commands this repository's documents and habits use keep working and build on the graph. Any other subcommand, or a request outside the repository, reaches the pinned dub unchanged.
Order: the package commands first, then single-file packages, then the forwarding dub, which waits for E6's warm path: every forwarded invocation pays ci's warm cost, so it must be within E6's bound before habits move onto it.
Gate:
- For every in-repository package, configuration and build type the repository uses,
ci build/ci testproduce the artifact and the test verdict thatdubproduces (oracles 1 and 2, dub agreement and build equivalence, extended to-cand-b), andci runpasses arguments and the exit status through. - Every single-file example in the tree runs through
ci run, andci examples verifyandci docs verifyrun no dub process (checked by tracing process creation over a full run). - Within the development shell,
dub test :base,dub run :ci -- …and a shebang example executed directly each start no dub process and hit the store on a second invocation. - No workflow, hook or Nix derivation that builds repository code starts dub, except the Nix backend's own builds until E4 replaces them.
Progress, by the gate's items (ci docs verify names ci examples verify, the Markdown runner):
- Package commands: delivered.
ci buildandci runplan one request (:<package>, a package directory or a single-file package;-c,-b,--compiler) and place its artifact where dub does;ci runpasses the arguments after--and the exit status through;ci testtakes one package,-c,-b,--compilerand runner arguments. What the graph cannot model is refused with the directive (BGG7, ci CIC24–CIC26). Oracle 1 resolves every configuration a package declares underchecked, eachunittest-*configuration as a test root and eachbench*andunittest-debugbuild type (--configured): over base, terminal, hue, ui-gallery, diagram, versions, fsx, profiling and text-lab, 83 requests and 1,793 targets with no disagreement. Oracle 2 compares-cand-bruns withdub test's over fixtures that pass only as requested (--only=2-configured-allover a representative set of the repository's requests:base -c unittest-portable,versions -b benchandterminal -c unittest-raylibagree, 1,082, 168 and 210 verdict lines), and oracle E7 drivesciitself: artifacts and their behaviour againstdub build's, a second build reusing everything, argument and exit-status passthrough with a clean standard output,ci test's command line, the refusals, and no dub process. On a development host,ci build :versionstakes 8.7 s from an empty store and 0.89 s again, every action reused. - Single-file packages: delivered for the example runners and the tools.
ci examples verify|run|updateandci examples standaloneplan every example on the graph, in one run, and an example the graph cannot plan fails with planning's reason. The comparison snippets' registry dependencies are pinned (D25, revisited), so on pc2-local a fullci examples verifypasses (exit 0) and, traced (strace -f -e trace=execve), starts 2,519 processes, none of them dub; a traced standalone run starts 704, none dub, and all 290 of its examples pass untraced (the seven LeakSanitizer ones cannot run under a tracer). A second, identicalci examples verifystarts no compile, archive or link, only the toolchain probes (--version,--help-hidden, the platform probe, the C driver's-print-file-name): every build action is a store hit; it takes 75 s, the examples' own runs. Of the 391 tracked files with a dub shebang and an inline recipe,ci buildbuilds 371; of the other 20, 19 fail underdub build --singletoo (other platforms' examples, stale tools, a deliberately broken demo, test fixtures), andcursor-shapes.dis refused because itsraylib-drange admits no locked version. The workflows runprepare-event-horizon-comparisons.dthroughci run. Oracle 5 step 5 runs: an example built twice from empty stores gives every compile the same result key. - The forwarding
dub: delivered; E6's bound still open. ThemkSparklesShellshells'dub(default, full, ci, ui-research; the Android and Win32 cross shells keep the pinned dub) isapps/dub-forward(ci CIC30):dub build|test|runof a package of a sparkles checkout,dub run --singleand a shebang file run directly are exec'd asci build|test|run; any other subcommand, help, a request outside a checkout or naming a package dub resolves itself, and, after a notice, a request asking for whatcidoes not model reach the pinned dub,$SPARKLES_REAL_DUB, unchanged.cisetsSPARKLES_DUB_PASSTHROUGHfor everything it starts, so nothing below it is forwarded back. On a development host,dub test :base(1,085 passed, 4 skipped),dub test :base -- -i Buffer(80),dub --root <another worktree> test :versions(167),dub build :twoslash-extract -b checked,dub run :fsx -- --help,dub run --single build-mode-probe.dand the shebangtooltip-timing.dgive dub's verdicts, exit statuses and program output,dub run :versionsis refused as dub refuses it (a library, exit 2), anddub describe :baseis dub's, byte for byte. Traced (strace -f -e trace=execve),dub test :base,dub run :ci -- --helpand the shebang example start no pinned dub, and a second run of each starts no compile or link (their summaries: compile 0 ran, link 0 ran). A warmdub test :versionstakes 0.24 to 0.27 s, a warmci test :versions --no-coverage0.23 to 0.26 s, five runs each: the forwarding costs one exec. Forwarding waits on E6's bound: the warm run it pays is above the 200 ms E6 sets. A Markdown fence with a/+ dub.json:recipe is an example as an SDL one is (none is tracked yet). The workflow steps in thecishell runci: the terminal's raylib arm (oracle 2) and base.sync's portable parker, litmus, fast-path and ThreadSanitizer checks, which agree with dub on a development host; the OS-API single examples'dub run --rootsteps run asci runthrough the shell'sdub(the X11 and the Wayland example agree with dub under Xvfb and a headless weston), and the gen-text-svg hook runsci run --temp-build, writing the committed SVG byte for byte. - Remaining: the requests beyond the representative set in
--only=2-configured-all; the steps on hosts with noci, which keep dub: the Windows legs (ci/test-windows.sh, the portable parker, the Win32 smoke and OS-API demos; no Nix there) and the FreeBSD VM's base.sync suite; on dub (SPARKLES_DUB_PASSTHROUGH=1 dubor$SPARKLES_REAL_DUB), the GPU read-backs, whose tests build their probes withdub run, which aci testleg does not let a test start, the cloud-environment job'sdub test :base, which checks the packagesdub add-localregistered,cursor-shapes.d(inci/run-all.shtoo), whoseraylib-drange the graph refuses, and the OS-API demo loops: the graph refuses the Wayland demos'generate.shpre-generate step (BGG7), and the X11 demos f08 to f11 include headers their recipes do not name (Xrender.h,Xge.h), which dub finds through the shell's compiler wrapper and the graph's hermetic ImportC step does not (the other 13 X11 demos agree); and the Nix backend's own builds, until E4.
Progress
| Milestone | State |
|---|---|
| E0 | done |
| E1a | superseded |
| E1 | done |
| E2 | done |
| E3 | done |
| E4 | not started |
| E5 | done |
| E6 | in progress |
| E7 | in progress |