Skip to content

Build Systems: Application to Sparkles ​

Build-system research can guide two different decisions in Sparkles: how to orchestrate repository checks, and whether to build an incremental engine for D compilation. The first needs dependable ordering, isolation, and reporting. The second also needs a definition of reusable results and complete inputs. Capabilities useful to one are not automatically requirements for the other.

This page connects the research comparison to those decisions. It separates the task-DAG branch implementation from its execution contract and from experiments that could justify extending it. A task DAG is a directed acyclic graph of work and ordering constraints; its branch-specific specification is identified in §1. This page does not select a cache protocol, promise a build engine, or amend that specification. The baseline below establishes what can be relied on; the investigation plan identifies what evidence is still needed.

Last reviewed: November 4, 2026

1. Baseline and evidence boundary ​

The research is published independently of the task-DAG implementation. Its application baseline is the separate feat/task-dag branch, inspected at commit 8c39474f2f9e5f0ecf1e0095c4de9b87c528d704. The Git locators below identify local source objects; they do not assume the branch is published. For example, a repository containing that commit can retrieve its model with:

bash
git show 8c39474f2f9e5f0ecf1e0095c4de9b87c528d704:libs/build-primitives/src/sparkles/build_primitives/task/model.d

For the branch evidence below, task/ expands to libs/build-primitives/src/sparkles/build_primitives/task/ at that commit. The task-DAG specification and delivery plan are docs/specs/build-primitives/task-dag/{SPEC,PLAN}.md in the same Git tree. These locators remain separate from the clickable sources available in the standalone research checkout.

SubjectEvidence inspectedWhat it establishes
Recipe vocabularydub_manifest.dShared types describe declared DUB settings; effective settings belong to dub describe
Recipe lookupdub_recipe.dSDL, JSON, and single-file recipes expose package names, configurations, and subpackages
Repository inputsglob_walk.d, git_env.dFile selection and a scrubbed Git child environment are available primitives
Task vocabularytask/model.d and task/action.dStable semantic task ids, separate presentation keys, conditional edges, typed outcomes, and process actions exist in source
Graph and executortask/graph.d and task/executor.dGraph validation and stable ordering are separate from weighted admission and action execution
Task-DAG contractTask-DAG SPEC.md, IntroductionThe execution contract excludes persistent scheduler state and distributed admission
Delivery boundaryTask-DAG PLAN.mdA specification is not evidence that every associated build-graph capability has been delivered

The application analysis is conditional on that pinned branch baseline. The source inspection establishes the structures described here; it does not rerun the branch's acceptance suite or establish delivery of a content-addressed build engine.

The available recipe types are not a resolved build graph. In particular, the recipe module's contract leaves effective import paths, versions, and compiler flags to dub describe. Hashing the recipe text alone would not establish complete action identity.

2. Orchestration and build reuse ​

The task-DAG specification's Introduction separates task execution from the consumer's build graph and excludes persistent scheduler state. This is a scope choice. A scheduler that runs requested checks does not need to own the compiler's incremental cache to provide useful orchestration. Planned build-store behavior is a separate contract; its specification is not evidence that the task executor already implements a rebuilder.

ConcernSpecified behaviorResearch implication
Logical identityTaskId names semantic work; PresentationKey orders output (model.d)Keep user-facing identity distinct from cache validity
Conditional workEdges carry success, failure, completion, or unconditional conditions (model.d)A future reuse mechanism needs a defined meaning for branches and failures
OutcomesSuccess, failure, skip, cancellation, blocking, and degradation are modeled (model.d)Reusing a process exit code alone may discard relevant orchestration semantics
ReportingThe task contract requires deterministic buffered replay and summaries (§6–§7)Preserve reporting behavior independently of any cache lookup order
IsolationSandboxPolicy.taskDirectory names private DUB homes, build roots, output, and coverage locations (action.d)Directory separation addresses write collisions; it does not establish read-set completeness
PersistencePersistent scheduler state is outside the task contract's scope (Introduction)Reusing dependency sources differs from reusing task results

These are design properties to validate against the specification's acceptance criteria. The survey does not establish that they are unique to Sparkles, or that richer outcome types alone make an engine more correct.

An orchestration edge does not necessarily identify an input artifact. Cleanup ordering and failure fallback are control dependencies in the specified edge model (SPEC.md §3.2). A future cache trace or provenance statement needs to distinguish those edges from the data actually consumed; recording every declared edge, or only every taken edge, is insufficient without that distinction.

Logical identity and reusable results ​

Candidate design: retain stable TaskId values and introduce a separate action key only for work whose reuse contract is defined. A logical task such as a package test remains recognizable when its inputs change; an action key changes when a relevant input, tool, or execution setting changes. Output digests describe resulting bytes. These identities serve different purposes, as the concepts page explains.

There is no demonstrated requirement to replace TaskId with a content hash. The model in task/model.d already separates task identity from presentation order. A prototype needs to test whether one logical task can map to several action keys across configurations while retaining stable reports. That is an interface question, not evidence that caching is unreachable with stable ids.

A process action's declared arguments, environment, and working directory are only a starting point for an action key. A sound reuse contract also needs relevant tool and input identities, output completeness, and a policy for ambient state. Redacting secrets from logs does not by itself implement an attestation format or define whether a secret affects cache validity; provenance and reproducibility treat these as separate concerns.

3. Candidate capabilities and their justification ​

The order below is a research priority, not a delivery commitment. Catalog inference: measuring the local workload should precede choosing distributed storage or semantic caching. The corpus contains relevant mechanisms but does not measure their benefit for Sparkles.

PriorityWorkload and demonstrated needCandidate benefitPrerequisite and unresolved question
FirstRepeated local package checks; redundant work has not been quantifiedIdentify avoidable planning, compilation, and test executionMeasure the existing DUB cache before adding another reuse layer
FirstA hypothetical task-result cache must distinguish relevant editsReuse safe results while retaining stable task namesDefine complete inputs and output validity; decide which tests may depend on ambient state
NextD compilation with generated imports or non-source inputsDiscover dependencies without duplicating compiler semanticsMeasure DMD/LDC dependency reporting and test its coverage
NextConcurrent checks with private build roots, as required by the task specAvoid write races and preserve trustworthy coverageMeasure isolation cost and check which reads remain ambient
ConditionalRepeated generators producing identical artifactsStop downstream work when consumed artifacts are unchangedDefine artifact boundaries; demonstrate avoided work exceeds identity-check cost
ConditionalA measured working set exceeding a cache budgetBound storage without serving incomplete resultsFirst establish a cache workload, retention needs, and missing-blob recovery
DeferredRemote workers or shared resultsShare expensive actions across machinesEstablish demand, input closure, toolchain provisioning, and failure semantics
DeferredConsumers requiring build-origin evidenceExport a statement about an artifact's productionDefine the consumer, trust boundary, materials, and signing authority

The semantic-caching, CAS-eviction, and distributed-dependency pages supply candidate mechanisms. Their presence in the survey is not evidence that this workload needs them.

4. Investigation plan ​

Each investigation records tool revisions, command lines, build mode, machine, input edits, execution logs, and final artifacts. Timing studies separate cold and warm DUB caches, use repeated runs, and report dispersion. Correctness scenarios compare with a clean execution and deliberately remove or corrupt retained state. A passing timing run cannot establish dependency completeness.

A. Establish the cost of repeated checks ​

Decision blocked: whether a task-result cache adds value above DUB's existing behavior. Hypothesis: some repeated checks spend enough time outside reusable compilation to justify persistent task metadata.

Run an unchanged check twice, then repeat after a private implementation edit, a public interface edit, a compiler-flag change, and a deleted output. Record wall time, planning time where observable, compiler invocations, test-process invocations, and bytes read or written. Hold package selection, coverage, build type, and compiler fixed; separate source-cache and compiled-cache warmth. A negligible avoidable cost argues for retaining orchestration alone. A substantial cost identifies which task kind warrants a reuse prototype.

B. Test identity and invalidation before persistence ​

Decision blocked: the key model for reusable work. Hypothesis: stable logical task ids can coexist with configuration-specific action keys.

Use one small package in two configurations. Change source content, flags, compiler identity, environment, and a generated input independently. Assert which action keys change and which logical ids remain stable; delete an output and require reconstruction or execution. Compare resulting artifacts with clean builds. Avoid using the same key-building function as the oracle. If two behaviorally different actions collide, the input model is incomplete; if stable reporting breaks, revise the mapping rather than assuming logical identity itself must become content-addressed.

C. Measure dependency discovery and isolation ​

Decision blocked: whether compiler reports suffice for D actions, and whether observation is needed as an audit. Hypothesis: compiler-emitted dependencies cover ordinary imports at lower cost than general observation.

Create fixtures with generated imports, conditional imports, a missing file that later appears, and compile-time file access. Compare emitted dependency sets with deliberate edits and clean-build results. Measure reporting cost separately from compilation, then compare execution in ordinary and private build roots. Record compiler version, configuration, filesystem, and kernel; do not transfer Rattle's or BuildXL's published overhead to a D compile step. An omitted behavior-changing input rejects the proposed coverage claim, even when the timing result is favorable.

D. Test additional mechanisms only after their trigger is observed ​

DecisionMinimal experimentMetrics and confoundersResult that changes the recommendation
Static stages or graph extensionA generator emits a dependency plan consumed by a later compileExtra planning latency, changed-edge correctness; hold compiler work fixedCorrect staged execution may avoid a more general dynamic scheduler
Artifact-level early cutoffEdit a generator input while preserving generated bytesDownstream actions avoided versus hashing cost; control timestamp handlingNet savings justify a distinct consumed-artifact identity
Reachability or recency evictionReplay a measured action/output access trace under equal byte budgetsHit rate, retained bytes, incomplete-result recovery; use the same initial cacheA repeatable benefit is needed before adding graph-aware retention
Build-origin exportMap a real consumer's required materials to one completed actionMissing materials, secret exposure, verification behaviorOrdering edges alone are insufficient if required input identities cannot be reconstructed

Sources ​

  • Task-DAG specification and delivery plan, at the Git locators in §1: target orchestration semantics, not implementation-completion evidence.
  • Pinned task model, action, graph, and executor modules: inspected branch implementation. The linked recipe and repository-input modules describe reusable primitives in the research checkout.
  • Comparison and concepts: prior-art findings and model vocabulary. Proposed experiments above have no measured outcomes yet.