Skip to content

DraftOwner apps/ciReviewed 2026-11-01

apps/ci commands on the task DAG — Specification ​

Abstract ​

apps/ci is the repository's CI tool: it tests and builds every package, runs and verifies documentation examples, checks links, citations and the docs site, and reports CI statistics. This specification defines its command tree and the task graph each command plans. Every command runs on one executor and one reporter, and every compile goes through one content-addressed build graph, so a ci pipeline run checks everything CI checks, in parallel, without compiling the same library twice.

Introduction ​

apps/ci grew one flag per job: --test, --build, --example-files, --check-vcs-urls and dozens more. Each owned its own loop, worker pool, fail-fast logic and output. The jobs could not share work or run together, and their logs depended on timing.

This specification replaces the flags with a command tree whose commands only plan. Each command turns its inputs into a task graph. The generic task DAG executes and reports that graph, and the build graph supplies its compile, link and test actions, shared across commands, worktrees and machines. ci pipeline plans the union of every CI job as one graph.

The task DAG owns the model, edges, admission, cancellation, determinism and reporting rules, and the build graph owns compilation and caching. This document does not restate either. It owns the command surface, the repository's selection policy, the graphs of each command, and coverage publication. Jobs that need a different host operating system appear in ci pipeline as explicitly skipped tasks rather than being dropped.

Section 1 defines the command surface and §2 the mapping from the removed flags. Section 3 compares the design with Yarn's workspace commands, and §4 states the repository's selection policy. Section 5 gives each command's graph, §6 the build and coverage locations, §7 the module layout, and §8 the acceptance criteria. Delivery order is in PLAN.md.

1. Command surface ​

1.1 Canonical commands ​

text
ci pipeline [--from SELECTOR...] [--since REF] [--dependencies] [--dependents]
            [--backend local|nix] [--require-cached KIND...]
            [--determinism-sample N] [--placement NAME]
ci placements list [--provider github|circleci] [--github-output FILE]
                   [--history-remote URL]

ci build [PACKAGE] [-c CONFIGURATION] [-b TYPE] [--compiler DC]
ci run [PACKAGE | FILE.d] [-c CONFIGURATION] [-b TYPE] [--compiler DC] [-- ARGS...]

ci test [PACKAGE] [-c CONFIGURATION] [-b TYPE] [--compiler DC]
        [--build-only [--host CONFIG...]] [--special-modes off|betterc|wasm|all]
        [--from SELECTOR...] [--since REF]
        [--dependencies] [--dependents]
        [--coverage | --no-coverage] [--sanitize off|address]
        [--slow [--tests NAME...]] [--backend local|nix]
        [--require-cached KIND...] [--watch]
        [--placement NAME --shard K/N [--history-tip COMMIT]]
        [--history-remote URL] [-- RUNNER-ARGS...]

ci examples run|verify|update [--include-files SELECTOR...] [--exclude-files SELECTOR...]
ci examples standalone [--include-files SELECTOR...] [--exclude-files SELECTOR...]

ci check commit-scope [COMMIT_MESSAGE_FILE|-]
ci check reference-links|vcs-urls [--include-files SELECTOR...] [--exclude-files SELECTOR...]
ci check blob-paths [--clone-root DIR] [--include-files SELECTOR...]
ci check sidebar|glossary|credits|spec-evidence
ci check adhoc-sdl|opaque-recipes
ci check pin-cache
ci check wasm-modules|nix-wasm [module options]
ci fix reference-links [--include-files SELECTOR...] [--exclude-files SELECTOR...]
ci fix spec-evidence-backlog

ci docs fences-audit [--root DIR] [--audit-scope site|all|excluded] [--json FILE]
ci docs stage-wasm

ci github mirror-checks [--repo R] [--sha SHA] [--skip-check NAME...] [--no-write]
ci github link-rot-issue [--repo R] [--report FILE] [--rotten] [--run-url URL]
ci stats [--merges [--badge-dir DIR]] [statistics options]

ci commits build-each [--base REF] [--packages NAME...]
ci cache seed-dub | stats | list | gc
ci cache prune-layouts [--older-than AGE]
ci cache pin-costs FILE [--history-remote URL]
ci cache gc-r2 [--keep-commits N] [--grace-days N] [--no-delete]
ci cache verify [--rerun [--determinism-sample N]] [--key KEY...] [--task TASK...]
ci cache remove --key KEY... | --task TASK... | --package NAME... | --toolchain ID
ci cache replace TASK...
ci cache explain TASK
ci host probe
ci slow-tests list
ci gc-report RECORDING [--baseline RECORDING] [--top N]

ci perf record TASK -- COMMAND...
ci perf push [--allow-dirty] [--signing-key KEY] [--history-remote URL]
ci perf import RUN --repo R
ci perf append --records DIR --run-id ID [--run-attempt N] --run-date DATE
               --landed-commit COMMIT [--signing-key KEY] [--history-remote URL]
ci perf show|compare|history|fetch [options]

Every command that executes a graph accepts these (ci build and ci run, of them, --jobs, --output, --log-level and --cache-dir):

OptionDefaultMeaning
--jobs Nhost-derived capacityPositive weighted capacity available to running tasks. It is not a count of OS threads.
--interlacedoffStream line-atomic, task-prefixed output as events arrive instead of replaying complete task blocks in presentation order.
--dry-runoffDiscover, select, plan, validate, and print the DAG without running task actions, making network requests, creating directories, or writing files.
--output MODEautoci test, ci build and ci run: status lines (CIC19), with the live view (CIC18) on a terminal outside CI (auto), always (live, never under ci run) or never (lines); plain writes the ordered transcript (TDO3) instead.
--table STYLEcleanci test only: the status lines' task rows in aligned columns (clean), or framed, separated and headed as well (boxed) (CIC19).
--no-timelinetimeline onci test only: leave the timeline out of the live view.
--legs LEGSautoci test only: the ordinary tests' legs (CIC6). auto runs the placement's, or -t N alone; parallel, serial or both overrides.
--fail-fastoffOn the first authoritative failure, stop admission and cancel the command scope.
--log-level LEVELinfoStandard Sparkles logger level.
--cache-dir DIR$XDG_CACHE_HOME, else ~/.cacheThe cache home: the store, the run directories and the perf history live beneath DIR/sparkles. An empty directory runs with nothing cached (CIC20).

CIC20: The cache home is an option. Every ci command must accept --cache-dir DIR, before or after its name, and keep what it caches beneath DIR/sparkles. Without it, ci must read XDG_CACHE_HOME as the option's environment fallback, and then use ~/.cache; every command's --help names the option and the variable. Pointing it at an empty directory, --cache-dir "$(mktemp -d)", is how a run builds and tests everything from scratch without disturbing the shared store.

CIC1: Common options. --jobs 0 and negative values must be errors. --dry-run --interlaced must be rejected, because a dry run has no task output to interlace. Without --jobs, SPARKLES_CI_JOBS sets the capacity, and an explicit --jobs wins over both. Both count weighted capacity units (TDM7), not concurrent tasks, so a workflow that meant two concurrent builds sets 4. Invalid combinations fail before any task runs. Repository workflows pass --interlaced.

CIC18: The live view. On a terminal, ci test must keep its status lines (CIC19) and draw a live view beneath them (task-DAG TDO8, TDO9), unless --output lines, --output plain or a CI service says otherwise; --output live draws it anywhere. While the view is up, every line the console writes must print above it, never beneath it. The view must show, from the top: the tasks still to finish as a tree, each under the task waiting on it, the roots flush left, failures first, then the longest-running, fitted to its rows (fitTree), each named as the status lines name it; the failures, newest first, with the reason and the last lines of the newest; the slowest finished tasks and the running ones as a timeline against a round axis that only grows (10s, 20s, 30s, 1m, 2m … roundAxis), so a running bar grows to the right, in the rows left, when the terminal is at least 50 columns wide, unless --no-timeline; a tally of running, executed, reused, pending and failed tasks with the elapsed time, a task that looks up first (task-DAG TDM7) pending until it is charged; and beneath it, once the executor has admitted anything, the admission line (CIC28). Every duration it shows — a running task's, a bar's, the elapsed time — must be written and placed as the status lines write theirs: one decimal, ending at the terminal's right edge. It is drawn with sparkles:ui widgets in the terminal's own 16 colours and erased once the transcript's summary is above it, so the scrollback is the same with the view or without it. --output live with --dry-run must be rejected.

CIC19: Status lines. Unless --output plain, ci test must report through ci's console, in the one line form of sparkles.base.status_line (base CON1): a verb right-aligned in twelve columns and coloured by what happened, the subject, the details muted. Every log record ci writes takes the same form, its level as the verb. Each task's line is a row of columns — the verb, the package, the variant (a test's leg, another task's role), the task's handle, a note and the time — each column as wide as its widest entry in the planned graph, so every row lines up with the first. The time is always the last column, right-aligned to the terminal's right edge as the live view's durations are, and always has one decimal (423.0ms, 8.9s, 2.6m). Every size ci writes, in a status line or a log record, is in binary units, with one decimal from KiB up, as sparkles.base.text.writers.writeBytes writes it (512B, 512.0MiB, 51.5GiB); a line that also serves a script, such as ci cache stats's, gives the exact count first. The handle, kind:key[:leg] with the key cut to six digits, names the task to ci cache explain. The rows are laid out by the table component (sparkles.ui.components.table): --table clean aligns them alone, --table boxed frames them under a header, with a failure's lines spanning the columns beneath its row. By default the console must show:

  • a heading naming the selected packages and the compiler;
  • each compile, link and test that ran, with its time, and why it ran when a file changed; a test with its counts, failures first;
  • each failure, with the lines its child wrote that explain it (a test leg's passing tests and summary left out), fenced and masked for the CI service as the plain transcript is (task-DAG TDO7);
  • each notice a task's driver reports (task-DAG TDM21), as it arrives and whatever the task's outcome: a Warning row per line at LogLevel.warning, fenced for the CI service at that level;
  • a summary: the packages, the time, how many results were reused and how many tasks ran; then each package's coverage, past six packages the total and the three lowest;
  • the run's summary (CIC29): what it planned before it runs, and at its end its phases, what it reused, its bottlenecks, its disks and its memory.

What explains a run but asks nothing of anyone — each result reused from the store, the fallback variants a run did not need, archives and generated modules, tasks blocked behind a failure, the host and the run directory — must be reported at LogLevel.trace, shown by --log-level trace. A failed run says so in its lines and writes no further error message.

CIC28: The admission line. While ci test runs, the live view (CIC18) must draw beneath its tally one line of what the executor admits (task-DAG TDO10): the tokens, the threads and the memory the running tasks are charged (task-DAG TDM18) against the capacity and the budgets, with the budget's cap beside it when the budget follows the memory available and the two differ (RAM 8.0GiB/9.4GiB (cap 23.1GiB)), the memory available to the run (CIC23) and the free space of the store's file system, the running and ready counts, and, when a ready task waits, why (WaitReason) and which task, named as the status lines name it. The line must fit the terminal's width in cells (a wide character takes two), or with --table boxed the cell its row spans: too wide, it drops the task's name, then the free memory and the counts, then shortens its words, and is cut only when nothing else fits, never inside a character. It is redrawn with the view, and the free memory and disk are read at most once a second, the disk by one statvfs of the store's directory. Without a live view (a CI service, --output lines), the same line must be an Admitting status line, written when an admission state arrives at least 30 seconds after the last one written and a task waits, so a long run's log gains at most two lines a minute.

text
tokens 12/32 · threads 20/64 · RAM 14.2GiB/49.5GiB held, 31.0GiB free · disk 210.3GiB free · 8 running, 5 ready · next waits on memory: compile ui [library]

CIC29: The run's summary. A ci test run of the ordinary or the sanitized tests, or of what they build (--build-only), unless --output plain or --dry-run, must say what it is about to do and, at its end, what it did. (--slow, --special-modes and --watch run graphs of their own and report neither.)

  • Once planning ends and before any task runs, a Planned line: the actions planned, together and by kind (compile, archive, link, generate, test, other), and whether the plan was the one kept for the request (BGP2). Whether an action is reused is known only as it runs, when its key is derived from its inputs, so the line counts no hits.
  • After the run, its coverage merge and its records, beneath the run's own lines:
    • Phases: the time of each phase, one after another — startup (from the process's start, a re-execution into its scope (CIC22) included, read as planning begins), the toolchain's identification, planning or the kept plan's check (named fresh or reused), preparing the run, the run (the executor's setup included), the store's work after it (peaks, timings, eviction), the coverage merge and the run's records — what they leave of the total, and the total, from the process's start to the summary;
    • Actions: for each kind, how many ran (and failed, or fell back to the plain retry, CIC7), how many were reused, how many were not needed (a fallback whose attempt succeeded), and how many did none of these;
    • Busy: for each kind, the wall time any of its actions ran, and the time they ran for together;
    • Critical: the longest chain through the graph, each task weighing the time its action ran, as the driver timed it (a reused one nothing), and its longest four tasks in the chain's order; left out when nothing executed;
    • Slowest: the five slowest actions that ran;
    • Waited: how long the first ready task waited, of the time the executor admitted, and the share of each reason, from its admission states;
    • Disk: each watched file system's free space at the start and after the store's eviction, and the change (CIC23);
    • Memory: the run scope's measured peak (its memory.peak, CIC22), the most the running tasks were charged at an admission pass (task-DAG TDM18: each its prediction, or its sampled peak when larger), and the budget, with its cap when that differs.

The summary must be gathered from the run's events by an observer (task-DAG TDO11) and the phases' clocks, reading nothing else while the run goes, so a warm run is not measurably slower for it. Its executed and reused counts must be the driver's (RunStats), which knows what the events cannot: an action that failed before its process started ran nothing, and a result its digest record served (BGS5) may be made later all the same. It must be kept as JSON (format 1; durations in seconds, sizes in bytes, a value not measured null, with the run's exit code and the budget's cap, null when the executor reports none) in the run directory as summary.json and beneath the cache home as sparkles/runs/last-summary-1.json, for ci stats or a CI step to read, under --output plain too, which writes no lines of it. A run whose events did not end keeps no summary.

CIC2: One-node graphs. A command that is a single check, such as ci check sidebar, must plan a one-node graph. It runs through the executor and reporter, so its outcome, exit status and output follow the same rules as every other command. A check over many files that §5.6 splits per file may plan at most eight parts instead, each a contiguous batch of its sorted items (files, or clones) labelled with its first and last, and the report after them, and does so only where that is faster than its single node. The parts run on a blocking pool at once, each item's diagnostics kept apart, and the report prints them in the items' order, so its messages and exit status are the single node's. After a failed item the report prints nothing, as the single node stopped by that failure printed nothing; a rewrite's parts, writing at once, may have written items after the failed one, which the report does not list. The transcript writes only what did not simply succeed (TDO12), and its summary counts the parts and the report. The outcome is an interrupted run's own status, else the first failed item's in order (an item whose part never ran fails, named), else the report's failure, else, when the run ended otherwise than by success, a failure with the run's exit status.

CIC3: Backends. --backend local, the default, runs build actions on the local executor and the shared store. --backend nix lowers them to Nix derivations, which run on the configured remote builders as well (build graph §10). Non-build tasks run locally under both.

ci test, ci pipeline and the ci examples commands also accept --host-system SYSTEM and --host-ci-rev REV, which re-run the command inside a Linux VM from macOS, as the old flags did.

ci github mirror-checks reads the GitHub API even when it writes nothing. So its rehearsal option is --no-write, not the common --dry-run, which forbids network access. ci cache gc-r2 --no-delete lists the bucket for the same reason.

CIC16: Commands report through Expected. Each command's handler must return its outcome as an Expected value: success, a failure with its message and exit status, or a skip. The program's entry point turns that value into the exit status and the diagnostic. No handler calls exit or returns a bare status integer. A command that runs a child process, such as ci perf record, fails with the child's exit status.

1.2 ci test modes ​

With no mode option, ci test creates ordinary unittest tasks. Coverage is on by default for this mode and can be disabled with --no-coverage.

ci test --build-only builds what the same command without it runs, and runs nothing: for each package that command selects, its test binary as it builds it, the dependency-library variants it links, and the programs its tests run (build-graph D61). The test binary is the -cov attempt with its plain fallback (CIC7) while coverage is on, the sanitized variant under --sanitize, and the plain binary under --no-coverage, --slow and --special-modes. So the same command after it, its inputs unchanged and the results still in the store, must execute no compile, archive or link of the build graph; the ordinary and sanitized tests also take the plan it kept (build-graph BGP2). The programs an extracted mode compiles while its leg runs are the test runner's, outside the graph, and are not built ahead. --build-only and --watch do not combine: a watch's rounds run dub test, whose builds are not the graph's.

ci test --special-modes MODE creates the test runner's extracted special-mode tasks:

  • MODE is a wired enum whose CLI spellings are off (the default: ordinary tests), betterc, wasm and all; core-cli's ?/help value-help forms list them.
  • A selected package gets a task only for marker attributes present in its sources, and only if it integrates sparkles:test-runner.
  • Every special invocation passes --require-toolchain.
  • An empty repository-wide special-mode plan is an error, not a successful no-op.
  • Coverage is invalid.

--sanitize address builds and tests every selected package under AddressSanitizer, as a separate variant; it requires LDC on Linux. --slow runs the @slow tests instead of the ordinary ones, optionally only those named by --tests.

--special-modes and --slow are mutually exclusive; --build-only combines with either, and with --sanitize.

--host CONFIG, with --build-only, builds each selected package's default configuration for that host platform, named by its nixpkgs config, instead of its test root (build-graph BGH2); it may be repeated. Its tests do not run (build-graph BGH8), so without --build-only it is an error, and so is --host beside --sanitize, --slow or --special-modes. Its build type is -b's, debug (as dub build builds) without one, so a host's build can match one the Nix packages make (checked); its configuration is the one dub chooses for the host, so -c beside --host is an error.

CIC12: Required hits. --require-cached KIND... must fail every build-graph action of a listed kind (compile, archive, link, generate) that would execute instead of reusing a result. The action fails before it starts, with the miss's explanation (BGS8) as its diagnostic. A dry run reports which actions would fail. The actions the determinism check (CIC13) re-executes are exempt, since executing them is its purpose.

1.3 ci pipeline ​

ci pipeline plans, as one graph:

  • every ci test mode CI runs;
  • ci examples standalone and the markdown verification CI runs;
  • every ci check …;
  • ci check commit-scope for the commits of the range;
  • ci check pin-cache, the build-settings check (standardize-build-settings --check), and the native comparison archives that the Event Horizon examples link;
  • the configuration-specific test jobs CI runs, such as terminal's unittest-vulkan and base's unittest-portable, and the GPU shader lane, which is skipped where no GPU exists.

It runs on the build graph's shared store. Its --from and --since narrow the package-derived tasks only. Tasks that require another host operating system or another architecture are Skipped(platform) under the local backend. Under the Nix backend they run on remote builders of that system.

CIC13: The determinism check runs on every run. Every CI run must run the build graph's cold, unshared check (BGS9) over a sample of the actions its builds ran or reused, once they have finished. ci pipeline plans it as a task of its graph. A workflow that splits its builds across jobs runs ci cache verify --rerun --determinism-sample N in a job that shares their store, or in each job over that job's actions.

  • The sample: order the run's cacheable actions (compile, archive, link, generate) by the SHA-256 digest of the HEAD commit id followed by the result key. Take the first four compiles, and the first four actions of the other kinds together. --determinism-sample N changes four to N; zero is an error.
  • Rotation: the order changes with every commit, so successive runs check different actions, while a rerun of one commit checks the same ones.
  • Whatever the run did: the sample is drawn whether the run reused or executed an action. Each sampled action's result is compared with a fresh execution that bypasses its own lookup and publishes only to the check's private store.

A difference fails the task as an authoritative failure, naming the action and what differed, and removes the suspect result from the store. The determinism-check task itself is never skipped by a stored result, a shared verdict (BGX4) or any other memo of an earlier run.

CIC14: Placements. ci pipeline must partition its graph into named placements, each a host system, a runner class, a capacity, the test legs it runs and whether it collects coverage, declared in one data file:

  • Running one: ci pipeline --placement NAME runs that placement's tasks and the build actions they need. Every other task ends Skipped(placement), a skip reason beside platform; none is dropped from the graph.
  • Listing them: ci placements list prints the placements and their shards as JSON, and sets it as an output through the CI-provider module (TDO6). The repository's workflows take their matrices from that output, or, for the legs and node counts a workflow states, from the placements file through ci fix workflow-matrices, which ci check workflow-matrices holds them to. Listing is its own command, not an option of ci pipeline, because it plans nothing and runs on the API-only build of ci.
  • Shards: a placement's tasks are packed into its shards longest first, by the task.wall that the run records hold. A task with no recorded wall time takes a declared default weight.
  • One packing per run: every shard of a run must pack from the same records. The workflow's planning job passes the refs/perf/data commit it read to each shard (--history-tip). A shard given none reads the newest commit of the ref whose committer time is not later than the measured commit's, so CI providers with no planning job agree too.

Before ci pipeline exists, the same placements serve ci test in its ordinary, --sanitize address and --special-modes all forms, and the toolchain's build plan: ci test --placement NAME --shard K/N runs a shard's packages (PLAN M3a, OD21).

CIC15: No diffs on CI. The repository's workflows must not pass --since. On CI, reuse comes from keys, not from diffs. --since stays a local convenience.

Rationale: a diff depends on the base a run is compared with, which changes across rebases, reruns and the merge queue. A key depends only on the inputs. See build graph D43.

2. Removed flags ​

The flags in the first column below are not part of the command line. There is no legacy parser, alias, precedence table, or fallback dispatch.

Removed flagReplacement
--test, -tci test
--buildci test --build-only
--test-extractedci test --special-modes all
--test-sanitizeci test --sanitize address
--test-slowci test --slow
--packages (with --test-slow)ci test --slow --from
--packages (with --test)ci test --from
--files--include-files
--list-slow-testsci slow-tests list
--coverageci test --coverage
--example-files, -xci examples standalone
default markdown modeci examples run
--verify, -Vci examples verify
--update, -uci examples update
--dedup-reference-links, -dci check reference-links
--fix-reference-links, -fci fix reference-links
--check-vcs-urlsci check vcs-urls
--check-docs-sidebarci check sidebar
--check-glossaryci check glossary
--check-creditsci check credits
--check-spec-evidenceci check spec-evidence
--update-spec-evidence-backlogci fix spec-evidence-backlog
--check-blob-pathsci check blob-paths
--audit-fencesci docs fences-audit
--check-wasm-modulesci check wasm-modules
--stage-docs-wasmci docs stage-wasm
--build-each-commitci commits build-each
--check-commit-scopeci check commit-scope
--seed-dub-cacheci cache seed-dub
--check-pin-cacheci check pin-cache
--linux-host-probeci host probe
--mirror-checksci github mirror-checks
--mirror-checks --dry-runci github mirror-checks --no-write
--ci-stats, -Cci stats
--report-link-rotci github link-rot-issue
--watch (with --test)ci test --watch
--watch (with --build)none; --build-only builds once
--list-placementsci placements list
--check-adhoc-sdlci check adhoc-sdl
--check-opaque-recipesci check opaque-recipes
--check-nix-wasmci check nix-wasm
--gc-reportci gc-report
--write-pin-costsci cache pin-costs
--gc-r2ci cache gc-r2
--gc-r2 --dry-runci cache gc-r2 --no-delete
--record-taskci perf record
--perf-pushci perf push
--perf-import-github-runci perf import
--perf-appendci perf append
--perf-records, --perf-run-*ci perf append --records, --run-*
--ci-stats --mergesci stats --merges
--skip-packagesci test --placement --shard

CIC4: No removed flag survives. The parser must reject every flag in the table's first column as it rejects any unknown option, naming it and printing the help; the table is the migration map, not a list the parser keeps. Option-only flags keep their spelling on the command that owns them; for example, --json, --root and --audit-scope move to ci docs fences-audit, and --tests to ci test --slow.

CIC17: Commands are verbs over subjects. A pass/fail check is a command of ci check, and a check that rewrites what it checks is a command of ci fix, so ci check --help lists every check the repository's hooks and workflows run. Commands that act on GitHub are commands of ci github. A command group has no default action: a bare group reports the missing command with its help, and exits non-zero.

3. Yarn inspiration and Sparkles differences ​

The focused package selectors and output vocabulary intentionally resemble Yarn's workspace foreach command:

  • --from establishes workspace-like package seeds.
  • --since selects packages changed from a revision.
  • --dependencies and --dependents expand graph closure.
  • --jobs bounds parallel work.
  • --interlaced opts into immediate mixed output.

Sparkles differs in load-bearing ways:

Yarn-inspired ideaSparkles definition
WorkspaceA root dub.sdl sub-package with a stable package name and repository-relative directory. The root package is metadata, not an executable task.
Topological commandBuilds follow the in-tree dependency graph. Tests do not wait for other packages' tests, only for the builds their binaries need.
Job countWeighted capacity. A compiler-heavy task can consume more than one unit.
--fromMatches Sparkles package name, qualified name, or path. It does not mean "start at this textual position."
--sinceUses Git's changed paths judged by the packages' input sets, not directory ownership or workspace manifest timestamps.
Recursive selectionExplicit --dependencies and --dependents; there is no implicit Yarn -R/-A mode.
InterlacingLine-atomic, prefixed event streaming on TTY and non-TTY alike. Raw byte chunks are never written concurrently.
FailureA structured outcome, with blocked, cancelled, skipped, and degraded distinct from failed.
ExecutionEvent Horizon scopes, subprocesses, clocks, and wakeups only. No std.parallelism pool or polling thread is permitted.
CacheA content-addressed build store shared by every worktree. Test results are reused only under the build graph's rules.

4. Selection policy ​

Focused selection follows the task DAG's selection algebra. Only ci test and ci pipeline accept focused selectors; docs and example commands keep their file selectors.

CIC5: The repository's workspace inputs. A change to any of these must select every package under --since (BGW12):

  • the files planning reads that no package's input set claims: dub.sdl and the lockfiles dub.selections.json, nix/dub-lock.json and nix/ci-dub-lock.json;
  • the toolchain's and the shells' definition, which no plan reads and so is stated: flake.nix, flake.lock, nix/d-toolchain.nix, nix/shells/**, and nix/packages/**, which builds the native libraries and import paths every package's actions read;
  • the planner's inputs: the closure of sparkles:build-primitives, which plans and runs the work, and the input set of sparkles:ci itself (D54);
  • what the compiler's working-directory lookup could find: the D and C sources directly beneath the root, and the trees sparkles/, std/, core/, etc/ and ldc/ there.

Only the second and the module names are a list, in apps/ci/src/repository_inputs.d; the rest is derived, so it cannot name a path that is not there. A package's own recipe, and every other path, selects the packages whose requests claim it.

5. Command graphs ​

The diagrams show graph shape. Real node ids include package and file identity. Build nodes are the build graph's actions, shared by every command in one run and reused from the store across runs.

5.1 Package build-only ​

text
discover -> select -> plan builds
                   -> compile/archive/link (variant A) -> compile/archive/link (dependent B)
all selected build nodes --onCompletion--> run summary

A failed build blocks the builds that link against it.

5.2 Ordinary package tests and coverage ​

text
discover -> select -> plan builds
coverage build A = [-cov dependency libraries -> -cov compile -> -cov link]   (provisional)
coverage build A --onSuccess--> coverage test A                               (authoritative)
coverage build A --onFailure--> [plain compile -> plain link -> plain test]
coverage test A, plain test A --onCompletion--> classify A
all classifications --onCompletion--> merge coverage -> coverage-publish
all classifications --onCompletion--> run summary

CIC6: Test edges. A package's test task must depend only on its own test binary. Its binary depends on its test-root compile and on the dependency-library archives it links. No test waits for another package's test. A dependency whose library fails to build blocks the link of each test binary that needs it.

An ordinary test runs in the legs its placement names (CIC14): -t N on every placement, and -t 1, on each worker's main thread, on the one placement that also collects coverage. Both run with --skip-slow. The -t N leg runs tests on worker threads under the stack watermark, so a test that overflows a worker's stack cannot hide on the main thread, and a test that needs the main thread is marked @serial(threadAffinity: mainThread) and runs there in the same leg (TRS2). A sanitizer test runs one -t N leg on 4 MiB workers. Without a placement, as on a developer's machine, the -t N leg runs alone; --legs parallel|serial|both names the legs instead, with or without a placement (OD22).

CIC11: Tests through the runner core. ci must run a test binary through the test runner's core library, never through the standalone runner or dub (test-runner §9):

  • Nodes: each leg is one test action and one node, the build graph's unit of reuse. The -t N leg claims the processors the run may use and its quota pays for, not what their load leaves, and the run binds its claim and its -t (below; TDM10, build-graph BGA8). So a kept plan holds whatever the host's load (build-graph BGP2). It runs up to N worker sessions as supervised process groups (TDE1), places the binary's tests on them, and runs the @serial tests after the others. The -t 1 leg has weight one and runs each test on its worker's main thread.
  • Threads: a parallel leg planned at -t P claims, and runs, two numbers bound when the run starts, never planned, so a plan does not change with them, and both at most P and the run's capacity. With p the parallelism its last successful run reached, its workers' CPU, user and system, over its wall time (<cache>/sparkles/timings-v<format>, on Linux), its claim, the tokens it holds, is ceil(p), at least 1 and at most half the capacity, so the two longest legs' claims fit beside each other rather than one taking every token. Its threads, its -t, are ceil(1.25 p) + 1, at least the claim, and at least 8 when that run took 10 s or more. A leg no run has timed, and one whose record shows no CPU, runs 8 threads and claims as many, the claim at most half the capacity. The claim follows what a leg uses on average and the threads what it uses in its bursts, so legs overlap and fill the CPU; the run's thread budget, twice its capacity (TDM10), bounds what the running nodes' threads add up to. This binding is the one place a test's $JOBS is bound: every -t $JOBS is bound to the threads; without one, the last -t whose value is a count, the one the runner obeys. A vector that sets the threads itself, in another spelling (-t4, --threads=4) or as a -t <count> beside the plan's -t $JOBS, keeps its planned claim, its $JOBS bound to it clamped to the capacity, its own count as it is, and that count, the last the runner reads, charged to the thread budget (decision T18).
  • Trace: ci test --trace-admission=FILE writes the run's admission trace (task-DAG TDO10) to FILE.
  • Output: the leg's output is the lines the core's plain-text renderer makes of its events, and its observations include the passed, failed and skipped counts and the failed tests' names (TDM11). ci's reporters render them as any task's output; ci has no test reporter of its own.
  • Options: ci passes the runner options through the core's parser, and a leg's outcome is the core's verdict, so ci test and a plain dub test agree on which tests ran and on what failed.
  • Coverage: a coverage leg's workers write to the leg's task directory, ended one at a time with the coverage merge (CIC7).

CIC7: Coverage attempts. Without coverage, each package has one test node and one classification node. With coverage:

  • The coverage build: the -cov builds of a package's test binary form one chain: the -cov dependency libraries, the compile and the link. Every node in it has a provisional failure policy. A failure anywhere in it, and the provisional blocks it causes, neither triggers fail-fast nor fails the command (TDC4).
  • Repository packages only: only a target whose directory lies in the repository, and that is no registry package by name, is built with -cov. A registry package is built as the plain test builds it: its coverage is never reported, and instrumenting it would only lengthen its compile. Its variant, keyed by its settings like every variant (BGV1), is then the plain test's, and both requests share its actions; its literal -cov flags go too. A registry target whose settings without coverage still differ from the plain test's (a recipe's own unittest-cov build type) keeps its coverage and shares nothing. Shared actions are the plain chain's, not provisional: a failure of one fails the command, as it would fail the plain test. A registry source library that folds into a repository target compiles with that target, -cov included.
  • The fallback: the plain compile, link and test sit behind an onFailure edge from the coverage link. They run only when the coverage build failed, and otherwise end Blocked(conditionUnmet), which the summary counts as unneeded.
  • The test is authoritative: once the coverage build succeeded, the coverage test is the package's only test. A failing coverage test is a failure, never retried without coverage.
  • Classification: a passing coverage test classifies the package Succeeded. A failed coverage build with passing plain tests is Degraded(noCoverage). A failing plain or coverage test is Failed.
  • Listings: each coverage test writes its listings to its own task directory. LDC coverage variants use --cov-increment=atomic, because tests run on several threads. The test binary receives --DRT-covopt with dstpath: set to its task directory and srcpath: set to the worktree root, so the root-relative paths it records resolve.

5.3 Extracted test modes ​

text
discover -> select -> scan marker attributes
                   -> better-c(package A)
                   -> wasm(package A)
                   -> wasm(package B)
all special nodes --onCompletion--> run summary

The marker scan is a planning action. Different modes for the same package are independent unless resource capacity serializes them.

5.4 Markdown examples ​

text
discover markdown -> parse each file -> build and run each runnable example
                                     -> skipped directive outcome
execute nodes --onCompletion--> file run/verify reducer
file reducers --onCompletion--> command summary

update only:
file reducer --onSuccess--> atomic rewrite(file)
  • Shared machinery: docs run, docs verify and docs update share discovery, extraction, in-tree dependency rewriting, building, process execution and result models.
  • Run renders captured output, and verify compares normalized output or wildcard patterns.
  • Update computes a complete replacement in memory and writes a file only when every required example in that file succeeded.
  • Concurrency: multiple files may rewrite in parallel; one file has one exclusive write key and one atomic rename.

CIC8: Examples reuse planned variants. Each example must be a single-file package. Its planner picks the build type whose dependency-library variants the same run already plans, so examples add no library compiles. Without tests in the run, it picks the application variants. A build type that removes assertions is never chosen. Its extracted source must live at a content-addressed path (build graph BGG4), so an unchanged example is not recompiled. Input order defines presentation order even when execution is parallel. Two examples whose recipes give one package name, in two directories, are two packages: the second is planned under its name and its directory's digest, its binary keeping its name.

CIC27: No example starts dub. ci examples run, verify, update and standalone must build and run every example on the build graph, in one run that shares its dependencies' actions, and start no dub process. An example the graph cannot plan must fail with the reason planning gives; it is never built another way. An example that fails to resolve fails alone; one whose variants the graph refuses (BGG7, BGV5) fails the whole run, which plans every example together.

CIC31: An unchanged example reuses its last passing run. An example's run must be a keyed action, published only when the program exits zero within its time limit, and reused while its key holds, the output it printed being its result. The key must cover what the run observes, as a declared test's would (BGX3):

  • The program: the binary, by its link's outputs digest, and its arguments, each also by an unambiguous digest of the list.
  • What it runs in: its working directory, the worktree's root; its environment; its time limit; and an empty standard input.
  • The machine: the system type, the kernel's name, release and version, and, on Linux, the first processor's model and features, as a shared verdict keys them (BGX4).
  • The handler: a protocol version, raised whenever what the run does with its arguments changes (its input, its environment rules, how its output is captured).

An example that observes anything else — the worktree's files, the host's configuration under /proc/sys or /etc, its fonts or desktop, a tool it runs from outside its binary and the store, the path of its temporary directory — must say so with the directive // ci: run-always (standalone) or <!-- md-example-run-always --> (Markdown, before the code fence), and then runs on every request.

The environment the program sees is ci's own, less what differs between two commands of one session (a shell's OLDPWD, SHLVL and _; the contained run's SPARKLES_CI_SCOPE and systemd's INVOCATION_ID, CIC22), with PWD naming the working directory and each temporary directory (TMPDIR, TMP, TEMP, TEMPDIR, NIX_BUILD_TOP) a new, empty directory of the run's own. The key holds every variable the program sees by its value, the temporary directories by a placeholder. So a run is reused within a session; a CI job, whose provider names every step and run in its environment, reruns its examples. An example's position in its file is no part of its key. A failing, timed-out or cancelled run is never published, so it runs on every request, whatever its exit status after the limit; so does a Node module, whose imports the graph does not know. A run whose stored output is gone misses and runs again. The reports name each example that was reused, and verification and update read a reused run's output as they read a fresh one's. Example runs are not part of the determinism sample (CIC13): their output may name the time.

Rationale: an example's reads at run time are not traced. Most examples read only what their binary holds and what the machine and the environment say; the few that read more declare it, as a test declares its runtime inputs. Keying the run's whole environment trades reuse across shells for never reusing a run whose colour, locale or display differed.

5.5 Standalone examples ​

text
discover example files -> parse platform/directive
                       -> skipped(platform)
                       -> build and run(file)
                       -> build(file marked build-only)
all terminal nodes --onCompletion--> command summary

// ci: build-only selects a build and never executes the binary. // ci: run-always runs it on every request, never reusing a run (CIC31). Run arguments remain part of the parsed directive. Platform-ineligible examples are explicit skipped outcomes. Missing selected files are failed planning nodes, so fail-fast and summaries treat them consistently.

5.6 Documentation commands ​

CommandDAG
docs links checkfile-read parts (CIC2) -> pure duplicate groups -> report node. Duplicate groups make the report fail.
docs links fixfile-read parts, each changed file's rewrite computed -> duplicate groups -> report -> write parts (CIC2), each changed file replaced whole by rename. Reads complete before writes.
docs vcs-urls checkscan parts over the selected markdown files (CIC2) -> deterministic violation reducer.
docs sidebar checkload sidebar + load docs config + enumerate tracked docs -> pure bidirectional consistency check -> report.
docs blob-paths checkparse citations -> index local clones -> query parts (CIC2), one batched git query per clone/revision group -> report. Missing clone/revision evidence is degraded; a resolvable missing path is failed.
docs fences auditload site config + select corpus -> parse/classification parts over the files (CIC2) -> aggregate inventory -> optional atomic JSON write -> report.
docs glossary, credits, spec-evidenceone check node, reading its inputs and reporting its violations.
docs wasm checkbuild the WebAssembly modules and their native counterparts -> one comparison node per module.

File selection preserves --include-files/--files and --exclude-files semantics. Inputs and diagnostics are sorted by normalized repository-relative path, then source position. Mutating commands never write under --dry-run.

5.7 CI statistics ​

text
resolve repository/options -> fetch workflow-run pages
                           -> fetch jobs for each selected run
job fetches --onCompletion--> normalize available jobs
normalize -> aggregate jobs/runners/steps/comparisons -> render report

ci stats keeps the data and filtering contract in ../stats/SPEC.md. Its network and decoding operations are task actions and emit ordinary progress events.

Statistics use these degraded semantics:

  • Failure to fetch the run list, authenticate, decode required response data, or obtain any authoritative population is Failed and exits nonzero.
  • Failure of one jobs page after at least one complete run remains is Degraded(partialPopulation). The report names omitted run ids, counts the complete population only, marks all totals partial, and exits zero.
  • A requested comparison side with no complete observations is Failed; a partial side is degraded and visibly marked.
  • Missing step timing, runner labels, or optional rate-limit metadata degrades only the affected view, and the report's node is Degraded(evidenceMissing) unless a partial population came first. It does not invent zero-duration observations. Every degraded report exits zero.
  • Unavailable process RSS/CPU sampling is a reported absence in the run record and a run degradation (observability OBD11), never a task outcome.

A degraded report must contain a warning in human output and a structured degradations[] field in JSON. It must never look identical to a complete report.

5.8 Commit checks ​

text
read message -> parse subject -> optional staged-path query -> policy check

ci check commit-scope uses the common models and summary but defaults to a compact reporter suitable for a commit hook. stdin is an explicit input action, not inherited by subprocess tasks.

CIC21: Every commit in one run. ci commits build-each must check out each commit of the range in a scratch worktree of its own, plan the selected packages there, and run every commit's plan as one graph against the shared store, each action in its own commit's worktree with the key, result and run paths a run of that commit alone would give it. An action must wait for its namesake in the commit before it exactly when it is predicted to share that one's key: the same action and outputs, no in-tree path its arguments name changed between the two commits, and every producer it reads predicted the same. It is then looked up after the earlier one publishes, and hits; every other action must start as soon as its own commit allows. A wrong prediction must cost only time. Each package the toolchain table lists for other hosts (the WebAssembly modules) must be planned once per host it lists (build-graph BGH2), the rest for the build platform. A package planning refuses must build with dub in one more worktree, walked oldest first, as tasks of the same run, with its host's compiler when it has one. A package must count as built at a commit for a host when every link of its application for that host, or its dub build, succeeds there.

CIC22: A heavy run is contained. On Linux under systemd, ci test, ci pipeline, ci commits build-each and the example commands must run in a transient user scope with the memory controller delegated to them (systemd-run --user --scope -p Delegate=yes), with MemoryMax at 85 % of total memory, or as --memory-max (falling back to $SPARKLES_CI_MEMORY_MAX) sets: a byte count, a percentage, or none. cimust ask the user manager for the scope itself (StartTransientUnit with the properties systemd-run sends, its process named as the request's sender, PID 0, which the manager resolves), as systemd-run reaches it: over the manager's own socket, else the session bus, where only the owner of the manager's name is heard. The scope is made when the manager reports the job done and ci is in it with the limit asked for. Only when the manager is not reached, refuses the request (an error reply, but for running out of memory), or reports the job failed with ci outside the scope does ci probe systemd-run with every option the run takes and re-execute itself in the scope it makes. A request the manager may hold without an answer, a job whose end is not heard, and a job done without ci in the scope as asked fail the command before it starts any action: a late move would leave what it started outside the scope (--memory-max=none runs it unconfined). Nothing about the answer is remembered between runs, so nothing can go stale. The scope sets no MemoryHigh: past it the kernel throttles every allocation, and a run whose predictions are too low crawls instead of failing, where at MemoryMax an action, its OOM score the highest, is killed and its limit kill teaches the next run (CIC23). Inside it, ci moves itself into a leaf so each action's cgroup is accounted (Event Horizon §13.7), and reports the limit and controllers the kernel gave it, read back. ci raises its own oom_score_adj to 900, so everything it starts inherits at least that, and every supervised action (a build action, a test worker, an example) runs at 1000: a shortage takes the run's actions first, then ci, and an out-of-memory kill at the scope's limit takes nothing outside the run. A ci in a scope it or a parent ci made, or in a cgroup its caller already limits, enters no other. Where no scope can be made (no systemd user manager, a container, none, total memory unknown), the command must run unconfined and say so. A dry run enters no scope and writes no cgroup. The repository's own CI sets none: a runner is disposable and runs nothing else, and 85 % of a runner's memory is less than its jobs had before containment.

CIC23: A run fits its memory and its disks. On Linux a run must admit its actions by memory (task-DAG TDM18), under a budget that follows the host. Its cap, computed once, is the memory.max of the cgroup that bounds it — the nearest of its own and its ancestors below the user manager with one: its scope (CIC22), a caller's limited cgroup, or the run a parent ci started it in — or, unbounded, 85 % of the host's memory, in both cases less ci's reserve: the larger of its resident set at the start and 2 GiB, which covers what it grows to over a run of every package, never more than half the limit. Below the cap, the budget is bounded each time the executor asks the gate (every admission pass, and at least every 250 ms while actions run; the memory available is read on every ask, the file systems and the pressure at most every 200 ms) by what the run's charged actions hold now, by the resident sets they last reported, plus the memory available to the run less the margin below which pressure holds (both below), without swap: it rises within a sample of memory being freed, and when it shrinks it only stops admitting, never stopping what runs; the scope stays the hard stop. The admission events carry both the budget and its cap (task-DAG TDO10). Each action's prediction is the largest peak recorded for it under its task identity without the key digest (<cache>/sparkles/memory/peaks-v<format>, a file per format, so revisions running at once never misread each other's): its processes' cgroup memory.peak where they were accounted and their sampled resident set elsewhere, from an action that succeeded or was killed at its own limit, never one that failed early, timed out or was stopped. A kill records the limit, so the next limit is twice that, up to the cap (never lowered by what other work holds, so an action too large for what the host has free runs alone, TDM18, rather than fail at it): a leak costs a few runs and stops at that limit, and a genuine need is met; a success after a kill, in a later run, replaces the kill, and a kill replaces only a smaller record; within one run a kill stands over a success of the same identity, a coverage compile's over its plain fallback's. Runs sharing the cache merge their peaks under a lock on the file, and a run that measured nothing new writes nothing. A test leg narrowed to fewer tests than its whole leg (ci test :base -- -i Buffer, any options after --, or --slow --tests choosing some) records neither its peak nor its wall time: it runs other tests than its leg under the same identity, and a filtered leg's small peak would set the whole leg's limit, killing it at each doubling until it fit. A special-modes leg running every mode its package has, or every slow test, is no narrowing; one running one of a package's two modes is. The files' formats changed with this rule: a cache's records of the previous format carry over but for the test legs', which such a leg may have set. An action on its kind's default, or on a record of such a kill, killed by SIGKILL, which nothing in a run sends but the kernel's OOM killer, records an oom kill at the larger of the peak it reached and twice the prediction it ran under: a victim of the scope may have been killed early, beside a larger action, so the record is a lower bound, which its next run is predicted at but which sets it no limit below the ceiling, and another such kill raises it again. A test leg's workers are not covered: the leg ends as an ordinary failure. One with no record takes its kind's default: 1.5 GiB for a test root's compile, 2 GiB for another compile, 256 MiB for a link, 4 GiB for a test leg, 512 MiB for the rest. While it runs (task-DAG TDM18), an action with no record, or with only an oom kill's, is charged more: a test root's compile 4 GiB, above the 90th percentile, and a link 512 MiB, about the largest (task-DAG TDM18), so a cold burst of them does not fill the budget on the low default, nor refill it as their first samples arrive. For a test root's compile and a link the default is about the 75th percentile of what the kind measures, not its largest; for another compile it is above the largest (1.9 GiB): the few larger actions are caught by the running nodes' reported resident sets, which stop further admission as they grow (task-DAG TDM18), by the gate's hold while memory runs short, and, past those, by the kill, which the next run learns from; a test leg's default is not lowered, since its workers report no resident set while they run (decision T18). Where the run's actions are accounted, each with a recorded peak runs with memory.max at twice it, at least 512 MiB and at most the budget, and one on its kind's default at the budget alone (task-DAG TDM20): a default admits, but a guess must not kill an action that would have fit; a test leg's workers run in one run group under the leg's limit (Event Horizon §13.7), which counts their peak together. Each action's predicted duration, which orders admission (task-DAG TDM8), is the wall time of its last successful run under the same identity, recorded with its CPU in <cache>/sparkles/timings-v<format> as the peaks are, each run's replacing the last; of two actions sharing an identity in one run, the longer is kept. A compile with no record takes 200 ms for each D module its argument vector names, at least 500 ms; one that names none, and any other action with no record, takes its kind's typical time: 6 s for a test root's compile, 3 s for another compile, 4 s for a test leg, 500 ms for a link, 100 ms for the rest (decision T18). The run's gate (TDM19) holds while the bounding cgroup's memory.pressure, else the host's /proc/pressure/memory, reports some over 10 % for the last 10 seconds while the memory available to the run is under a margin, a fifth of the cap, at least 4 GiB and at most half the cap, and whatever the pressure while it is under half the margin: pressure with memory to spare is reclaim, not a shortage, and holds nothing, and the pressure's ten-second average lags a fast allocation. The memory available is the host's MemAvailable and, under a bounding cgroup, at most its limit less its charge (memory.current), crediting only its inactive page cache and reclaimable slab; none when that cgroup's counters cannot be read. Both are heuristics: neither stops what already runs. It watches the file systems the run writes: the store's, the run directory's and the temporary directory's, each at its deepest existing directory and told apart by device. Each has a reserve, the smaller of 5 GiB and 10 % of its size, and a floor of half that. Under the reserve the gate evicts the store's results, when the store is on that file system, as far as the deficit, all of them if they are fewer, freeing their bytes (build graph BGS5) on a thread of its own, at most every 30 seconds, and holds unbounded; under the floor it cancels, naming the file system and its free space. The run reports each file system's free space at its start and its end. On other systems a run admits by tokens and its thread budget alone, each test leg unmeasured.

5.9 Maintenance commands ​

CIC10: Slow-test listing. ci slow-tests list must print the @slow tests as the JSON array the slow-tests CI matrix expands, and set it as the matrix output through the CI-provider module (TDO6). A @slow test without a name, or an empty list, is an error.

The other maintenance commands, ci cache, ci host probe, ci github mirror-checks and ci github link-rot-issue, are one-node graphs (CIC2) over their existing behaviour.

5.10 Package commands ​

text
name the package -> resolve its request -> plan it on the build graph
                 -> refused(the directive the graph cannot model)
build actions --onSuccess--> place the artifact -> run it (ci run)

ci build, ci test and ci run take what dub build, dub test and dub run take for a package of the repository, and plan it on the build graph (E7). A package is named as dub names it, relative to the working directory: :<name> or sparkles:<name>, or a package directory. ci build and ci run also take a single-file package, and with none, the working directory's package; ci test without one tests every package, as it always has.

CIC24: Builds as dub builds. ci build and ci run must plan the named package's request, in the configuration -c names (else its default one) and under the build type -b names (else dub's default: $DFLAGS when that variable is set, debug otherwise), with the compiler --compiler names (the toolchain table's ldc2 or dmd, else $DC), and execute it against the shared store; the request reads the process's environment, as dub does, and a plan kept for it is stale once a variable it read, or found unset, changes. The artifact, the root's binary or a library's archive, must land where dub writes it: the recipe's targetPath, else the package's directory. A single-file package's lands there only when its recipe names a targetPath other than its own directory, and otherwise stays in the run directory; with --temp-build, as dub's, no artifact is placed; ci run runs the run directory's copy when that directory is not writable. An artifact the store serves only by its digest record (BGS5) is built again. A single-file package's dependencies on the repository's packages by version resolve to the worktree (BGR6), as the examples' do. A request the graph cannot model, an unknown configuration or build type, -c unittest (the test runner's, ci test's), what BGG7 refuses, another compiler, by --compiler or $DC, must be refused, naming what blocks it, with exit status 2. No command falls back to dub.

CIC25: Runs as dub runs. ci run must run the executable it built with the arguments after --, unchanged, its standard streams ci's own, in the recipe's workingDirectory, made when missing (else the caller's), with $DC as the caller set it, and exit with its status; a program a signal ended exits with 128 plus the signal's number. A library must be refused. The build's report, the plain transcript included, goes to standard error, so standard output is the program's alone.

CIC26: Tests as dub tests. ci test must take one sub-package of the root recipe as its positional argument, as --from <name> takes it, and with one package -c, the configuration its test runner copies (BGV2); -b names the tests' build type for every selected package, and turns coverage off. The arguments after -- must reach each of the package's test legs' runner unchanged, after the leg's own -t and --skip-slow. Unlike dub test, the test roots resolve without the process's environment, DFLAGS included, so a test's plan is the same in every shell. A second run with nothing changed must execute no compile, archive or link.

The development shells' dub is the dub-forward package's: it hands the package commands to ci and everything else to the pinned dub, which stays reachable as $SPARKLES_REAL_DUB. A package of a sparkles checkout is one inside the nearest directory above it holding .git, when that directory's dub.sdl names the package sparkles.

CIC30: The development shell's dub. dub build, dub test and dub run of a package of a sparkles checkout must start ci build, ci test and ci run in place of the forwarding dub, so the exit status and the standard streams are ci's, and through ci run the program's (CIC25). The command line is read in dub's order: the arguments after the first -- are the application's; dub's common options are read next, wherever they stand; then the command, run when the first remaining argument is an option or a package; then the command's options. The forwarded request carries:

  • the package: :<name> when the root (--root, else the working directory) is its checkout's root; with none, the root's package, named for ci test, which alone tests every package; with --single, the file, read against the root;
  • -c, -b, --compiler naming ldc2 or dmd, and --temp-build for a build or a run, each value apart from its option unless it begins with -, so ci reads neither an option nor a request for help in it;
  • the arguments after --: dub run's unchanged, dub test's when each is a runner option ci test hands its legs (-i and -e with a value that does not begin with -, --no-colors, --skip-slow);
  • for dub test, --no-coverage: dub measures no coverage unless asked.

A first argument ending in .d is a shebang file run directly, read as dub reads it: run -q --temp-build --single <file> -- <arguments>. -q, -y and -n (for a build or a run) and --skip-registry with a value dub takes are dropped: a ci build is quiet on standard output, never prompts and asks no registry. When the working directory lies outside the package's checkout, a build or a test starts ci in the checkout's root.

Where the two differ by design, the forwarded request behaves as ci's: standard output is the program's alone and ci run exits with the program's status (CIC25), where dub prints its build log there and reports a failing program with its own; a single file's artifact without --temp-build stays in the run directory unless its recipe names a targetPath (CIC24); ci test leaves out the @slow tests, which dub test runs, and runs a package's tests from the repository's root (BGX1), where dub test runs them from the package's directory.

Every other command line must reach the pinned dub unchanged. Another subcommand, a request for help (-h, --help), a package outside every sparkles checkout, and a package dub resolves itself (sparkles:<name>, which a package registered with dub add-local may answer, a version, any other name) go there silently, whatever else they ask for. A build, test or run of a checkout's package that asks for what ci does not model, or that dub rejects, goes there after one line on standard error naming the cause: another option, common or the command's; an option without its value, given twice, or with a value dub refuses; a compiler outside the build graph's, by --compiler or $DC; a runner option ci test does not hand on (-t, -l, --bench, …), or -v, whose per-test lines ci test reports as a summary; dub test while $DFLAGS is set, which dub adds to every build type and CIC26 resolves without; dub test of a directory that is no sub-package of the root recipe; the checkout's root package, which builds nothing of its own; arguments after -- for dub build; a second package; :<name> from a directory below its checkout's root, which dub reads as the sub-package of that directory's package; and dub run from outside the package's checkout, since ci takes its repository from its working directory and the program runs in the caller's. A request ci refuses itself (CIC24, BGG7) stays refused, and does not fall back.

The pinned dub must stay reachable as $SPARKLES_REAL_DUB, a path or a name looked up on PATH, which the forwarding dub never takes when it is the forwarding dub itself; and a forwarding dub exec'd as the pinned one must stop with exit status 127. ci must set SPARKLES_DUB_PASSTHROUGH for itself and every process it starts, and the forwarding dub for the pinned dub it starts. While that variable is set the forwarding dub must send every command line to the pinned dub unchanged, so no dub that ci, dub, a test or a tool runs is forwarded back. The Nix builds name the pinned dub directly.

6. Build and coverage locations ​

Compiled output lives in the build graph's shared store, never in a package's checked-in build/ directory, the repository root or a private DUB_HOME. Each task that writes anything else gets a task directory under <cache home>/sparkles/ci/runs/<run-id>/<task-key>/ (--cache-dir, CIC20), outside the worktree. The printable task id stays stable, and run-id is a filesystem name only, never an ordering input. ci build and ci run copy their artifact out of the store to where dub writes it (CIC24): the copy is the command's output, not the store's. A task directory holds:

  • spilled output;
  • the coverage listings of one coverage attempt, written there through the test binary's coverage destination option.

Coverage publication has two stages:

  1. Successful coverage attempts are parsed from their task directories and merged by normalized source path and line. Hit counts are summed with saturation. A line is coverable if any listing compiled code for it, because a test root and a dependency library compile different code from one file. Only listings of one file that disagree on its source lines are an error, which degrades that file's report rather than guessing.
  2. A single coverage-publish node writes a fresh, versioned destination and then atomically replaces the build/coverage pointer. A cancelled or failed run leaves no half-published result. Whether the previous result is kept or removed is reported explicitly, and stale data is never presented as this run's result.

Package percentages count only files owned by that package. Low coverage is informational and never fails a task. A package that passes only without coverage is degraded and omitted from numeric aggregation, not rendered as zero percent.

Task directories are removed after reporting. A failed task's directory is kept when the diagnostic policy asks for it, and its path is printed. A dry run creates none. The runs/ directory holds a CACHEDIR.TAG file (BGS7), and ci cache gc removes the directories of runs that have ended.

Every run that executes a graph also writes a run record of its measurements, outside the worktree and outside this directory. The ci perf commands read and share them; both are specified by observability.

7. Module layout ​

ModuleResponsibility
ci_main.dExecutable entry point only, which sets SPARKLES_DUB_PASSTHROUGH for every dub below it (CIC30).
app.dThe composition root: commands wire planners to the executor and reporters.
cli.dCanonical subcommands, validation, and help.
reporter_tty.dThe interactive reporter over sparkles:ui's TaskReporter.
commands/test_.dtest, slow-tests list and placements list: build-only, ordinary, coverage-fallback, sanitizer, slow and special test planners.
commands/package_.dbuild and run: a package's request named as dub names it, its artifact placed, and its program run (CIC24, CIC25).
commands/pipeline.dThe union graph of every CI job.
commands/examples.dexamples: the Markdown run/verify/update graph and reducers, and the standalone example planner and directives.
commands/check.dcheck and fix: commit-scope, reference, URL, sidebar, glossary, credits, spec-evidence, blob, SDL, recipe, pin-cache and WebAssembly checks.
commands/docs.ddocs: the fence audit and the staging of the docs' WebAssembly.
commands/github.dgithub: the check mirror and the link-rot issue.
commands/stats.dstats: the statistics graph; pure stats remain in ci_stats.d.
commands/perf.dperf: recording run records and publishing them to refs/perf/data.
commands/maintenance.dcommits and cache: each commit's build, and seeding, costing and collecting the caches.
commands/files.dThe file selection every command shares (--include-files, --exclude-files).
commands/output.dThe plain rendering every command shares: headers, result boxes and summaries.
commands/toolchain.dThe dub and compiler command lines and environments the planners share.
Pure domain modulescoverage.d, dub_deps.d, example_manifest.d, blob_paths.d, docs_sidebar.d and fence_audit.d, as reusable leaves.

The generic layers live in sparkles:build-primitives (see the task DAG's module layout). Command modules may import them and their domain leaves. They must not import concrete reporters.

8. Acceptance criteria ​

CIC9: Completion. The implementation is complete when all of these hold:

  • Every command reaches execution through a validated task graph.
  • There is no std.parallelism or task-status polling path in apps/ci.
  • A failed or cancelled command leaves no live child or unreaped process.
  • No compile the build graph plans runs through dub, and no library variant is compiled twice in one run. The work it does not plan keeps its dub path (PLAN M12): ci test --watch's rounds, the packages ci commits build-each cannot plan (CIC21), the tests whose subject is dub, and the forwarding dub's fallback (CIC30).
  • A second run in another worktree with no source change compiles nothing: it passes under --require-cached compile archive link (CIC12).
  • --jobs enforces weighted capacity and exclusive keys.
  • Focused package selection is visible under --dry-run.
  • Default non-TTY transcripts and final summaries are stable under randomized completion order.
  • TTY output uses TaskReporter, degrades without control sequences, and restores the terminal on interruption.
  • Interlaced output is immediate, line-atomic and prefixed. On CI providers that support groups, block-mode task blocks, and the closing sections of an interlaced run, are grouped (TDO7).
  • Coverage fallback cannot trigger fail-fast before plain-test classification.
  • Degraded stats and coverage are visibly distinct from complete success.
  • The parser exposes only the canonical command tree and rejects every removed flag.
  • ci pipeline covers every job .github/workflows/ci.yml runs, or names it as skipped with its reason.