No description
  • Rust 68.9%
  • TypeScript 27.7%
  • CSS 2%
  • Dockerfile 0.7%
  • Shell 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-12 15:02:00 +07:00
.claude/skills [feature/auto-coverage] fix(core): PHPUnit's Clover is no longer taken for Cobertura 2026-11-11 10:50:09 +01:00
crates [feature/upstream-icons] test: https held through redirects, a held pipe, damaged and future-dated cache entries, the forge ETag, forgetting drops the cached icon from the server and the CLI 2026-11-12 14:57:39 +07:00
docker [feature/auto-coverage] fix(recipes): Go module paths, tool-only pyprojects, delegating roots, PHPUnit filters, Hex and xml2 2026-11-11 18:28:01 +01:00
web [feature/forget-from-ui] test(web): the store's forget and its failures, the overview's notes, prune and per-row forget, a forget armed across a refresh 2026-11-12 14:57:39 +07:00
web-dist [master] feat(server): the api the dashboard reads, and the dashboard itself 2026-09-06 22:26:37 +02:00
.dockerignore [master] feat(docker): a static binary in a sixteen megabyte image 2026-09-06 22:58:58 +02:00
.gitignore [master] fix(coverage): a new file section closes an unclosed one 2026-09-07 00:40:27 +02:00
Cargo.lock [master] chore(release): 0.7.0 2026-11-12 15:02:00 +07:00
Cargo.toml [master] chore(release): 0.7.0 2026-11-12 15:02:00 +07:00
compose.yaml [feature/auto-coverage] fix(docker): the runner reads the configuration read-only and owns the volume its copies are on 2026-11-11 18:31:33 +01:00
Dockerfile [feature/auto-coverage] fix(docker): the runner reads the configuration read-only and owns the volume its copies are on 2026-11-11 18:31:33 +01:00
icon.svg [chore/project-icons] chore: link the project icon at the root 2026-11-07 00:37:47 +01:00
mise.toml [feature/auto-coverage] feat(docker): a runner image carrying the toolchains, and compose profiles to run it 2026-11-11 10:49:52 +01:00
README.md [feature/upstream-icons] docs: misses kept an hour, https only, four forges at once, the upstream module in the layout, fresh numbers, and three gaps the review left 2026-11-12 14:57:39 +07:00
ROADMAP.md [feature/repo-overview] docs: the home page and its route, the roadmap item it ships, fresh numbers 2026-11-12 03:06:25 +01:00
TODO.md [master] docs(release): 0.7.0 sweep 2026-11-12 15:00:52 +07:00

Codegauge

A codebase observatory. It walks a repository's git history, counts every line of every tracked file at one snapshot per UTC day, and serves a dashboard that charts how production code and test code moved against each other over time.

One static binary with the frontend baked in. Nothing to install on the machine that runs it, and no git on the PATH: history comes from gitoxide, in process.

Use

mise run build                   # dashboard first, then the binary
mise run scan ~/repos/my-project
mise run serve

mise run check type-checks the dashboard and lints the Rust; mise run test runs the suite; mise run install symlinks the binary into ~/.local/bin.

codegauge scan <repo-path...>   --branch <name>  --rescan  --name <label>
codegauge serve                 --port <n>  --host <addr>  --open
codegauge cover <slug>          --report <file>...  --auto  --plan
codegauge report <slug>         --at <day|commit>  --since <day|commit>  --metric <m>  --json
codegauge watch                 --every <30s|15m|1h>  --once
codegauge runner                --port <n>  --host <addr>   run suites for another codegauge
codegauge list                  tracked repositories
codegauge forget <slug>         drop a repository and its snapshots
codegauge forget --missing      drop every repository whose checkout is gone
codegauge where                 print the data directory

Data lives in $XDG_DATA_HOME/codegauge/codegauge.db, overridable with CODEGAUGE_HOME or --db.

Scanning is incremental: stored days are skipped, and line counts are cached per git blob, so a file that never changes is counted once for the whole history no matter how many snapshots it appears in. Eleven repositories and 4,908 daily snapshots take 1.6 seconds cold on sixteen cores.

Each branch of a repository is tracked on its own. The first branch scanned keeps the repository's slug; scanning another, with --branch or from a checkout sitting on it, adds a row beside it slugged <slug>@<branch> (numbered when two branch names slugify alike, as feature/login and feature-login do), and the dashboard offers a branch picker once a repository has more than one. Checking out a feature branch for an afternoon therefore leaves the main history where it was. Every branch shares the repository's configuration, keyed by the first slug.

With more than one repository tracked, the dashboard opens on all of them at once: a row each, with its tests per production line over the last 180 days of its history (counted back from its newest snapshot, so a quiet repository still draws one) as a sparkline drawn from zero, its latest coverage and how it came about, and when its snapshots were last updated. While a row's suites run, the page asks again every few seconds until they finish. A row opens that repository, at ?repo=<slug>, and All repositories in the masthead's list leads back. The first branch scanned stands for its repository there. With one repository there is nothing to choose between, and the dashboard opens on it.

Keeping snapshots fresh

A rescan costs about as much as the day's diff, so the only reason a dashboard goes stale is that nothing asks it not to. codegauge watch rescans every tracked repository every fifteen minutes, printing a line only for the ones that moved; a repository that cannot be read is reported and skipped. Where coverage.auto is on, the same pass runs the suites of each head it has not run yet, so coverage keeps up with the line counts (see Running the suites). --once runs a single pass for a timer to call instead:

# ~/.config/systemd/user/codegauge.service
[Service]
Type=oneshot
ExecStart=%h/.local/bin/codegauge watch --once

# ~/.config/systemd/user/codegauge.timer
[Timer]
OnBootSec=5min
OnUnitActiveSec=15min

[Install]
WantedBy=timers.target

systemctl --user enable --now codegauge.timer starts it.

For CI

codegauge report <slug> describes one stored day - named by the day or by a commit it ended on, a prefix of at least four characters that names only one stored commit - with its role totals, test ratio, per-module rows and the coverage report in force. --since adds what moved against a baseline, per role and per module, including modules that appeared or vanished; --json prints the same thing as data for a pull-request comment to be built from. It carries no verdict and there is no --fail-under, for the reason given under On the test ratio.

Stack

Layer Choice Why
Git access gix Tree traversal and object reads in process; no subprocess per day
Counting rayon The hot loop is byte scanning over thousands of blobs, and it is embarrassingly parallel
Diffs imara-diff git diff --numstat semantics without shelling out
Storage rusqlite One file, one writer, real transactions
API axum on tokio Server is async; the store is only ever locked on spawn_blocking, since a scan holds it for its whole length, and the scan runs there with rayon because it is CPU-bound
Scan progress server-sent events, a tokio watch One way, over the request that starts the scan; a reader slower than the scan skips to the newest state instead of working through a backlog of days
Assets rust-embed The dashboard ships inside the binary
XML reports quick-xml Cobertura, JaCoCo and Clover are read as a stream of events, not built into a tree: a JaCoCo report for a large reactor runs to tens of megabytes
Runner client ureq, no TLS Blocking HTTP to a runner on the same host or compose network; nothing to encrypt, and a run already sits on its own thread
Suite processes libc A suite past its deadline is killed with its whole process group, not only the shell that started it
Frontend Solid, Vite Signals own state and shell; no virtual DOM to sit in the hot path
Charts hand-written SVG See below

The charts are not components. A crosshair tracking the pointer and a brush that re-slices six charts per drag frame want to write to the DOM directly, so web/src/lib/charts.ts is framework-free and imperative and ChartCanvas.tsx is the seam, calling update() so a pinned point survives a re-render.

Nothing above a chart is a singleton. createDashboard() builds the store, and the tooltip with it, so a test gets state nobody else has touched; DashboardProvider hands it down. The arithmetic behind every panel lives in web/src/lib/derive.ts as plain functions over plain data, because a number worth checking should not need a mounted chart to reach it.

What it measures

Every file is assigned a role, and the production/test split is the story the dashboard tells:

Role What lands here
production authored source that ships
test test/, spec/, e2e/, __tests__/, plus *.test.*, *_test.go, test_*.py, *Test.java, *.bats …
docs Markdown, reStructuredText, AsciiDoc, plain text
config JSON, YAML, TOML, INI, Dockerfiles, Terraform …
other generated output: *.g.dart, *.pb.go, migrations/, drizzle/, snapshots, minified bundles

Lockfiles, node_modules, dist, vendor, build directories and binaries are not counted at all. Four measures are available: nonblank lines (default), code lines with comments stripped, all lines, and bytes. Comment detection is per language, and a line counts as a comment only when it holds no code.

A file can hold both roles. Rust writes unit tests in #[cfg(test)] modules and Zig in test blocks, so for those languages the region is counted as test and the rest of the file as whatever the file is. Without it, a Rust project reads as having almost no tests: TokenGauge measured 0.02 tests per production line and is really 0.35. Only languages with an actual convention are read this way - guessing at one that has none would be worse than the undercount. The file is still counted once, against the role it is filed as.

A .d.ts in the source tree is filed as production: plenty are written by hand, and emitted ones land in dist/ or a generated directory, which the directory rules already catch.

Alongside the role, each file carries a zone (top-level area, with monorepo containers like apps/ expanded one level: apps/web-nuxt), a module (one level deeper: apps/web-nuxt/server), and a language. Every chart slices on those.

A module is named by what it is, not by where its code or its tests sit. A leading src/, lib/, source/ or sources/ is looked through, and so is a test directory or a main/ below it, so crates/core/src and crates/core/tests are both crates/core, web/src/lib and web/tests/lib are both web/lib, and Maven's src/main/java meets src/test/java. Without it, Rust's convention of integration tests beside the crate reads as a module with no tests next to a module with nothing else.

The rules above are versioned in the store. A release that files the same path differently drops the stored facts on first open and the next scan rebuilds them from the blob cache, which the change leaves alone.

In a container

mise run docker:build                    # image user takes your uid and gid
mise run docker:serve                    # dashboard on 127.0.0.1:7777
mise run docker:scan ~/repos/my-project

The runtime image is Alpine plus a static musl binary, 16 MB, and it contains no git: history comes from gitoxide, in process.

Two things about the mounts are deliberate. Repositories go in read-only, because scanning never writes to one. And they are mounted at the same path they have on the host, because the snapshot store records each repository's absolute path - identical paths are what let a container and a codegauge on the host share one database, and what lets "Update snapshots" in the dashboard find the repository it is talking about.

CG_REPOS, CG_DATA and CG_ARGS override the repository root, the snapshot store and the command.

Running suites needs toolchains, and the dashboard image carries none. They live in a second image, the runner: the same static binary on Debian, with what the recipes call. It is a separate service so that the dashboard stays sixteen megabytes and the runner can be left out, or built smaller.

mise run docker:runner                   # the default stacks; STACKS="rust node" for fewer
mise run docker:coverage                 # dashboard, runner and watcher together

docker:coverage is compose with the coverage and watch profiles and CG_RUNNER=http://runner:7778, which reaches the dashboard and the watcher as CODEGAUGE_RUNNER: they hand every run to the runner, which never opens the store. It mounts the repositories read-only at the same paths, and the data directory read-only too, for the configuration alone: the suites it runs are other people's code, and none of them gets to write the store or turn auto on elsewhere. The copies suites run in are on a volume of their own since build output runs to gigabytes, and its home directory, which holds the package caches, on another. It publishes no port.

The runner is allowed ptrace and an unconfined seccomp profile, which kcov needs to trace the zig and bats suites; it runs repositories' code either way, but drop both from compose.yaml if none of yours needs kcov. PACKAGES (CG_PACKAGES) adds distribution packages, the system libraries a build links against, in a last layer, so adding one rebuilds nothing else. The default image is about 11 GB.

STACKS (CG_STACKS under compose) chooses what the runner carries. default is C and C++ (gcc, clang, CMake, Meson, gcovr, kcov), Rust with cargo-llvm-cov, Node with pnpm, yarn, bun and c8, Python with uv and poetry, Go, the JVM with Maven, Gradle and sbt, .NET with dotnet-coverage, PHP with pcov and Composer, Ruby, Lua with busted and luacov, Zig, bats, Deno, Elixir and Dart. all adds Flutter, Swift, R and an Android SDK, which also needs --build-arg ANDROID_HOME=/opt/android-sdk (CG_ANDROID_HOME) and accepts the SDK licences on your behalf at build time. Toolchains come from the distribution and from mise, pinned in docker/runner-stacks.sh; a version a repository pins in mise.toml, .tool-versions, .nvmrc, .python-version or rust-toolchain.toml is installed the first time a suite asks for it.

Tests

mise run test       # 470 Rust, 261 dashboard
mise run coverage   # both halves, merged into coverage/all.lcov
mise run cover:self # and then read by codegauge

731 tests. The dashboard covers 93.6% of its 1,388 lines, measured with vitest --coverage, and the Rust half 95.2% of 6,864 with cargo llvm-cov; merged, 94.2% of 5,683 classified lines - a number codegauge reads back with its own cover command.

The recipes are checked two ways. Every script a recipe writes goes through sh -n in the suite, and a tree holding every stack proves each recipe is recognised. And the runner image has run them against real repositories: Rust (a 33,614-line workspace, 87.6%), Node with npm and with pnpm, Go, CMake with gcovr, Zig through kcov, and a repository mixing Go and pnpm, measured as one point. The rest - Python, .NET, the JVM, PHP, Ruby, Dart, Elixir, Lua, R, Swift, bats, Deno - are syntax-checked and follow each tool's documented flags, and have not yet been run against a repository of their own.

The scanner is tested against real repositories, built commit by commit with gitoxide rather than by shelling out, so the suite keeps the property the binary has: no git needed on the machine. Every fixture commit takes an explicit timestamp, because daily snapshots, gap filling and "the last commit of the day wins" are all arithmetic on committer time and none of it is testable against commits stamped now.

Writing them turned up six real defects, which is the argument for having written them:

count a line-comment token shadowed a longer block opener, so Lua block comments never opened and their contents counted as code
classify a generated-file suffix that could never match, because the language lookup runs first
server unknown /api/ routes fell through to the single-page fallback and answered HTML with a 200
server creating a repository returned 200 where the previous implementation returned 201
web the headline figures said "lines" whatever the measure was: 4.2 MB lines of production code
coverage concatenated reports lost a whole file when the first omitted its final newline - found by pointing codegauge at itself

Telling it about your repository

Every repository has an idiosyncrasy, and editing the classifier and rebuilding is absurd ceremony for it. A .codegauge.toml at the root says what the built-in rules cannot work out:

name = "Ouroboros"
exclude = ["generated/**"]        # not authored source, on top of the built-in list
containers = ["tier"]             # directories whose children are the unit, like apps/

[roles]
"src/api/*.d.ts" = "other"        # emitted by codegen, not written

# Where the tests are, when the language will not say.
[[tests]]
paths = ["ouroboros.py"]
functions = ["_selftest", "fuzz"]                       # a definition and its body
spans = [["# Layer 17: differential fuzzing", "# ="]]   # from a line to the next marker

functions matches a definition whose name starts with the pattern - so fuzz takes fuzz, fuzz_limits and fuzz_refusals - and takes its body, by braces or by indentation depending on the language. spans runs from a line to the next line matching the end pattern, skipping any that immediately follow the start, so a banner whose closing rule looks like its opening one does not end the section it introduces.

The file describes the repository as it is now, so it is read from the working tree rather than from each commit and applies to the whole history. Changing it re-scans the repository, since the stored days were measured under different rules. Coverage follows without cover being run again: the report is kept per file, and every scan rolls it through the rules it just used.

Without it, ouroboros - a self-hosting compiler in one 22k-line Python file, with a differential fuzzer and a self-test inside it - reads as 0.00 tests per production line. With it, 0.05.

For repositories that are not yours

A clone you do not own cannot carry that file, and a rule that holds for every repository has nowhere to live inside any one of them. The same settings are therefore readable from $XDG_CONFIG_HOME/codegauge/config.toml, under [default] for every repository and under [repo.<slug>] for one, named by the slug that codegauge list prints:

[default]
exclude = ["**/mise-tasks/**"]

[repo.axeo-suite]
exclude = ["apps/processing-pipeline/modelconverter-cpp/include/**"]

[repo.otel-demo]
name = "OpenTelemetry Demo"

One key is global-only. Coverage reports are build output, so they are gitignored in most repositories and there is nothing to discover until something has produced one:

[repo.codegauge.coverage]
command = "mise run coverage"      # run this first
report  = "coverage/all.lcov"      # then read this

codegauge cover <slug> runs the command in the repository root, streaming its output, and reads the report it leaves behind. --report skips the command. Without either, codegauge can run the suites itself; see Running the suites for the keys that govern that.

coverage.command, coverage.auto, coverage.env, coverage.recipes and coverage.timeout are refused in a repository's own .codegauge.toml, and that is the point of the split: that file is read from a working tree you do not always own, and codegauge otherwise spawns no subprocess at all - not even for git. Naming a path describes the repository; naming a command, or letting codegauge run the suite, borrows your machine. A repository may still set coverage.report, and say which recipes to skip, and which untracked files its suite needs copy'd in.

None of the coverage keys counts towards the fingerprint: where a report comes from measures nothing differently, so changing one rescans nothing.

Three layers apply in order: the global [default], the repository's own .codegauge.toml, then the global [repo.<slug>]. Lists concatenate and the last matching role wins, so the layer you can always edit is the layer that wins. A name set globally renames a repository without changing its slug, since the slug is what the section is keyed by.

The fingerprint that decides whether a repository must be measured again is taken over the merged result, so adding a section for one repository leaves every other repository's stored days alone - and moving a rule between layers without changing what it means is not a rescan.

Coverage

Coverage cannot be reconstructed from history the way line counts can. Line counts come from the tree; coverage only exists where a suite actually ran. Codegauge does not pretend otherwise: it reads a report a run already produced and stores one point per commit, rather than inventing a daily series.

codegauge cover my-project                       # finds a well-known report
codegauge cover my-project --report build/lcov.info

Seven formats are read directly, told apart by their content rather than their names:

  • LCOV (lcov.info) - the closest thing to a lingua franca. Vitest and Jest via c8, flutter test --coverage, cargo llvm-cov --lcov, gcov, coverage.py lcov, Elixir and PHP all emit it.
  • Cobertura XML - .NET's coverlet and dotnet-coverage, gcovr, kcov, scoverage, coverage.py xml. Lines are keyed by number, because C# and Java split a file over several classes and every method repeats its own lines.
  • JaCoCo XML - Gradle and Maven, Kotlin included. A file is its package joined to its name, which is the tail of where it sits under src/main/<lang>.
  • Clover XML - PHPUnit's default.
  • llvm-cov JSON export - what swift test --show-codecov-path points at, and any clang source-based coverage.
  • Istanbul JSON summary (coverage-summary.json).
  • Go cover profiles (coverage.out). Go counts statements, not lines; those are summed into the line columns, which is the closest honest mapping.

--report may be given more than once, and several reports of one commit make one point: each is matched onto the tree on its own, then merged by path. Where two cover the same file, lines known by number union, so a line either suite ran counts once; a file only summarised keeps the report that saw more of it rather than adding the two. The point is filed under every format it read, jacoco+lcov.

LCOV being the lingua franca is not only a claim about tooling. ouroboros, a self-hosting compiler in a single dependency-free Python file, writes its own tracefile from its own sys.settrace tracer with no coverage library at all, taking executable lines from co_lines() rather than the text because a third of that file is string literals holding other languages. Codegauge reads it without knowing any of that.

The part that makes this uniform across tools is path matching. Reports disagree about what a path is relative to - absolute build paths, a package root, the repository root. Codegauge matches each report path onto the longest suffix, in whole directories, that exists in the tree at that commit, which handles all three without per-tool configuration. A path two files fit equally well is left unmatched rather than guessed at, and it tells you when paths match nothing, so a stale report is obvious:

nostragoalus: istanbul format, 0 files matched, no measurable lines
  208 report paths matched nothing in the tree (stale report?)

Coverage rolls up through the same (role, language, zone, module) cube as the line counts, so both slice identically. The breakdown draws each row's covered share beside its bars, and a row opened onto its files shows it per file. The report itself is kept per file too, so a change of rules rolls it again instead of asking for it a second time.

Running the suites

Coverage reports are build output, so asking for one means asking someone to run the suite first, in every repository, with whatever flags turn coverage on there. Codegauge can do that itself, and nothing has to be added to the repository for it to.

# ~/.config/codegauge/config.toml
[default.coverage]
auto = true                          # codegauge may run test suites, every repository

[repo.axeo-suite.coverage]
skip = ["cmake"]                     # recipes not to run here
copy = [".env.test"]                 # untracked files the suite needs
env = { DATABASE_URL = "postgres://localhost/test" }
timeout = "45m"                      # per recipe; 30m otherwise

[repo.codegauge.coverage.recipes]    # a command standing in for a built-in recipe
rust = "cargo llvm-cov --workspace --features codegauge-core/fixture --lcov --output-path $CODEGAUGE_OUT/rust.lcov"

codegauge cover <slug> --auto runs the suites once whatever auto says; with auto on, plain cover, every watch pass and the dashboard's Run suites do it too. cover --plan prints what would run, step by step with its script, and runs nothing.

A run never touches the working tree. The head is checked out with gitoxide into a copy under the data directory, workspaces/<slug>, which is kept between runs and brought up to date in place: tracked files are rewritten where they changed and removed where they went, so target/, node_modules/ and a virtualenv stay and the second run is as incremental as the suite allows. A tracked file the suite edited - a recipe adding a coverage provider to package.json - is noticed by its size and mtime and written back. The repository can stay mounted read-only, a dirty or switched checkout does not leak into the number, and the point belongs to the commit it says it does.

Recipes recognise a stack from the files the commit tracks and switch coverage on from outside, with a flag, an init script, or a provider installed into the copy:

Recipe Recognised by Coverage switched on with Report
rust Cargo.toml; a workspace runs once from its root cargo llvm-cov LCOV
node package.json with vitest, jest, bun test or a test script, but not one that only runs its packages' (turbo, pnpm -r...) vitest with a v8 provider matching its version, jest's own, bun's own, c8 around anything else LCOV
deno deno.json deno test --coverage, deno coverage --lcov LCOV
python pyproject.toml declaring a project, setup.py or requirements, with tests coverage.py under pytest or unittest, in uv, poetry or a venv of its own LCOV
go each go.mod go test -coverprofile, its paths taken off the module's Go
cmake CMakeLists.txt declaring tests --coverage flags, ctest, gcovr Cobertura
meson meson.build declaring tests -Db_coverage=true, gcovr Cobertura
dotnet a solution or project with a test project dotnet-coverage collect, or coverlet's collector Cobertura
gradle settings.gradle or build.gradle, Kotlin DSL too an init script applying JaCoCo; Android's unit-test coverage JaCoCo
maven pom.xml; a reactor runs once the JaCoCo plugin from the command line JaCoCo
sbt build.sbt sbt-scoverage added under project/ in the copy Cobertura
php composer.json with a PHPUnit configuration, or PHPUnit or Pest and tests pcov or Xdebug, over src, app or lib where the configuration names no sources Clover
ruby Gemfile with spec/ or test/ SimpleCov required ahead of the suite, its LCOV formatter added to the copy's Gemfile LCOV
dart, flutter pubspec.yaml with test/ coverage:test_with_coverage, flutter test --coverage LCOV
swift Package.swift with Tests/ --enable-code-coverage llvm-cov JSON
elixir mix.exs; an umbrella runs once mix test --cover, exported and turned into LCOV by a script of codegauge's LCOV
r DESCRIPTION with tests/ covr Cobertura
lua .busted or *_spec.lua busted with luacov LCOV
zig build.zig declaring a coverage step that step Cobertura
bats *.bats kcov around bats Cobertura

A monorepo installs its dependencies once per lockfile and runs each package with its own runner; a root vitest that runs its packages as projects is the only run. A stack found but not runnable is reported with the reason: CMake that declares no tests, a solution with no test project, Zig with no coverage step - its build runner gives no way to wrap the test binaries from outside. Directories like node_modules, vendor, third_party and testdata hold no projects, nor does anything exclude names.

coverage.recipes replaces a recipe's script for the repository, keeping where it runs, and a name that is not a recipe adds a step of its own at the root: ouroboros has no framework to recognise, and selftest = "python ouroboros.py --lcov $CODEGAUGE_OUT/self.lcov" is all it takes. A script runs with sh in its directory of the copy, with CI=1, CODEGAUGE_OUT for its reports, CODEGAUGE_TMP for anything else and CODEGAUGE_ROOT for the copy, in a process group of its own; codegauge's own CODEGAUGE_* settings are taken out of its environment. Whatever it leaves in $CODEGAUGE_OUT that parses is a report.

Where a report says where the tree was checked out, which every recipe's does, a path outside it, or inside it but untracked, is a dependency or generated source. It is dropped rather than handed to the suffix match, which would file node_modules/x/src/index.ts as the repository's own src/index.ts.

A run is complete when every step passed, partial when it measured something but a step failed, timed out or could not run - a program missing from the PATH, an install that failed - and failed when nothing measurable came out. A failing suite still counts what it ran: scripts run the tests, remember the status, then convert. The latest run of each commit is kept with its steps and the tail of its output, whatever its outcome, and a head already run is not run again by watch until it moves, so a broken suite is not retried every fifteen minutes. The dashboard draws a partial point in outline and says what the last run did.

What a recipe cannot know is what the suite needs around it. A suite that wants a database, a browser or credentials fails here as it would on a fresh machine; env and copy cover what can be handed in, and skip the rest. Three more limits, met on real repositories:

  • A build that links system libraries - a GTK application wanting glib-2.0 and wayland-server - needs them in the runner, which PACKAGES adds at build time.
  • A build that reaches a sibling checkout by relative path (../JustCef) cannot find it: the copy holds one repository.
  • R's covr stops at the first failing test and writes nothing, so an R suite with a red test measures nothing rather than what ran.

Reports read before per-file keeping (v0.3.0 and earlier) have only the cube, and a cube cannot be sliced again. They keep their totals, so the coverage chart is unchanged, but they stay sliced by the rules they were read under: after the module rule changed, their per-module figures no longer line up with the breakdown until cover reads a report again.

On the test ratio

The dashboard leads with test lines per production line because the number is cheap and legible, not because a particular value is correct. Treat it as a lens:

  • The slope matters, the level does not. A repository holding 0.5 while production grows forty-fold is healthier than one sitting at 2.0 and flat.
  • Per module beats per repository. A single number hides the module with four thousand lines and no tests. The breakdown panel is where the signal is.
  • There is no target line and no red/green verdict, on purpose. The cheapest way to move a ratio is verbose setup and snapshot dumps, and a threshold invites exactly that.

The one alarm it does raise is an event, not a level: a day where production moved by fifty lines or more, additions and removals together, and tests did not move at all. It is marked above that day in the movement chart and counted beside it, and /series?floor= moves the fifty. Padding the test side cannot make a past day go away, which is what a ratio threshold gets wrong. Churn is split by the role a file is filed as, so tests are judged twice: no test file changed, and the test lines in the day's facts, which count Rust and Zig in-file tests, did not change either.

How a snapshot is built

For each UTC day, the last commit of that day is chosen; days with no commits carry the previous tree forward, so the series is continuous. A merge can be that commit, since its tree is the real state of the branch, but it is not counted as a commit or credited to an author. gix lists the tree, each blob is classified by path, and anything not already in the blob cache is counted in parallel. The result rolls into a (day, role, language, zone, module) cube, and consecutive snapshots are diffed for the daily movement figures. While a day's files are counted, the rayon workers bump a counter the scan reads every tenth of a second, so the progress stream moves through a large day instead of sitting at its start.

The cube stops at module. Per-path facts for every day would be orders of magnitude larger and almost never read, so the files inside a row are computed when asked for, for one day, from that day's tree and the blob cache.

Fact totals were verified against the previous Node implementation across 49,494 rows and eleven repositories: identical everywhere except empty files, which the old implementation counted as one line and this one counts as zero, matching wc -l. Churn totals track git diff --numstat to within 0.003%; the residue is inherent, since imara-diff and git's xdiff pick different but equally minimal edit scripts on a handful of files.

Layout

crates/core/     classify, count, git, scan, report, store, upstream, and coverage:
                 its formats, recipes, the copy suites run in, and runs
crates/server/   axum routes, embedded assets, the runner and its client
crates/cli/      the codegauge binary
web/             Solid dashboard
web-dist/        vite output, embedded at compile time
docker/          what the runner image installs, stack by stack

API: /api/repos (each row carries its family, shared by a repository's branches, and missing, true when its checkout is no longer found on disk), /api/overview (one row per repository, for the branch scanned first: the test ratio of each snapshot over the 180 days up to its newest, null where it had no production lines, the latest coverage point, the last run and whether one is in flight), /api/repo/:slug, /api/repo/:slug/series (with an untested flag per day, ?floor= to move it), /api/repo/:slug/breakdown?by=zone|module|lang, /api/repo/:slug/files?by=…&key=…&day=… (the files inside one breakdown row, 404 for a day with no snapshot), /api/repo/:slug/authors, /api/repo/:slug/coverage (the points, each with the outcome of the run that made it where codegauge ran it, whether runs are allowed, whether one is in flight, and the last run with its steps and output tail), /api/repo/:slug/export (CSV), /api/repo/:slug/icon (the project's own icon as its HEAD has it now, whichever branch is tracked: icon.svg, logo.*, then the usual assets/, .github/, public/ and favicon spots, a symlink followed while it stays inside the tree. Where the tree keeps none, the forge's avatar for the project, asked through the tools already logged in on the machine: glab for GitLab, smith and curl for Forgejo; GitHub has no per-repository icon and is not asked. An icon that came back is kept a week under icons/ in the data directory, the fact that none did an hour, since a network that is down or a tool not logged in yet answers the same way; forgetting the repository drops either. The avatar is fetched over https only, redirects included, at most four forges asked at once. 404 where neither has one, and the dashboard shows its initial), DELETE /api/repo/:slug (forgets it, 204), POST /api/repo/:slug/rescan, and POST /api/repo/:slug/coverage/run. Sent with Accept: text/event-stream, the rescan answers with server-sent events instead: progress while it runs, then done with the report or failed with the error; a coverage run does the same with a log event per line of output. A second rescan or run of a repository already busy answers 409 rather than queueing behind the first. A coverage run is refused with 403 unless coverage.auto is on for the repository, and from a page on another origin, since running a suite is not something a stray form post should start. Forgetting is refused from another origin too, and while the repository is being scanned or having its suites run. The dashboard offers it on a repository's page, per row on the home page, and as one prune of everything gone from disk, each acting on a second press. The prune counts whole repositories apart from stray branches whose worktree went; a repository's own page forgets just the branch it shows when the repository tracks several. The store is held only to read the repository and to keep the result.

The runner serves POST /run, which takes a repository's path, branch, slug and family as JSON and answers with one JSON object per line: {"log": ...} as the suites print, then {"run": ...} or {"error": ...}. Only a JSON body is accepted, which a page elsewhere cannot send without a preflight the route never answers. GET /health says it is up.

A request that panics while holding the store poisons its lock. The server takes the lock back instead of failing every later request, because SQLite has already rolled back whatever transaction the panic abandoned.

The dashboard loads Big Shoulders Display and Karla from Google Fonts, falling back to system faces offline.

Node and pnpm are pinned in mise.toml. Rust is not, so it comes from whatever toolchain is on the machine; rust-version in Cargo.toml records the floor.