Build graph — Decisions
Each record states its question, the alternatives, the choice and when to revisit it. Records marked accepted were accepted by the owner: D1–D17 on 2026-11-01, in a design interview to rework the apps/ci task DAG; D18–D21, the E0 spike results, on 2026-11-02; and D22–D25, from E1, on 2026-11-06. The records from D30 on answer a review of the build-systems catalog, and those marked accepted were accepted on 2026-11-06. D44, routing the graph's file access through the capability VFS, was accepted on 2026-11-07, and D56, planning's source scans on DMD's lexer and parser, and D57, pruning's scan scope, and D58, the layout lint's gate, on 2026-11-16; and D59, what planning's trace holds, and D60, a single-file generator's git, on 2026-11-17; and D61, the programs a test builds, on 2026-11-18; and D62, a test whose subject is dub, on 2026-11-19. Records marked proposed await the owner's decision.
D1: Own the build instead of isolating dub (accepted)
Question. Concurrent dub builds race, and a dub build cannot reuse another directory's compiled dependencies. Do we isolate each task, or replace the part of dub that decides what to build?
Alternatives.
- A private
DUB_HOMEand build root per task. Safe, but every dependent recompiles its whole dependency closure. - A prepared, read-only dependency snapshot shared by isolated tasks.
- Resolve recipes ourselves and run the compiler directly.
Choice. Resolve recipes ourselves. Recipes stay dub recipes, and dub remains usable for people, editors and dmd-lsp.
Revisit when dub gains path-independent build identities and content-based staleness.
D2: One graph, two backends (accepted)
Question. Who executes an action?
Alternatives.
- The local executor only, against our own store. Remote builders would then need a protocol of our own.
- Nix only: store copies and per-derivation latency on every edit.
- One graph lowered to either.
Choice. One graph, two backends, the local one first, because its keys define what each derivation contains.
Revisit when the Nix backend's per-action overhead is measured below the local backend's on the edit loop. E4's gate takes that measurement.
D3: Settings from our resolver, checked against dub (accepted)
Question. Where do resolved build settings come from?
Alternatives.
dub describeat build time: keeps dub's latency and defects in the build path.- Our resolver alone: drifts without a check.
- Our resolver, with dub as a differential oracle.
Choice. Our resolver, through sparkles.wired.sdl. dub describe and dub used as a library are the oracles.
Revisit when the oracle has had no disagreement for a release and dub's pinned version is frozen.
D4: One compile unit per package variant, with a read manifest (accepted)
Question. What is a compile unit?
Alternatives.
- One per package variant, as dub does.
- One per D module: finer reuse, but fragile under D's template-instantiation and
-allinstrules, and more total work.
Choice. One compiler invocation per variant, with its dependency output recording what it read.
Revisit when a per-module mode is measured to win on the edit loop. It would then be added as a variant option.
Open question. Whether dependents should key on generated interfaces (.di), so that a body-only edit stops at the dependency's compile, is open: D35 declines it until M12 measures the cost.
D5: Two-step keys with several manifests per declared key (accepted)
Question. How do keys reflect inputs that are known only after compiling?
Alternatives.
- Keying on whole dependency packages: any edit in
sparkles:baserebuilds every dependent. - One manifest per declared key: worktrees on different revisions evict each other's manifests.
- ccache's direct mode, with a bounded list of manifests per declared key.
Choice. The direct mode: a declared key, then a list of manifests, then result keys.
Revisit when profiling shows the manifest checks dominate lookup time.
D6: SHA-256 and the store location (accepted)
Question. Which digest, and where does the store live?
Alternatives. BLAKE3, which is faster but needs a binding; SHA-256; a store per worktree; one per machine.
Choice.
- Digest: SHA-256 for file contents and keys. Nix's flat and recursive content addressing use the same algorithm: a flat path derives from the file's SHA-256, while a recursive path needs a NAR hash over its file set, which the build graph computes itself. Store-path names and action keys are not comparable, and need not be.
- Store: one per user and machine, at
$XDG_CACHE_HOME/sparkles/build. - Publication: atomic.
- Eviction: size-bounded LRU.
Revisit when hashing shows up in profiles. BLAKE3 can then sit behind the same digest type.
D7: Test results are reused only when their inputs are known (accepted)
Question. May a passing test be skipped because an identical binary passed before?
Alternatives. Never; by default; on request.
Choice. Only when it ran in the Nix sandbox, with the kernel, CPU and system in its key, or when it declares every runtime input. Otherwise every request runs it.
Revisit when tests declare their runtime inputs throughout the repository. The planned route is to record them instead (D42).
D8: Generators are typed nodes (accepted)
Question. How do preGenerateCommands run?
Alternatives. Run the command string as dub does; model it as a typed action.
Choice. A typed generator action:
- An unknown command is an error.
- Staleness flags are dropped.
- The generator's output directory replaces the recipe's in-tree output path. This is an intentional divergence from dub, which reads the in-tree directory.
Revisit when a generator cannot declare its outputs.
D9: Nix derivations without evaluation (accepted)
Question. How does the Nix backend create derivations?
Alternatives.
- Generated Nix expressions, evaluated on every build.
- In-process evaluation through
sparkles:nix, with our ownlib.filesetprimops. - Derivations created directly.
Choice. Sources enter the store as file sets the build graph computes itself. Derivations are created with nix derivation add, content-addressed where enabled.
Later. Evaluating a description of the whole CI pipeline in-process through sparkles:nix is a separate use. It needs a primop wrapper the binding lacks.
D10: The unittest layout rule (accepted)
Question. Dependency libraries are compiled without -unittest, while the test roots that consume them import their modules with version (unittest) on. Is that safe?
Choice. Only if version (unittest) changes nothing a dependent can observe: visible declarations, aggregate members, template bodies and the bodies of functions a dependent compiles. Private, non-template helpers that only the module's unittests use are exempt. A planning lint over the parsed modules enforces this. supervise.Run and sampling.TreeSampler are already fixed; the lint's first run lists the rest, and they are fixed before it gates.
Revisit when D gains a way to compile a library's test-only declarations out of its importers.
D11: Toolchain identity off Nix (accepted)
Question. How is a toolchain identified on a host without Nix?
Alternatives. Require Nix; hash the host toolchain's files.
Choice. A store toolchain is identified by its store-path closure, wrapper scripts included. A host toolchain is identified by the digests of its compiler, configuration, runtime, C driver, libc and linker, cached by file identity.
D12: Complete dependency output in the LDC fork (accepted)
Question. LDC's --makedeps lists string imports, but not the headers its C preprocessor reads, nor the import candidates it probed and found absent. How does the manifest become complete?
Alternatives.
- Run the C preprocessor's dependency pass separately, and accept missing negative inputs.
- Key conservatively on whole import roots.
- Extend the compiler.
Choice. Extend our LDC fork:
- C headers in
--makedeps; - an opt-in output of absent candidates;
- coverage registration that honours the prefix map.
The owner directs that the fork may be changed freely to advance reproducible incremental builds. A compiler without these extensions falls back to BGK6's conservative key.
Revisit when the extensions are upstreamed, or a rebase of the fork drops them.
D13: Prune downward-inherited versions (accepted)
Question. dub passes a root's versions down to every dependency, so a root with a configuration-local version forks its whole dependency closure. How much of that does a variant key keep?
Alternatives.
- Faithful: keep every inherited version in the key; little sharing.
- Diverge: never pass configuration-level versions down, and lint against dependencies that test them.
- Pruned faithful: keep an inherited version only where a compiled or imported source mentions it.
Choice. Pruned faithful, the default. A build option selects the divergent mode instead, in which configuration-level versions and debug versions never pass down and the lint rejects a dependency that tests one; build-type options and ABI-critical flags pass down in both modes. Separately, the repository moves -checkaction=context from each configuration "unittest" into the managed unittest build type, so the flag is uniform and forks nothing.
Revisit when a version is found that affects code without being named in a version or debug condition, for example through a string mixin. That pattern exists: sparkles.base.meta.isVersion (libs/base/src/sparkles/base/meta.d:9) builds its condition in a mixin. D34 closes the hole without reversing this choice.
D14: Relocation maps the root to . (accepted)
Question. How do outputs avoid naming their worktree, given that 53 uses of __FILE_FULL_PATH__ open fixtures at run time?
Alternatives.
- Map the root to
., run test actions in their worktree's root, and makesparkles.base.source_urihandle relative paths. - Map debug information only, and key test roots on their worktree.
Choice. Map to .. It is the only choice under which a test root built in one worktree runs correctly in another. The E0 relocation spike checks all uses.
D15: No hidden source edges (accepted)
Question. libs/ui, libs/tui and libs/wsi compile or import other packages' sources through importPaths/sourcePaths without a dependency. So selection misses them, and the build graph cannot share those packages' variants.
Alternatives. Derive package edges from such paths; forbid them with a lint; both.
Choice. Forbid them, with BGR8, with no exception: D16 removes the reason the test-runner integration needed one.
- Real dependencies: the recipes gain real dependencies, such as
core-cli,input,tui,uiandwsionmath. - Test-only reaches: a reach that only a unittest configuration makes, such as
tree-sitter's tests compilingsyntax, whose dependency would close a cycle, is resolved by moving those tests into the package that can depend on both.
Open questions
None remain from E0:
- O1: which resolved fields
dub describecannot show. Resolved by D20. - O2: whether LDC removes every worktree path. Resolved by D18: it does.
- O3: whether DMD variants share across worktrees at all. Resolved by D19: they do not.
D16: The test runner's implementation is pinned and prebuilt (superseded)
Superseded by the test runner's out-of-process model: decisions TRD1 and TRD9 and requirement TRM8, in docs/specs/test-runner/. The runner runs as a separate process that test binaries talk to through the shim, so no test binary links its implementation. The pin covers only the standalone runner that plain dub test uses, and a test action's key covers the runner core inside the ci build that runs it (BGT1). The record below was accepted on 2026-11-01 and is kept as history.
Question. The test runner's implementation depends on sparkles:ui and much of the repository, while every package's tests depend on the runner. So the packages in its closure source-include it, a hidden-edge exception that hides those packages from selection and from sharing.
Alternatives.
- Keep the cycle-safe source includes.
- Build the implementation from the working tree as a separate root.
- Build it from a pinned, recent revision of
main, like a bootstrap compiler.
Choice. Build it from a pinned revision of this repository, bumped as often as needed.
- The seam: the shim talks to the implementation across an
extern(C)seam, so the shim stays an in-treesourceLibraryand links the pinned, prebuilt library. - Delivery: the flake exposes that library, and its import directory, to the dev shell and to the build graph as a toolchain component (BGT4).
- Plain dub: plain
dub testlinks the same library through the shim's recipe.
Revisit when the runner's implementation sheds its dependencies on the rest of the repository.
D17: Library targets see their own C headers (accepted)
Question. dub runs pkg-config only for executable and dynamic-library targets. Library targets with ImportC sources compiled only because the Nix dev shell's ambient NIX_CFLAGS_COMPILE put the headers on the C search path, which BGA4 forbids.
Choice. A library target's compiles also receive the --cflags of its own libs. This is a recorded divergence from dub, so oracle 1 excludes these flags from its comparison.
Revisit when dub resolves pkg-config for library targets.
D18: LDC relocates with the root mapped to . (accepted)
Question. E0 spike 1 (O2): with root-relative sources and a prefix map, do LDC's objects, archives and test binaries name no worktree, and do the repository's uses of __FILE_FULL_PATH__ still work?
Result. They name none, with the map --ffile-prefix-map=<root>=..
- Byte-identical outputs:
sparkles:base,sparkles:event-horizonandsparkles:uiwere each built as a test root with its dependency libraries, one compile per target fromdub describe, with theunittestbuild type plus-g,-covand-checkaction=context, in two worktrees at different paths. Their 12, 330 and 246 objects, archives and test binaries were byte-identical, and none contained either worktree's path. - The map's form: LDC rejects an empty replacement, so
--ffile-prefix-map=<root>/=is an error. A build that accepts it still leaves the debug information's compilation directory absolute, because the working directory has no trailing separator to match. Mapping<root>to.maps that directory too. BGA5 now says so. - The environment: the dev shell's
NIX_LDFLAGScarries-rpath <worktree>/outputs/out/lib, which puts the worktree into every test binary's run path. BGA4 already keeps it out of actions; this is the variable that breaks byte identity when it leaks. - Generated sources: dub's test main lives in its cache, under a path derived from the package's location. The spike wrote it to a root-relative path. A generated source compiled from outside the root names that directory in the outputs, so the graph writes generated sources where a map covers them.
- Running elsewhere: a test binary built in one worktree ran in the other's root. Only
sparkles.base.source_urifailed (fixed, below). Onesparkles:event-horizonsampling test failed under load and passed alone.
__FILE_FULL_PATH__. Each of the 52 uses in libs and apps (53 lines, one a comment) was classified. Then the 19 packages with a use ran dub test from their worktree's root through a compiler that adds the map. Apart from the three breaking uses below, every test passed. Each package that skipped a test skipped the same tests in an unmapped run.
| Use | Count | Mapped |
|---|---|---|
Reads a fixture, golden or corpus, or runs git/dub in the working directory | 38 | works |
| Probes for the source tree and skips without it | 7 | works (same skips) |
A tool or benchmark run with dub run, outside test actions | 4 | works only from the root |
Names the checkout to a process with another working directory (wired's conformance, shader-compile) | 2 | breaks: 1 and 21 tests |
Needs an absolute path (sparkles.base.source_uri) | 1 | breaks: base's tests fail to compile |
No test changes its working directory. terminal-view and event-horizon set one only for the children they spawn.
Choice. Keep D14's map, spelled --ffile-prefix-map=<root>=.. The three breaking uses are fixed instead of keying their variants on the root:
source_uri:resolveSourcePathkeeps a relocated build's relative path relative, andabsoluteSourcePathcompletes it with the working directory at run time. The OSC 8 hooks complete a relative compile-time location around the scheme's compile-time prefix and suffix, so they stay@nogc.- The two tests: they make the checkout's path absolute before they hand it to a process or a recipe elsewhere.
Each fix comes with a test that fails in a relocated build of the code before it. With the fixes, the test binaries of sparkles:base, sparkles:wired and sparkles:shader-compile were built in one worktree under the map and run from the other's root, and all their tests passed: 984, 275 and 35.
Revisit when LDC's map gains a form that drops the root without a ./ prefix and still maps the compilation directory.
D19: DMD variants key on the root (superseded)
Superseded by D63: the toolchain's DMD has -ffile-prefix-map, so its variants map the root as LDC's do and share across worktrees. The record below was accepted for DMD 2.112.1 and is kept as history.
Question. E0 spike 1 (O3): do relative paths alone make DMD's outputs independent of the worktree?
Result. No. DMD has no prefix map. sparkles:base with its dependencies, compiled with DMD 2.112.1 from root-relative paths in two worktrees, gave different archives each time:
- Plain, and with
-cov: the one__FILE_FULL_PATH__default argument (source_uri) embeds the absolute path. - With
-g: every object's compilation directory is the absolute working directory, 7,090 occurrences in that archive.
The unittest and checked build types both turn debug information on.
Choice. Every DMD variant takes BGA5's fallback: the repository root's absolute path is part of its key. DMD variants share within a worktree, never across worktrees.
Revisit when DMD gains a prefix map for debug information and __FILE_FULL_PATH__.
D20: dub's final step is the oracle's second source (accepted)
Question. E0 spike 3 (O1): which resolved fields does dub describe not show, and can the pinned dub be linked to obtain them?
Result.
- What
dub describecovers: each target's build settings as dub's generator leaves them, after per-package settings, version inheritance, sourceLibrary merging and the build type. That covers:- source files, and import, C import and string import paths;
- versions, debug versions, dflags, lflags, and libs by name;
- build options and requirements;
- each package's configuration, and the target's type and name.
- What it cannot show: everything the compiler's
prepareBuildSettingsandsetTargetcompute after that point:- the
pkg-config --libsand--cflagsresults: the-L/-llink flags and the-PC preprocessor flags; - that a library target drops its
libs(D17); - the flags that build options and versions become;
- the target flags (
-lib -oq -cleanup-obj,-of); -relocation-model=pic,-vcolumns, and the compiler's environment;- the dependency libraries added to an executable's link;
- command-line build options other than
lowmem.
- the
- The pinned dub as a library: it links from source:
- the source is the flake's
dub-sdl-srcinput, at the revision the dev shell'sdubis built from; - it is compiled with
-i, andDubUseCurlset so that it compiles; nothing is downloaded.
- the source is the flake's
- The probe:
apps/ci/tools/dub-resolve-probe.dresolves a package offline through aProjectGeneratorsubclass and applies dub's own final step to every target. It setsGeneratorSettings.cacheitself, because dub keeps its cache path package-private.
Choice. Oracle 1 compares fields before library resolution with dub describe, and the rest with that final step called as a library. The flake's dub-sdl-src input and the dev shell's dub are bumped together.
Revisit when dub describe reports compiler-ready settings.
D21: BGR2's supported set is the scanned vocabulary (accepted)
Question. E0 spike 4: which directives, attributes, forms and variable references do the recipes in scope use?
Result. apps/ci/tools/scan-recipe-vocabulary.d scanned 556 recipes, and every one parsed, under the sdlDubRecipe profile or as JSON:
- the root
dub.sdland its 63 sub-packages; - the 8 packages the two DUB locks pin, with their 11 sub-packages, from the flake's
dub-sources; - the 289 single-file examples
ci examples standaloneruns; - the 184 single-file programs in tracked Markdown fences.
The vocabulary is in testing.md.
Used beyond BGR2's list:
preGenerateCommands: in-repo inside configurations, and in the registry's dmd sub-packages;mainSourceFile,debugVersionsandbuildRequirements;buildOptionsvalues,betterCamong them;targetType "none"and"dynamicLibrary";toolchainRequirementswithdubandfrontend;- configuration-level
platforms; - version ranges;
- a comma-separated platform specifier (
linux,freebsd).
Not used, of BGR2's list:
dependency'soptionalanddefaultattributes;- the variables
$ROOT_PACKAGE_DIR,$<NAME>_PACKAGE_DIR,$PLATFORM,$PLATFORM_POSIXand$BUILD_TYPE.
They stay supported, as dub defines them, but only oracle 1's fixtures exercise them.
Environment: one recipe names an environment variable:
$SPARKLES_ANDROID_MIN_SDK, insparkles:android's dflags.Globs: they appear only in
excludedSourceFiles.
Choice. BGR2's supported set is the table, plus BGR2's named items.
Revisit when a recipe in scope adopts a directive the table lacks: rerun the scan, and BGR2's resolution error names it first.
D22: Resolved paths are normalized (accepted)
Question. dub joins a recipe's relative path to its package directory and keeps the result as written, so libs/x/../y/src and libs/y/src are two entries of an import path list. Does the resolver reproduce the spelling?
Alternatives. Keep dub's spellings; normalize every path the resolver joins.
Choice. Normalize. A spelling is no input of a compile, and relocation (D14) needs one spelling per directory. A list then holds the directory once, where dub may hold it twice: oracle 1 accepts exactly that difference, a resolver list equal to dub's with its repeats removed.
Revisit when a compiler is found to treat two spellings of one directory differently.
D23: Behaviour copied from dub (accepted)
Question. Oracle 1's independence holds only where the resolver is not a copy of dub. Which parts are copies?
Result. These follow dub's source at the pinned revision, so a defect there is shared:
- the build-setting merge rules (
BuildSettings.add…), the option tables andextractBuildOptionsof DMD and LDC, andenforceBuildRequirements; getPlatformSettingsandcollectFiles,fillWithDefaults, andgetBuildSettings;- configuration selection (
getPackageConfigs) and the topological order; configurePackages,mergeFromDependent,mergeFromDependencyandfilterABICriticalFlags, the build types (addBuildTypeSettings), andaddTestRunnerConfiguration;processVars,getVariableandexpandVars;resolveLibsandapplyPkgConfigCFlags(but see D45);matchesSpecification,VersionRange.fromStringand its version bumps, andcheckPlatform.
They include dub's quirks, kept so that the two agree:
- a platform-qualified setting's groups apply in D associative-array order, which the resolver reproduces by grouping into the same kind of array;
- a configuration's
targetTypereplaces the top level's even when the configuration states none; dependency'splatformattribute and the top-levelplatformsare ignored by resolution (cistill reads the latter to skip an example);- a comma-separated platform specifier (
linux,freebsd) matches no platform; - a source path naming a variable lists no files.
Choice. Keep the copies, and test each through oracle 1's fixtures and the resolver's own unit tests, which state the expected result independently of dub's code.
Revisit when a disagreement traces to one of these copies.
D24: A test reads a specification through a link (accepted)
Question. sparkles:ui-app's unittest configuration string-imported docs/specs/ui-app/resilience.md through stringImportPaths "../../docs/specs/ui-app", so that its tests check the scenarios the specification lists. That directory belongs to no sub-package. BGR8 reports the reach. How does a test read a specification?
Alternatives.
- A link in the package:
libs/ui-app/spec/resilience.mdis a committed relative symlink to the catalog, and the configuration importsspec. - A specification package:
docs/specs/ui-app/dub.sdldeclares asourceLibrarythat owns the directory, and the unittest configuration depends on it. - Move the catalog into
libs/ui-app/and include it from the specification page.
Choice. A link in the package, which the owner preferred, because the catalog stays where the specifications live. Each of its consequences was checked:
- The resolver and BGR8: paths are normalized lexically (D22), so
specis inside the package, and oracle 13 reports nothing forui-app. oracle 1 agrees with dub on the request. - dub: it follows the link.
resilience.catalogMatchesTheSuitereads the catalog through it and passes. - Nix: the flake's source keeps the link as a symlink, and it resolves inside the copied tree.
- Windows: without
core.symlinks, Git checks the link out as a text file that holds the target path. ui-app's suite is not in the Windows leg (ci/test-windows.sh), and the tree already holds two such links. - The docs build: the catalog has not moved, so the page is unchanged.
The specification package was rejected: ci test names a sub-package after its directory, so a package in docs/specs/ui-app would run as ui-app a second time, and a source library with no sources cannot be the root of dub test.
The link has one known limit: package selection maps an edit by its path, so an edit to the catalog itself selects no package, as before.
Revisit when ui-app's suite joins the Windows leg, or selection learns to map a link's target to the package that holds the link.
The second condition is met: selection records a link's target as claimed by every input set that holds the link (BGW11 of the fileset-native workspace), so an edit to the catalog selects ui-app's tests. The choice stands; the Windows condition remains.
D25: The migration comparison snippets (accepted)
Question. ci examples standalone runs docs/libs/event-horizon/tutorial/snippets/, 70 of whose programs depend on other event loops: vibe-core, eventcore, libasync and Photon from the registry, and Collie, Kiss and Hunt by path into snippets/.deps/, which apps/ci/tools/prepare-event-horizon-comparisons.d clones and patches before the run. Neither DUB lock pins any of them, so BGR4 makes each a resolution error, and dub, offline, cannot resolve them either. Oracle 1 counts the 70 as refused by both. Are they in scope?
Alternatives.
- Pin them: add the registry packages and their dependencies to
nix/ci-dub-lock.json, and the three patched checkouts to the flake as pinned, patched sources, so that the resolver and an offline dub resolve them. - Leave them out of scope: BGR6's single-file packages are those whose dependencies the locks pin; the comparison suite keeps running through dub, online, until it is pinned.
Choice. Leave them out of scope for E1, and pin them when ci examples standalone moves onto the build graph. They compare other libraries' behaviour; none is a dependency of this repository's packages.
Revisit when ci examples standalone moves onto the build graph, or a comparison snippet's dependency becomes a dependency of a package in scope.
Revisited (E7). The example runners moved onto the build graph. The registry packages and their dependencies are pinned in nix/ci-dub-lock.json (vibe-core 2.14.0 with eventcore 0.9.39, the version the eventcore snippets name, which vibe-core's range admits). Collie, Kiss and Hunt stay the clones the preparation tool makes, read as the path dependencies the snippets name; a path dependency its dependent states at its top level stands for its package below that dependent, as dub selects it (BGR4), so Hunt-net's and Collie's version ranges reach the clones.
D30: Deterministic build failures are cached (accepted)
Question. BGA7 replays an action's diagnostics on a hit. Is a failing action's result published at all, and which failures count?
Alternatives.
- Publish only successes. Simple, and an edit changes the key anyway.
- Publish every action that exited on its own, tests included.
- Publish compile, archive and link actions that exited on their own, with any status; never a test; never an action ended from outside.
Evidence. sbt stores a CachedCompileFailure (sbt). moon reuses only results that exited zero and refuses one with missing outputs (moon). Rattle discards the failures of speculative commands (rattle).
Choice. The third (BGA9). A compile, archive or link that exits with a non-zero status is published, and a hit replays its diagnostics and exit status: a broken worktree switched back and forth, or a second worktree at the same broken revision, does not recompile the failure. A test failure is never published. Nothing is published after a signal, a timeout or a cancellation, because the cause is outside the key.
Trade-offs. A failure's manifest is what the compiler read before it stopped, which is all its diagnostics can depend on. A compiler that writes no dependency output on failure keys it conservatively (BGK6).
Revisit when a replayed failure is found that a cold build of the same key does not reproduce.
D31: A source edited during a compile (accepted)
Question. A manifest digests each file after the compiler has read it. If an editor saves a module while a 30–60 s compile runs, the manifest pairs the new digest with object code built from the old content, and every worktree reuses that result until it is evicted. How is the edit detected, and what happens to the result?
Alternatives.
- (a) Check, and don't publish. Record the inputs' state before the compile, check it after, and on a conflict use the outputs for this run without publishing them.
- (b) Rerun until stable. Run the action again until a run sees no change.
- (c) Snapshot first. Ingest the inputs into content-addressed storage, hashing while copying, and compile from a view materialized from it. D's read set is unknown before the compile, so this stages whole import roots.
Evidence. A survey of eighteen tools, read in their sources, sorts them into families:
- Hash before, check after, refuse to publish: Bazel's
--guard_against_concurrent_changescompares a stat proxy (ctime, mtime, inode) after execution, rehashes when only ctime changed, and skips the upload while keeping the outputs. Its local action cache has no such check, which a revert of the edit can exploit. ccache refuses to store when an input's times are within 100 ms of the invocation's wall-clock start, which leaves a window of that size plus the clock's granularity. - Start time on the file system's clock: Ninja records the time of a file written when the command starts, and Zig stats a freshly written probe file (ninja).
- Hash after: Rattle hashes reads after the command, so an ordinary edit, with no revert, leaves a stale result that the next run treats as fresh (rattle). A manifest built from the compiler's dependency output, digested afterwards, is in this family.
- The reader reports its digests: rustc emits the checksums of the bytes it read for Cargo's
-Z checksum-freshness, which makes the record consistent by construction. - Snapshot first: Nix builds, Pants and BuildKit read only an ingested snapshot, and are safe where ingest hashes in the same pass as the copy (pants, buildkit).
- No guard: Turborepo, Nx, Gradle, Buck2 and BuildXL can store, and some push, a result under a key that does not describe what the step read (buck2, buildxl).
Choice. (a), as BGK7 states, with (c) as the precondition for sharing (BGS11):
- Before: a stat proxy and digest for every file the previous manifest predicts, and a start time from a probe file on the file system's clock.
- After: a changed proxy of a predicted file is a conflict, after a rehash when only ctime changed; a newly read file with a time at or after the probe is a conflict.
- On a conflict: the outputs serve this run, and nothing reaches the local or any other store, so the next run redoes the action. This is Bazel's guard, extended to the local store.
- Compiler digests: the LDC fork's dependency output gains a digest of the bytes read per file (BGK2), which turns the check into a consistency check.
- No rerun loop: rerunning until stable livelocks under an editor's autosave. A watch mode may rerun once.
- Sharing: a result reaches a shared or remote cache only if it was built from a snapshot. The Nix backend's staged store paths are one.
Trade-offs. An edit that keeps a file's size within one timestamp tick escapes the stat check; compiler-reported digests and snapshots close it. A conflicting run pays for one uncached compile in the next run.
Revisit when the local backend gains a remote cache, which then needs snapshot ingest (BGS11), or when compiling from a snapshot is measured cheap enough to use locally too.
D32: Nix input narrowing is kept, constrained (accepted)
Question. BGN2 lets the Nix backend narrow a compile's inputs to a manifest the local store holds. D searches import roots in order, so a file created earlier on the search path shadows the module the manifest resolved instead of failing. A narrowed build that omits it succeeds with the wrong module, and nothing triggers BGN2's retry. Keep narrowing, constrain it, or drop it?
Alternatives.
- Drop narrowing: every compile derivation takes its whole roots.
- Keep it as written.
- Keep it, constrained.
Evidence. nix-ninja's argument for narrowing is that "the failure mode is a sandbox compile error, not a wrong cache hit" (nix-ninja), which ordered search paths break. A discovery record must hold "every input the consumer will read, including absent-path probes and environment/toolchain facts" (dynamic-deps-distributed). nixception chose "a stable, less precise key over a context-dependent, more precise one" for a shared cache (nixception).
Choice. Keep it, constrained (BGN2): narrow only while every absent candidate of the manifest is still absent; require the narrowed build's dependency output to list only files among its inputs, and only absent candidates that the full roots lack too, or rerun with the full roots; never push a narrowed derivation to a shared store. The second half of the check is the one that can fail: inside the sandbox nothing outside the inputs exists to be read, but a probe can find absent a module the full roots hold.
Trade-offs. A narrowed derivation's identity depends on the local store's history, so it is a local accelerator only. Remote builders and binary caches see full-root derivations.
Revisit when E4 measures how often narrowing applies and what it saves.
D33: Sandboxed tests record the machine they ran on (accepted)
Question. As first written, BGX3 let a sandboxed test's result be reused if its key covered the kernel release, the CPU and the system type. Nix picks the builder after the derivation's hash is fixed, so a derivation cannot name the kernel of a machine not yet chosen. How is a reused result bound to a machine?
Alternatives.
- Put the facts in the derivation, through a per-kernel
requiredSystemFeaturestag on each builder. - Record the facts the test observed in its output, and compare them on reuse.
- A check in the staging helper that refuses to run on a mismatched machine.
Evidence. "The hook is policy-free" (nix-thesis), and nixception does not match action properties against workers (nixception).
Choice. Record and compare (BGX3). The test's output holds the kernel release, CPU model and features, and system type it observed. A reuse compares them with the machine the test would otherwise run on, and a mismatch reruns the test without reuse.
Trade-offs. A per-kernel feature tag would split the builder pool on every kernel update. Comparing on reuse costs one read of the output.
Revisit when Nix can match derivations to builders by machine facts.
D34: Pruning sees string imports and mixed-in conditions (accepted)
Question. D13 prunes an inherited version that no scanned D file mentions. A mixin makes a condition no file spells out, and a string-imported file can hold one too. sparkles.base.meta.isVersion builds version (…) in a mixin from its argument, so the first isVersion!"<a configuration version>" would give a silent wrong hit. Extend the scan, forbid the pattern, or both?
Alternatives.
- Scan more: string import roots, and literals that could become conditions.
- Forbid the pattern with a lint.
- Both.
Evidence. "a mixin produces source text that never becomes a file" (compile-time-execution). Bazel, on leaving data out of keys: "every time we've done that, it later resulted in expensive debugging sessions and bug fixes" (bazel).
Choice. Both (BGV1):
- Files under string import roots are scanned as text, whatever their extension.
- A
mixinwhose literal arguments, joined, containversion (ordebug (makes the variant keep every inherited identifier, and is reported. So does a manifest constant initialized with such literals, because a constant can carry them to amixinelsewhere. Joining the arguments catches a condition split across literals. isVersion's own literal is exempt, so the rule does not disable pruning for every package that importssparkles.base. Instead a lint fails planning on anisVersionargument, outside aunittestblock, that is not a predefined version identifier. Every such use in the repository namesApple.meta.d's own test probes a made-up identifier inside aunittestblock, which compiles only insparkles:base's test root.
Trade-offs.
- False positives: a constant such as a formatter's test fixture (
sparkles.dmd_fmt.loc_inventory) keeps its variant's inherited identifiers too. Planning reports each one, so such a variant can be fixed or accepted knowingly. - Ordinary literals are not scanned: a literal passed to a function, such as the DMD frontend's header generator writing
"version (", does not trigger the rule. Scanning every literal would turn pruning off for every variant that imports the frontend. - The residual gap: a CTFE function that assembles a condition from literals in its body, for a
mixinelsewhere, is not seen. The lint coversisVersion; another such function needs a lint of its own.
Revisit when the reported literals cost measurable sharing.
D35: No interface cutoff between compiles (accepted)
Question. BGA2 makes a compile read its dependencies' sources, so a compile never cuts off another: any edit to a module that a dependent imports recompiles the dependent, even when only a function body changed. Should compiles key on generated interface files (.di) instead?
Alternatives.
- Key dependents on each dependency's
.difiles, generated by a compile. - Keep reading sources (BGA2), with cutoff only at archives and links (BGA10).
Evidence. A .di still holds template, auto and inline bodies, so the cutoff is partial. Compiling against interfaces changes inlining and makes a dependent wait for its dependencies' compiles, which BGA2 avoids. Bazel's interface jars come with the caveat "but error messages can be different" (semantic-caching), which conflicts with invariant 5.
Choice. No interface cutoff. This stays an open question under D4.
Revisit when M12 measures how many dependent compiles a body-only edit triggers, split by whether the edit moved lines.
D36: The determinism check runs on every CI run (accepted)
Question. Invariant 1 assumes each action is deterministic, and the shared store trusts the first result published for a key. Nothing checks the assumption. Is the check an opt-in tool, a nightly sampled job, or part of every CI run?
Alternatives.
- An opt-in tool:
ci cache verify --rerun, run when someone suspects a result. - A nightly job over a sample, once a binary cache shares results.
- A sampled check in every CI run.
Evidence. "a determinism check must run cold and unshared, or it tests the cache", and "Caches hide the defect they are meant to expose" (reproducibility). "a disconnected non-deterministic build can poison a cache until a clean rebuild" (perfect-dependencies).
Choice. Every CI run (CIC13), through BGS9's check:
- Cold: each sampled action runs with its own lookup bypassed, on the bytes its published result was keyed on.
- Unshared: its outputs go to a private, empty store that is discarded afterwards, and never to the shared store or a binary cache.
- The sample: four compiles and four other cacheable actions, ordered by the digest of the commit id and the result key. The sample rotates with each commit and is the same for a rerun of one commit.
- A difference fails the run and removes the suspect result.
Trade-offs. Up to eight extra actions per run, possibly compiles of sparkles:ui. They run beside the run's tests, after the builds that produced their inputs. The check sees nondeterminism within one machine only; a difference between machines needs a shared cache to compare against.
Revisit when the check costs more than a few percent of a CI run's wall time, or a binary cache shares results between machines, which adds the cross-machine comparison.
D37: Planning records its read set (accepted)
Question. Every run plans from scratch: it resolves every recipe, lexes every scanned source, runs the layout lint and queries pkg-config. Record what planning reads, memoize it, or neither?
Alternatives.
- Neither.
- Record the read set, and use it to check what decides re-planning.
- Record it and memoize content-keyed planning results.
Evidence. PIE's no-change build costs 3.3 s against 0.00001 s for change-driven traversal, "while the Pluto algorithm still needs to check the entire dependency graph" (pie). GN's regeneration records every file it opened (gn), and BuildXL caches its graph (buildxl).
Choice. Record the read set in E2 (BGP1), and check ci's hand-written invalidator list (CIC5) against it. A content-keyed memo is added only if no-op planning of the repository's test selection takes more than about one second. A memo is not persistent scheduler state, which the task DAG excludes.
Revisit when a measurement of no-op planning exceeds one second.
D38: Plain LRU, touched at lease creation (accepted)
Question. BGS5 evicts least recently used results, but does not say what refreshes recency, nor whether several worktrees need a retention policy beyond it.
Alternatives.
- File access times.
- An explicit touch when a lease is created.
- A retention policy that reads every active worktree's graph, so no worktree evicts another's working set.
Evidence. An access time "is more likely to be externally modified and may be unavailable on some filesystems", and "a small AC can starve while the CAS is idle" (cas-eviction).
Choice. Plain LRU, with recency refreshed when a lease is created (BGS4). Manifest lists, digest records and preimages have a bound of their own.
Revisit when two active worktrees are seen evicting each other's results.
D39: A spike on write and network isolation (accepted)
Question. Invariant 6 says the source tree is read and never written, and BGX3 never reuses a test that needs the network. Nothing enforces either. Test actions run in the worktree's root (BGX1), and some write there: goldens, and git init fixtures. A test that rewrites a file under a string import root while a compile reads it is a read-after-write hazard that BGK7 would catch in effect but not name. Should local actions run isolated?
Alternatives.
- No isolation: rely on BGA3's private outputs and on review.
- Landlock rules that make the tree read-only and only the action's output and task directories writable, and a network namespace without interfaces.
- Tracing writes under
straceas a lint, or exclusive claims over a root that compiles reading it also claim.
Evidence. "a policy mechanism is not an observation mechanism" (sandboxing-overheads). Rattle's rules, "Never write to the same file twice. Never read then write.", hold between our actions only if writes are confined (rattle).
Choice. An E3 spike, framed as isolation and not as a dependency oracle. Manifests remain the record of what an action read.
- Question: can Landlock confine every compile, archive, link and generate action's writes to its private directories, and an unshared network namespace remove the network, on the kernels CI and developers run, at a cost below the noise of a compile?
- Tests: list every test action that writes into the tree, and decide for each between moving the write into its task directory, a write lint under
strace, and an exclusive claim over the root it writes. - Decision criterion: if the cost is within noise and the kernel supports it, local build actions run confined and a violation fails the action; otherwise the spike's measurements are recorded and the lint is used.
Result (2026-11-17, partial). apps/ci/tools/confine.d confines a process with Landlock (writes beneath the directories it names, and /dev) and an unprivileged user and network namespace, and plan-graph --run --confine wraps every compile, archive, link and generate action with it (--confine-tests wraps tests too, with their TMPDIR writable).
- Kernel: Linux 6.18 (Landlock ABI 3 or later, unprivileged user namespaces) confines without privileges. A kernel that refuses exits 125, apart from the program's own failures.
- Cost:
sparkles:build-primitives' graph without the store, 26 actions: 65.0 and 67.9 s plain, 69.6 and 65.1 s with the build actions confined, 64.1 and 65.0 s with the tests too, on a host that ran another build at the same time. The cost is within the noise. - Build actions: one violation, now fixed: the C driver an LDC link runs wrote its temporary files to
/tmp, since a build action's complete environment set noTMPDIR(BGA4 now sets it to the action's measurement directory). Every build action of the graph then ran confined. - Tests:
sparkles:build-primitives' 352 tests pass confined to their task directories andTMPDIR; one,fileset.driver.FSD7.realMount, skips, since it creates files in/dev/shm.
Result (2026-11-20). Every package's tests ran confined to their task directories and TMPDIR, without a network (plan-graph --run=<package> --confine-tests, 85 packages on Linux 6.18). No test action writes into the tree. The list has one entry:
| Test action | What it writes | Decision |
|---|---|---|
dmd-lsp's tests | beneath DUB_HOME: the dmd package's generated configuration, and dub's cache | its declared dub (D62) runs there, so a test that declares dub may write beneath DUB_HOME too, and only there |
The decision criterion holds for build actions and for tests: local actions may run confined, and a violation fails the action. Confining them by default, with the wrapper keyed as a tool (BGT1), is the ci test cutover's (ci task-DAG M7b).
Revisit when a test action needs to write beneath another directory, or the wrapper becomes the default.
D40: Toolchain store paths are remapped (accepted)
Question. Objects record the store paths of druntime and Phobos sources in debug information and in __FILE__, through Phobos' assert messages and templates instantiated in our compiles. Each binary then references the whole toolchain in its Nix closure. Remap them?
Alternatives.
- Leave them: the paths name no worktree, so keys are unaffected.
- Strip debug information from shipped binaries, which leaves
__FILE__. - Remap the toolchain's paths to a fixed prefix through the LDC fork's prefix map, in our compiles and in the toolchain's own druntime and Phobos.
Evidence. nix-cargo-unit measured the same effect in Rust: a store path baked into one monomorphized standard-library generic pins a ~1.9 GiB toolchain into a binary's closure (nix-cargo-unit). The repository's Nix packages already map druntime's and Phobos' assertion paths out of the store, through ldc.reproducible (nix/packages/wasm-modules.nix says so); the build graph's actions do not go through it.
Choice. Remap (BGA11), measuring the closure size of the repository's shipped applications before and after.
Trade-offs. A debugger no longer finds druntime and Phobos sources by the recorded path, and needs a source-path substitution.
Revisit when the measurement shows no closure gain, or the toolchain's sources are shipped beside its libraries anyway.
D41: Per-shard recompiles before shared results (accepted)
Question. CI splits its work across jobs, and each job's machine has its own store. Until results are shared between machines, every shard recompiles sparkles:base and the other common libraries. Work around it, or accept it?
Alternatives.
- Share one store between a workflow's jobs, through the CI provider's cache.
- Accept the recompiles until a binary cache shares results.
Evidence. moon's shards repeat work "and only the cache dedupes them" (moon).
Choice. Accept per-shard recompiles until Cachix shares results through the Nix backend (E4).
Revisit when the recompiles dominate a shard's wall time, or E4 lands.
D42: Test reuse through recorded runtime inputs (accepted)
Question. D7 reuses a test result only in the Nix sandbox or when the test declares every runtime input. Declaring inputs by hand throughout the repository is unlikely. What is the planned route to reuse outside the sandbox?
Alternatives.
- Hand-written declarations of runtime inputs.
- Record what each test run read, the environment variables it consulted and the files it opened or probed, as
go testdoes, and key the result on the recording.
Evidence. go test caches a result keyed on a log of the environment variables and files the test read (semantic-caching).
Choice. Recording is the planned route for D7's revisit. No result is reused through it until an oracle proves the recording complete: every file a test opens under strace appears in its recording, as oracle 3 does for compiles.
The oracle. It compares the read set the runner core records with a static scan of the package's sources: string literals and buildPath segments that name tracked paths. A statically named path that is in neither the declared inputs nor the recorded set is a finding. A declared input that nothing names or reads is stale. The scan is a second source independent of the recording; its tokenizer and matcher come from apps/ci/src/test_reads.d on PR #633's branch, ported once BGX2 gives runtime inputs a home (D43).
Revisit when that oracle passes for the repository's tests.
D43: Amendments from the Nix-generated CI PR (accepted)
Question. PR #633 generates the repository's workflows from Nix, keys every CI task by its unit's source closure, skips a task whose key already passed, and shards tests longest first. Its build reuse is coarser than the build graph's keys, and its test reuse lets one runner skip a test another runner passed, which D7 rejects. Land it, or take its ideas into these specifications?
Alternatives.
- Land the PR whole, then migrate its pipeline at M7, M12 and M13.
- Take its best ideas as requirements, and close it.
Choice. The owner accepted five amendments on 2026-11-06, and the PR is closed as a reference:
- Placements (CIC14):
ci pipelinemaps one graph onto provider jobs, with shards packed longest first by recorded wall times. The PR's static shards and hand-measured weights become data from run records. - Shared verdicts (BGX4): its stamp mechanism, kept within D7: only for results BGX3 lets be reused, keyed on the observed machine and runner image, and published by a credentialed run whose gating checks passed. It is how test results come to be shared before E4 (D41).
- The recorded-inputs oracle (D42): its static test-reads scan becomes the oracle's second source.
- No
--sinceon CI (CIC15): keys, not diffs, decide reuse there. - Observability: a task skipped by a shared verdict carries the publishing run's record id (OD16, in the observability specification), and the determinism check is exempt from every result memo (CIC13).
Trade-offs. The PR's generated workflows and store-path steps are not taken now; they return at M13, built from ci placements list, when the workflow shape stops changing.
Revisit when M13 generates the workflows.
D44: The build graph reaches files through the VFS (accepted)
Question. The build graph reads recipes, scans and digests sources, probes for absent files and writes a shared store. The E1 resolver and the repository's walkers do this with std.file on path strings. Should the graph keep paths, or use the repository's capability VFS, whose specification the owner has accepted?
Alternatives.
- Keep paths, and confine them by checking prefixes after the fact.
- Route every operation through the VFS, on a fixed set of roots, with listings as fileset resolutions.
Choice. Route it through the VFS, accepted by the owner on 2026-11-07 (§12, BGF1–BGF6). All I/O goes through sparkles.base.vfs and its event-horizon backends, and the fileset effort resumes as the graph's file-system layer.
- Planning runs over the backend its caller supplies, so its tests plan fixture trees on
MemVfswith no temporary directories, and the executor runs the same code onRingVfs. - The worktree is a read-only root opened with
symlinks = beneath, so D24's committed link resolves and a link out of the tree fails planning. The fileset specification's FSD6 gains that policy as a consumer's choice. - The store uses
renameAt,writeFileAtomicandremoveTreebeneath its own root, and refuses links. - Listings are fileset resolutions (BGF5), so the graph's E2 needs the filesets' M1–M3, and M5 for listing digests.
- The VFS gains the file identity and change time in its
Stat(VFO6), which BGK5's cache and BGK7's stat proxies need, before E3.
Trade-offs. The E1 resolver moves off std.file in E2, and the repository's old walkers (dir_walk, glob_walk) were not used by the graph; filesets' M9 deleted them. Processes an action starts still read paths: the manifest, BGK8 and the D39 isolation spike cover them, not the VFS.
Revisit when a VFS backend cannot answer an operation the graph needs on a supported platform.
D45: A preprocessor option keeps its separate operand (accepted)
Question. dub's applyPkgConfigCFlags splits pkg-config --cflags on whitespace and keeps the words that start with a preprocessor option, so -isystem /sdk/include -include config.h becomes -P-isystem -P-include: the operands are dropped, and the preprocessor reads the next flag as the operand. Copy that (D23), or keep the operand?
Alternatives.
- Copy dub, defect included.
- Keep the option and its operand as two flags (
-P-isystem -P/sdk/include). - Join them into one flag (
-P-isystem/sdk/include).
Choice. Join them, accepted by the owner on 2026-11-11. Each of the options kept (-I, -D, -U, -include, -isystem, -idirafter) takes a joined operand in GCC and Clang, so the joined flag means what the separated one does, and one flag cannot be split or deduplicated apart by a later merge. Options dub does not keep (-iquote) stay dropped, with their operands.
Trade-offs. For a .pc file that separates an operand, the resolver's dflags differ from dub's, a difference oracle 1 must accept; for one that does not, nothing changes.
Revisit when dub keeps the operand, or a preprocessor rejects the joined form.
D46: An optional dependency follows the locks (proposed)
Question. The resolver skipped an optional dependency unless it was also default, reasoning that the locks select nothing. So a locked optional dependency was dropped, and an unlocked optional default one was a resolution error ("in neither DUB lock"). What does dub do?
Alternatives.
- Keep the rule:
defaultdecides. - Copy dub's rule.
Project.collectDependenciesRec(source/dub/project.d) wants a dependency when!optional || selections.hasSelectedVersion(base) || (default && selections.bare), wherebaremeans there is no selections file; andDub.upgradekeeps a selected optional dependency and drops an unselected optional-default one whenever a selections file exists.
Choice. dub's rule, with the lockfiles as the selections file, so never bare: an optional dependency is used exactly when the locks pin its package, whether or not it is default. A sub-package of the root or of the dependent's own package is used too, as dub takes those without consulting the selections. Each range of a used dependency is checked against the lock (BGR4). Edges are looked up by name, so an optional edge to a package that another dependent loads is followed, as in dub.
Trade-offs. dub also loads an unselected optional dependency that names a repository, fetching it; the resolver fetches nothing, so it skips one. No recipe in scope declares an optional dependency, so only the resolver's tests exercise the rule.
Revisit when a recipe in scope adopts optional, or resolution runs without lockfiles.
D47: An input set follows the resolver's configurations (accepted)
Question. A package's input set depends on the configuration it is built in, and dub chooses a dependency's configuration per request: text-lab builds sparkles:ui-app in gui-vulkan, which builds sparkles:ui in gpu-effects, while a terminal-only consumer builds ui in library. Which configuration does the input set a selection consults follow (fileset-native workspace, BGW12)?
Alternatives.
- The workspace's rule (TDS2):
unittestfor a test, else the first configuration the host allows. One set per package and no resolution, but unsound: fortext-labit takesui'slibraryandui-app'stui, soui's generated shaders and the Vulkan backend are in no set it consults. - The union over every configuration. Sound and one set per package, but
ui's test configuration reacheslibs/dql/src, so an edit todqlwould select every dependent ofui; andui-app's union makestext-labdepend onui-tuiandui-raylib. - The resolver's answer per request, with a fallback for a query that has no request.
Choice. The resolver's answer, accepted by the owner on 2026-11-12. Input sets are keyed by package and configuration, and a request's closure is the set of pairs its resolution chose (Resolution.configurations). A query with no request of its own, such as --since with no target, asks over the requests the command would make: for ci, the test root of each package ci test runs and each build configuration of each application. The union over every configuration was rejected as that fallback because it over-selects for every such query.
Trade-offs. Selection needs a resolution per request, which until the resolver reads through the VFS (W3) reads recipes once per request. A new kind of request has to be added to the command's list, or its changes are judged by the other requests' closures only.
Revisit when a command needs to ask about a package outside every request it makes.
D48: One leaf digest, BLAKE3 (accepted)
Question. The build graph keys a file by SHA-256 (BGK2); the fileset's default identity, snix's castore, is BLAKE3. One digest cache is to serve every reader (BGW9). Which digest is its leaf?
Alternatives.
- SHA-256 everywhere: matches Nix and git's SHA-256 object format; slower to compute, with no verified partial reads.
- Both: no specification changes, and every file hashed twice.
- BLAKE3 everywhere.
Choice. BLAKE3, accepted by the owner on 2026-11-12. A file's content is hashed once, by BLAKE3, and the build graph's input manifests and keys move to it. Each consumer keeps its own tree encoding over that leaf. SHA-256 is computed only where an external format demands it, such as a Nix source whose NAR hash is pinned, at the point of export.
Trade-offs. BGK2's statement and every recorded manifest change digest; the store has no manifests to migrate yet. A NAR hash still reads the bytes again, because NAR hashes the serialization, not the leaves.
Revisit when an external store the build publishes to requires another leaf digest for its content-addressed entries.
D49: The names at the worktree root are a workspace input (accepted)
Question. The D frontend looks for an imported module relative to its working directory before it searches the import paths, and compiles run in the repository root (BGA5). A directory created at the root with a module package's name, such as sparkles/, would shadow every module beneath it, and no input set claims it. How does selection stay sound?
Alternatives.
- Make the compiler skip the lookup, a change to the toolchain fork.
- Compile in an empty working directory, which every relative path of every recipe would have to survive.
- Make the paths such a lookup could find an input of every package.
Choice. The last, accepted by the owner on 2026-11-12. The workspace inputs hold every D or C source directly beneath the root and everything beneath a top-level directory named as a top-level package of an importable module: the first components of the modules under every import root, with the toolchain's (std, core, etc, ldc, object). A change to one affects every request. In this repository no top-level directory has such a name, so the rule costs nothing until someone creates one.
Trade-offs. The names come from listing the import roots' first level, which materialization does anyway; until then (W0–W2) the consumer supplies them. The lookup stays possible, so BGW10's residue still checks the absent candidates for reuse.
Revisit when the toolchain can be told to skip the working-directory lookup.
D50: Watching on Linux, macOS and Windows (accepted)
Question. The event loop's watcher is inotify, and takes a path under ambient authority. Is a Linux-first watch, with a periodic lossy rescan elsewhere, acceptable for --watch?
Choice. No: W6 delivers a tree watcher on all three hosts, inotify on Linux, FSEvents on macOS and ReadDirectoryChangesW on Windows, decided by the owner on 2026-11-12. Each meets BGW14's loss rules, and the periodic rescan remains the fallback for a host or file system none of them covers.
Trade-offs. W6 roughly triples its platform work, and only the Linux watcher can be exercised on the development host; the others are verified by CI on their hosts.
Revisit when a host the build supports offers none of the three.
D51: Untracked files are inputs (accepted)
Question. A compiler reads an untracked module, so an input set, taken from the disk, holds it. ci's checks ask git for tracked files, which no fileset leaf expresses. Do untracked files count, and does a leaf for git's index come now?
Choice. Untracked files count, accepted by the owner on 2026-11-12: an input set is resolved from the disk, through the ignore rules, as the compiler sees it. ci's tracked-file checks keep asking git. A fileset leaf for git's index is added when a check that moves to filesets needs it, and not before.
Revisit when a check is moved to filesets and needs the tracked-only view.
D52: A test's run-time inputs stay undeclared for now (accepted)
Question. BGX2 requires a test to declare what it reads at run time, and names no syntax: a user-defined attribute on the test, a fileset in the recipe, or something else?
Choice. Deferred, decided by the owner on 2026-11-12. Until a syntax exists, a test node's read claim is its package's input set and its closure's, and freshness (BGW18) stays off for tests, so a test verdict is not reused outside the Nix sandbox.
Revisit when file claims in the task model (W5) are delivered, or a test suite's reruns cost enough to matter.
D53: Typed generators come before watching (accepted)
Question. Three recipes run the shader compiler through preGenerateCommands, and a command's reads are not declared, so every request that builds ui in gpu-effects, ui-vulkan or vulkan-wsi, which includes text-lab's, is uncertain (BGW4). A sound ci build --watch :text-lab would rerun on every change. Deliver typed generators (BGG1) before watching, or accept the uncertainty until later?
Choice. Before watching, decided by the owner on 2026-11-12: milestone WG of the fileset-native workspace comes after W2 and before W6. For selection it needs only the declaration: the resolver recognizes the shader compiler's command and states its tool, its inputs, a request for the package's device configuration, and its output directory. The action graph's generate actions (BGG2–BGG6) keep their own milestone in the build graph's plan.
Trade-offs. Recognition is by the command's shape, which a recipe could write differently; an entry not recognized stays opaque rather than guessed at.
Revisit when a recipe declares a generator that is not the shader compiler.
D54: The planner's inputs are its planning library's closure and its own sources (accepted)
Question. BGW12 makes the planning command's dependency closure a workspace input: a change to anything the planner is built from could change every plan. ci's closure is 30 of the repository's 73 packages, because ci reaches ui, syntax and twoslash through docs, so an edit to any of them would select every package under --since. Take the whole closure, a narrower one, or split ci's planner into a package of its own?
Choice. The narrower closure, decided by the owner on 2026-11-13: the closure of the library the command plans and runs the work with (sparkles:build-primitives) and the command's own package's sets (sparkles:ci's sources and recipe), each still derived from resolutions rather than listed by hand. The consumer names the two packages (FocusOptions.plannerLibraries and plannerPackage).
Trade-offs. It is unsound where a ci mode outside planning changes how a package is tested through a module that only docs reaches. ci's own tests cover its modes, and an edit to ci's sources still selects everything. Splitting the planner out would make the rule exact, at the cost of a refactor of apps/ci outside this design.
Revisit when ci's planning and test-driving code moves into a package of its own: its closure is then the rule's.
D55: Listings are inputs of resolution, not deferred (accepted)
Question. BGW8 splits resolution into a symbolic stage, whose settings hold filesets and list nothing, and materialization, which turns them into lists, so that an added file changes a list without resolving again. The resolver decides from listing contents, though: a target with no source files is typed by that, the test root searches the source list for the main file, the main file is filtered out of dependencies' lists, a string import overrides another by base name, and object files are picked out of source lists. Defer the lists anyway, and how?
Choice. Listings stay fileset resolutions and become inputs of resolution, decided by the owner on 2026-11-13. The tree lists each distinct root and name patterns once, shares the listing across every request it serves, and records each listing, probe and file read in the resolution's read set (Resolution.reads), a listing with its members' digest. Resolving again (some 35 ms a request) is how a list follows the tree, and the read set says when it must. No settings field holds a list a later edit can leave stale, because none outlives the read set it came from.
Rejected for now, may be revisited.
- Fully symbolic lists: every file-list field a fileset expression, each decision that reads a list moved into materialization. It matches BGW8's first wording, but rewrites much of configuration and the test root, at a risk to dub agreement.
- Symbolic resolution with consumed facts: symbolic resolution records the listing facts it decided on (a list's emptiness, the main file's presence, the base names that override), and materialization resolves again only when one of them changed. Precise, and the most machinery.
Revisit when resolving again costs a watch more than it saves, or a consumer needs a list between two resolutions.
D56: Planning reads D source with DMD's lexer and parser (accepted)
Question. Pruning (BGV1), the isVersion lint and D13's divergent-mode lint read D source as tokens. The layout lint (BGV5) reads it as declarations, before conditional compilation. Write a lexer and a tolerant parser for planning, or use DMD's, and from which package?
Evidence.
- The repository already pins a DMD fork for
sparkles:dmd-lspandsparkles:dmd-fmt. Itsdmd:lexeris some 15 frontend files and links on its own, including under-checkaction=context, which dub passes down to every dependency. - A scan of every tracked D file on
dmd:lexerfinds the same 1,976 mentions, four string-built conditions and fourisVersionuses as a hand-written lexer did. All three string-built constants outsidesparkles.base.metaare insideunittestblocks. - The fork's
dmd:parserleaves outastbase.d, the parse-only AST family, because its LanguageServer patches do not cover it. With about eight changed lines (theIdentifiertoIdentifierAtLocsignatures of four classes),Parser!ASTBasecompiles and parses this repository in under a second, apart from a gap intemplateArgToExpon nested template arguments. - DMD's lexer keeps process-wide state: its identifier table, and the
dmd.id.Idglobals__EOF__needs.sparkles:dmd-fmtserializes on a lock.
Alternatives.
- Own lexer and parser in
build-primitives: no dependency, and a parser of D declarations to maintain against the language. - DMD's lexer, and
astbase.dfixed in the fork:dmd:parseralone, no frontend; a fork change first. - DMD's lexer, and the frontend's AST for the layout lint: no fork change; whatever runs the lint links the frontend.
Choice. The third now, moving to the second, decided by the owner on 2026-11-16:
- A package of its own,
sparkles:d-source, depends ondmd:lexerand on no repository package, so the build graph and the DMD-based packages can all depend on it. It holds the token scans and the one lock andId.initializefor DMD's process-wide state. - The layout lint is a package of its own on
dmd:frontend, parsing without semantics assparkles:dmd-fmtdoes. Planning calls it through an interface, so the build graph does not link the frontend. Written against DMD's parse-time visitor, which is generic over the AST family, it moves toASTBaseunchanged once the fork'sdmd:parsercarriesastbase.d. - Planning is a package of its own,
sparkles:build-graph, which depends onsparkles:d-source;build-primitivesdoes not, decided by the owner on 2026-11-18. A consumer ofbuild-primitivesalone, such assparkles:doc-viewforrunGit, would otherwise link part of DMD:dmd.root.rmemdefines druntime's allocation hooks (_d_newclass,_d_allocmemoryand the rest), so a binary that links druntime as a shared library pulls it in to define them, and DMD's versions replace druntime's.
Consequence. Every build of build-graph builds dmd:lexer, whose pre-generate step runs git describe, so the Nix builds of its consumers carry git.
Revisit when the fork's dmd:parser carries astbase.d.
D57: Pruning scans what a compile can reach (accepted)
Question. BGV1 kept an inherited identifier that any file under a variant's roots mentions, and kept every one when any file there built a condition from strings. DMD's dmd/backend/cdef.d builds one, and dmd:lexer's import root is the whole of DMD's compiler/src, so every variant that can import DMD's lexer kept everything: build-primitives and all that depends on it. A string-built constant inside a unittest block did the same to sparkles:dmd-fmt. How far should the scan reach?
Alternatives.
- Every file under the roots, as BGV1 said: simple, and blind to what is imported.
- The modules the compile can reach: the variant's sources, then the modules they import, transitively.
- Narrow DMD's import root in the fork: fixes one case only.
Choice. The reachable modules, and conditions inside unittest blocks exempt, decided by the owner on 2026-11-16 (BGV1):
- The reachable D files are the variant's own sources and, transitively, each module one of them imports, found under its import roots in the compiler's search order. An import counts under any
versionbranch and in any function body, since the scan evaluates no condition. - A reachable
mixinwhose joined literals contain the wordimportmay import what no declaration names, and makes every file under the import roots reachable. - A string-built condition inside a
unittestblock keeps nothing: the block compiles only in its own package's test root, which inherits nothing. Planning still reports it.
Consequence. Over this repository, 166 variants instead of 169, and 16 of them keep every inherited identifier instead of 23. The rest of those 16 are real: dmd.globals imports dmd.targetcompiler, whose version (MARS) branch imports DMD's backend, so a variant that may set MARS reaches cdef.d; and sparkles:ui runs a generator (BGV1's generated roots).
Revisit when a scan that evaluates version conditions against the variant's own identifiers is worth its cost.
D58: The layout lint gates in-tree packages (accepted)
Question. BGV5 fails the plan on every violation of BGV4 in the packages it plans. The lint's first run over this repository found 194, four of them in registry packages (dmd:root, bolts) that this repository cannot change. Fix the rest first, or relax the rule; and what of the registry's?
Evidence. Of the 190 in-tree violations, most were test helpers declared public or package under version (unittest), often in modules that are version (unittest) throughout; the rest were private templates there, test-only imports, imports a public: label re-exported, and test seams inside templates (EventLoop, the VFS), which a dependent's test root instantiated differently from the library.
Choice. Decided by the owner on 2026-11-16 (BGV4, BGV5):
- The rule stands, and the repository was brought to it first: test-support modules leave their library configurations; test helpers that other modules call become templates outside
version (unittest); hooks and seams are declared, and in templates also run, in every build; the rest are private. - A violation in a registry package is reported with the plan and does not fail it.
- The import rule reads the variant's own versions, so a module that is
version (X):throughout, for a configuration that setsXand depends on what it imports, is judged as that configuration compiles it.
Revisit when a registry package's finding is fixed upstream, or a configuration-gated hazard other than an import needs the same reading.
D59: What planning's trace holds, and what stands for the rest (accepted)
Question. Oracle 20 step 1 checks planning's system-call trace against its read set, and oracle 24 step 2 checks that planning names no path from the process's root but BGF2's roots. Planning resolves libraries through pkg-config (BGR5), which runs as a process with reads of its own; the process's runtime reads files of its own too; and the resolver probes the root package's default directories. What belongs in the read set, and what stands for what does not?
Evidence. The first traced plan of this repository found:
- the lookups planning makes for itself, each a file, probe, listing or link it records, and, before links were recorded, a link it crossed without a record (
libs/ui-app/spec/resilience.md, D24); - 74
pkg-configqueries, whose processes made about 42,000 lookups of.pcfiles, libraries and the shell's own start-up; - two reads of the runtime's: the collector's count of processors (
/sys/devices/system/cpu/online) on its first collection, and the C library's time zone (/etc/localtime) when the DMD frontend first asks the date; - probes of
source/,src/andviews/in the repository root, which dub's rules make for the root recipe, and which no workspace input covered.
Choice. Decided by the owner on 2026-11-17 (BGP1, BGF2, BGF3):
- Roots. Planning reads through a tree that serves only BGF2's roots: the worktree, which follows links beneath it, and the pinned registry sources, one directory holding every registry package, which follows none. A path beneath neither fails planning.
- Links. The tree resolves a path one entry at a time and records each link it crosses with its target, and the target's bytes as a file read of their own. A listing resolves from the root that holds it, so a link beneath a listed directory whose target climbs above it but stays in the worktree resolves (FSD6). A link that is absolute, or that climbs out of its root, fails planning naming the link.
- Queries. Each
pkg-configquery is recorded with its arguments, its status and the digest of its output, and the variablespkg-configreads are recorded with their values. The query stands for its process's reads, as an action's manifest stands for its process's (§12): those reads are left out of the trace check. BGF2's root for each directory a query searches waits for.pcfiles read in process (BGK9, E3). - The runtime's reads are the process's, not planning's: the traced planner makes them before its first marker (it collects once and sets the time zone), and they are in no read set.
- The root package's default directories are workspace inputs that
cistates (rootDefaultsinapps/ci/src/repository_inputs.d): a plan depends on their absence.
Revisit when pkg-config is read in process (BGK9), or when the resolver stops probing the default directories of a root recipe that no target builds.
D60: A single-file generator runs where git fails (accepted)
Question. The dmd registry package's dmd:lexer runs its config.d through dub ("$DUB_EXE" --single config.d -- generated/dub VERSION /etc), and the program asks git describe for the compiler's version, falling back to its VERSION file. The graph builds the program (BGG1, BGG6) and runs it with a complete environment, whose PATH is empty (BGA4), and BGG3 says a generator searches no PATH. With nothing on it, Phobos's execute throws for the missing program and config.d fails instead of falling back. Give it the real git, change the program, or give it a git that fails?
Evidence. In a registry checkout, which is no repository, git describe fails, so dub's own run writes the VERSION file's contents. Given the real git, the program would run it in the directory __FILE_FULL_PATH__ names, which after relocation (D18) is resolved against the action's working directory, so git could describe whatever repository holds that, and the output would vary with the run.
Choice. Decided by the owner on 2026-11-17 (BGG1, BGG3, BGA4): a git that fails. A single-file generator runs with a PATH naming one directory, made by an in-process action, that holds a script for each of failingTools (git) whose interpreter line names Tools.fail (the toolchain's false), so it exits non-zero. The program falls back to its VERSION file, as under dub in a registry checkout, and its output is a function of its declared inputs. A VFS link takes only a relative target (VFO3), hence a script rather than a link to false.
Trade-offs. The list names the tools one known program runs, not every tool a program might run: another single-file generator that runs a tool not on the list still fails, as BGG3 wants, but by an exception rather than a clear error.
Revisit when a single-file generator needs a tool to succeed, or the upstream config.d stops calling git.
D61: A test that runs a program it builds gets it from the graph (accepted)
Question. Two test suites build programs with dub and run them: shader-compile's command-line tests build the tool (--config=application), and test-runner-impl's scenarios build the runner executable (checked) and a fixture package's test binary (tests/fixture). Each writes into its package's build/ directory, under a lock file there. A test binary never runs dub (BGX1), and a confined test writes only its own directories and TMPDIR (D39), so both fail in the graph. Skip them there, leave them failing, or have the graph build the programs?
Alternatives.
- Skip them under the graph: the smallest change, but the graph never runs those tests, and nothing keys them on the programs they run.
- Leave them failing until E4: records the violation and fixes nothing.
- The graph builds the programs: each is a planned target like any other, and the test receives its path.
Choice. Decided by the owner on 2026-11-18 (BGX1, BGX2): the graph builds them. A package whose tests run programs declares them in test-programs.json beside its recipe: for each, the environment variable that names it to the test, and the package directory, configuration and build type to build it with. Planning a package's test root reads that file through the tree, so it joins the read set; it builds each program as an ordinary request whose own tests do not run, and gives the test action the variable set to the linked binary. The link is then one of the test's runtime inputs, and its outputs digest is part of the test's key. A test uses the variable when it is set, and builds the program with dub otherwise, so dub test is unchanged.
Trade-offs. The file is a second place, beside the test's own code, that names what the test runs; a test that starts running another program and does not declare it still runs dub, which the dub trap reports (oracle 11).
Revisit when dub gains a way to declare a test's build-time tools.
D62: A test whose subject is dub declares it (accepted)
Question. Two of dmd-lsp's tests read a package's configuration through dub describe, because that is what the language server does, and what they test: dmd_lsp.project.dubProjectFor.cachesPerRecipe and dmd_lsp.device.deviceConfigFor.describesTheDeviceConfiguration. A test binary never runs dub (BGX1), so in the graph they meet the trap dub (oracle 11) and fail, while under dub test they pass: oracle 2's one real disagreement over the repository's packages. Skip them in the graph, accept the disagreement, or let such a test run dub?
Alternatives.
- Skip them when the dub they find is unusable: BGX1 stays as written, but the graph never runs them, and oracle 2 carries an exception.
- Accept the disagreement until
ci testmoves to the graph (task-DAG M7b): records it and fixes nothing. - Declare it: a test whose subject is dub says so, and runs the real one.
Choice. Decided by the owner on 2026-11-19 (BGX1, BGX2): declare it. A package's test-programs.json (D61) may hold a tools list beside its programs; its one admissible entry is dub, with a non-empty reason, and any other tool fails planning. That package's test action finds the real dub first on its PATH; every other test still meets the trap, which records its calls, so a test that starts running dub without declaring it is still reported. The runner itself is passed --no-dub as before.
Trade-offs. A declaring test depends on dub, its registry settings and its cache, none of which the graph keys; it is not reused in E3 (BGX2), and E4's sandbox must make dub and its home a declared input before it can run there.
Revisit when E4 confines tests: dub's home becomes a runtime input, or these tests move to sparkles:build-primitives' in-process resolver.
D63: DMD maps the root as LDC does (accepted)
Question. D19 made every DMD variant key on the root, because DMD had no prefix map. Its outputs also differed from run to run, which ci cache verify --rerun (CIC13) reported on every DMD run (sparkles#760):
- Archives:
dmd -libstamped each member header with the time it ran and the builder's uid and gid, with no override. - Test roots: the generated test-root module lies in the run's output directory, and DMD wrote that path into the object (the ELF file symbol and
__FILE__strings), as it does any source path,-gor not.
Work around both in the graph, or fix DMD?
Alternatives.
- Rewrite archives after the compile: the executor zeroes a declared archive's member headers (as
llvm-ar Dwrites them). Fixes the archives only. - Compile a fixed stub: a checked-in
dub_test_root.dthat mixes in the generated body through a string import, so DMD names only the stub's root-relative path. Fixes the test roots only, and couples the graph to a file in this repository. - Exempt DMD from the determinism check: hides both.
- Fix DMD: build it from a fork, as LDC is built.
Choice. Decided by the owner on 2026-11-22: fix DMD. The toolchain's dmd is dlang.nix's dmd-sparkles, built from PetarKirov/dmd sparkles/main: DMD master with three changes written for upstream (each on a fix/* branch there):
-libwrites every member header with time, owner and group zero, asllvm-ardoes by default;-ffile-prefix-map=<old>=<new>, GCC's and LDC's option, mapped in__FILE__,__FILE_FULL_PATH__, assert, bounds and-covfile names, the object's file name and DWARF's compilation directory and file tables;- an output file is written in as many
write()calls as it takes.
So a DMD compile takes BGA5's prefix map, spelled -ffile-prefix-map=, for the root and for the generated test root, and no DMD variant takes its fallback: DMD variants share across worktrees, as LDC's do.
Trade-offs. The toolchain's DMD is master, not a release, and Phobos is master to match: a regression there reaches the DMD job first. A DMD without the option (a release, before upstream takes it) rejects these compiles; the graph plans for the toolchain's compiler only.
A third cause reached CI afterwards, and only now and then: the backend folded an operator into a constant in place and kept part of an operand's heap address in the constant's unwritten bytes, which a constant pushed as a stack argument carried into the object (sparkles-test-runner.o, CI run 45970839226). The fork fixes it too (UD12, UD13 in the upstreaming plan), and reads a constant stack argument from only its own bytes (UD14), so a future producer of such bytes cannot reach the object that way; the dlang.nix pin moved to it on 2026-11-28.
Revisit when upstream DMD has -ffile-prefix-map, reproducible -lib and UD12–UD14 in a release: build that instead, and drop the fork.