Skip to content
Closed
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
91854fe
Run omitted tooling and web checks and repair Git hook coverage
Gajesh2007 Sep 11, 2026
1da5479
Include admin build outputs in aggregate cleanup
Gajesh2007 Sep 11, 2026
cf26d7c
Compare independent attention references before native rounding
Gajesh2007 Sep 11, 2026
59a2ce4
Fix rendered docs navigation and ordinary admin builds
Gajesh2007 Sep 11, 2026
b8bd6e3
Refresh build and test documentation after master rebase
Gajesh2007 Sep 11, 2026
fb4875d
Fail immediately when any pushed ref cannot be compared
Gajesh2007 Sep 11, 2026
2e6e234
Bootstrap pinned tooling dependencies and exclude image navigation edges
Gajesh2007 Sep 11, 2026
42247a8
Align aggregate setup and tooling procedures with shared targets
Gajesh2007 Sep 11, 2026
97fd591
Preserve outer navigation targets around clickable images
Gajesh2007 Sep 12, 2026
d38aef5
test(tooling): isolate nested make bootstrap fixtures
Gajesh2007 Sep 12, 2026
66c7b8f
docs(tooling): explain overridden environment isolation
Gajesh2007 Sep 12, 2026
bc79296
docs(tooling): refresh source stamps after master rebase
Gajesh2007 Sep 12, 2026
0bc97c7
Fix batched docs parsing and portable tooling assertions
Gajesh2007 Sep 12, 2026
c0966ec
Document batched docs checks and portable CPU fixtures
Gajesh2007 Sep 12, 2026
b335177
Explain already-retired process groups in fixture cleanup
Gajesh2007 Sep 12, 2026
6b5cea5
Preserve wrapped docs links and rebuild changed tooling environments
Gajesh2007 Sep 13, 2026
f9d8b9d
Document tooling rebuilds and wrapped-link validation
Gajesh2007 Sep 13, 2026
28316f6
Fix Markdown navigation edge cases and large push classification
Gajesh2007 Sep 13, 2026
fb142b2
Document Markdown code exclusions and large push regression checks
Gajesh2007 Sep 13, 2026
b1d7b24
Handle nested Markdown labels and hidden HTML in docs lint
Gajesh2007 Sep 13, 2026
45034b1
Document nested-link and HTML docs lint behavior
Gajesh2007 Sep 13, 2026
9e0e9ac
Keep Markdown visible after invalid backtick fence openers
Gajesh2007 Sep 13, 2026
f32385a
Describe e2e staged formatting and invalid fence handling
Gajesh2007 Sep 13, 2026
3fcc6a6
Refresh tooling owner docs after master update
Gajesh2007 Sep 13, 2026
c24ccb2
Fix container fences, link titles and tooling pin refresh
Gajesh2007 Sep 13, 2026
53ca88c
Document tooling pin refresh and Markdown boundary checks
Gajesh2007 Sep 13, 2026
986e82f
Check complete Markdown destinations, definitions and reachable docs
Gajesh2007 Sep 13, 2026
31dbdf1
Document reference definitions and documentation entry paths
Gajesh2007 Sep 13, 2026
e8510db
Fix nested Markdown block projection and inline destination limit
Gajesh2007 Sep 13, 2026
042f299
Document nested literal handling and inline destination depth
Gajesh2007 Sep 13, 2026
36f9ab8
Preserve wrapped container links and GitHub declaration semantics
Gajesh2007 Sep 13, 2026
a2de526
Document wrapped inline preservation and GFM declaration checks
Gajesh2007 Sep 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,19 @@ set -euo pipefail

FAILED=0

# ---------------------------------------------------------------------------
# Go — gofmt on staged .go files under coordinator/
# ---------------------------------------------------------------------------
GO_FILES=$(git diff --cached --name-only --diff-filter=ACM -- 'coordinator/**.go' | grep '\.go$' || true)

if [ -n "$GO_FILES" ]; then
echo ">> Checking Go formatting (gofmt)..."
UNFORMATTED=$(gofmt -l $GO_FILES 2>/dev/null || true)
if [ -n "$UNFORMATTED" ]; then
echo ""
echo "ERROR: The following Go files need formatting:"
echo "$UNFORMATTED" | sed 's/^/ /'
echo ""
echo "Fix with: gofmt -w <file> (or run: gofmt -w \$(git diff --cached --name-only -- 'coordinator/**.go'))"
echo ""
# Check staged Go bytes, including partially staged files and paths with spaces.
# Working-tree formatting can differ from the exact blob about to be committed.
while IFS= read -r -d '' file; do
if ! formatting=$(git show ":$file" | gofmt -d); then
echo "ERROR: Could not check staged Go file: $file" >&2
FAILED=1
elif [ -n "$formatting" ]; then
echo "ERROR: Staged Go file needs formatting: $file" >&2
echo "Run gofmt -w on the file and stage the formatted changes." >&2
FAILED=1
fi
fi
done < <(git diff --cached --name-only -z --diff-filter=ACMR -- \
'coordinator/**.go' 'e2e/**.go')
Comment thread
Gajesh2007 marked this conversation as resolved.
Resolved

# ---------------------------------------------------------------------------
# TypeScript — next lint in console-ui/ if any .ts/.tsx files are staged
Expand Down
51 changes: 25 additions & 26 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,46 @@ set -euo pipefail

FAILED=0

# Check which components have changes being pushed.
# Compare local HEAD against the remote ref being pushed to.
# Inspect every pushed ref. New branches compare commits absent from the remote,
# not the commit against the clean working tree (which reports no changes).
REMOTE="$1"
RANGE=""
while read local_ref local_sha remote_ref remote_sha; do
if [ "$local_sha" = "0000000000000000000000000000000000000000" ]; then
continue # deleting branch
fi
if [ "$remote_sha" = "0000000000000000000000000000000000000000" ]; then
RANGE="$local_sha" # new branch
else
RANGE="$remote_sha..$local_sha"
fi
done

if [ -z "$RANGE" ]; then
exit 0
fi

CHANGED_FILES=$(git diff --name-only "$RANGE" 2>/dev/null || git diff --name-only HEAD~1)
CHANGED_FILES=$(
while read -r local_ref local_sha remote_ref remote_sha; do
Comment thread
Gajesh2007 marked this conversation as resolved.
Resolved
if [[ "$local_sha" =~ ^0+$ ]]; then
continue # deleting branch
fi
if [[ "$remote_sha" =~ ^0+$ ]]; then
git rev-list "$local_sha" --not "--remotes=$REMOTE" |
git diff-tree --stdin --no-commit-id --name-only --root -r -m || exit 1
else
git diff --name-only "$remote_sha" "$local_sha" || exit 1
fi
done
)

HAS_GO=$(echo "$CHANGED_FILES" | grep -q '^coordinator/' && echo 1 || echo 0)
HAS_TS=$(echo "$CHANGED_FILES" | grep -q '^console-ui/' && echo 1 || echo 0)
# Direct input avoids a producer SIGPIPE after an early match in a large list;
# pipefail would otherwise turn that successful match into a skipped check.
HAS_GO=$(grep -q '^coordinator/' <<< "$CHANGED_FILES" && echo 1 || echo 0)
HAS_TS=$(grep -q '^console-ui/' <<< "$CHANGED_FILES" && echo 1 || echo 0)

# ---------------------------------------------------------------------------
# Go — formatting + tests
# ---------------------------------------------------------------------------
if [ "$HAS_GO" = "1" ]; then
echo ">> [pre-push] Go formatting check..."
UNFORMATTED=$(cd coordinator && gofmt -l . 2>/dev/null || true)
if [ -n "$UNFORMATTED" ]; then
if ! UNFORMATTED=$(cd coordinator && gofmt -l .); then
echo "ERROR: Go formatting check could not run."
FAILED=1
elif [ -n "$UNFORMATTED" ]; then
echo "ERROR: Unformatted Go files:"
echo "$UNFORMATTED" | sed 's/^/ /'
echo "Fix with: cd coordinator && gofmt -w ."
FAILED=1
fi

echo ">> [pre-push] Go tests..."
# Skip internal/api — its WebSocket integration tests are slow (~5 min) and
# timing-sensitive. They run in CI instead.
if ! (cd coordinator && go test $(go list ./... | grep -v /internal/api) 2>&1 | tail -15); then
# API packages live directly under coordinator; run the full package set.
if ! (cd coordinator && go test ./... 2>&1 | tail -15); then
echo "ERROR: Go tests failed."
FAILED=1
fi
Expand Down
41 changes: 39 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ jobs:
python3 scripts/test-provider-release-resolution.py
./scripts/sync-install-embed.sh check
./scripts/test-prod-env-refresh.sh
- name: Test startup observer against local stubs
run: python3 -m unittest discover -s scripts/startup_measurement -t scripts -p 'test_*.py'

test-tooling:
name: Tooling Tests
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install CPU reference dependency in an isolated environment
run: make tooling-install
- name: Test tooling against synthetic fixtures and owned process stubs
run: make tooling-test
Comment thread
Gajesh2007 marked this conversation as resolved.
Resolved

docs:
name: Docs Lint
Expand Down Expand Up @@ -393,5 +401,34 @@ jobs:
run: cd console-ui && npm ci
- name: Lint
run: cd console-ui && npx eslint src/
- name: Test
run: make ui-test
- name: Build
run: cd console-ui && npm run build

test-admin:
name: Admin UI Checks
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: admin-ui/package-lock.json
- name: Install dependencies
run: make admin-install
- name: Lint, typecheck and test
run: make admin-lint admin-typecheck admin-test
- name: Build without a database connection
run: make admin-build

test-landing:
name: Landing Tests
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22'
- run: make landing-test
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ console-ui/ Next.js 16 / React 19 frontend
└── src/proxy.ts Next.js 16 proxy (replaces middleware.ts)

admin-ui/ Next.js 16 internal read-only ops dashboard (SELECT-only queries against the
prod read replica; Basic Auth via src/proxy.ts; has vitest tests, not in CI)
prod read replica; Basic Auth via src/proxy.ts; lint, types, Vitest and build run in CI)

landing/ static landing page (index.html, earn calculator, network stats)

Expand Down Expand Up @@ -121,7 +121,7 @@ root [`Makefile`](Makefile) — run `make` with no args to list all targets.
### One-time setup
```bash
mise install # installs every tool pinned in mise.toml
make ui-install # console-ui npm deps
make ui-install admin-install tooling-install # UI deps + isolated pinned Python tooling
```

### Coordinator (Go)
Expand Down Expand Up @@ -288,6 +288,6 @@ git config core.hooksPath .githooks

| Component | Check | Manual fix |
|-----------|-------|------------|
| Go (`coordinator/`) | `gofmt -l` | `gofmt -w <file>` |
| Go (`coordinator/`, `e2e/`) | `gofmt -d` on staged contents | `gofmt -w <file>`, then stage formatted changes |
| Swift (`provider-swift/`) | no enforced formatter | `cd provider-swift && swift test` |
| TypeScript (`console-ui/`) | `npx eslint src/` | `cd console-ui && npx eslint src/ --fix` |
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The full map is [`docs/architecture/overview.md`](docs/architecture/overview.md)
git clone --recurse-submodules git@github.com:Layr-Labs/d-inference.git
cd d-inference
mise install
make ui-install admin-install tooling-install
git config core.hooksPath .githooks # enables pre-commit + pre-push checks
```

Expand Down
48 changes: 44 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
.PHONY: help \
coordinator-test coordinator-build coordinator-build-linux coordinator \
prompt-sidecar-format prompt-sidecar-check prompt-sidecar-test prompt-sidecar-build prompt-sidecar \
provider-build provider-test provider benchmark-gemma-contbatch benchmark-wrapper-test \
provider-build provider-test provider benchmark-gemma-contbatch benchmark-wrapper-test tooling-install tooling-test \
ui-install ui-build ui-lint ui-test ui \
admin-install admin-build admin-lint admin-typecheck admin-test admin landing-test \
e2e-integration e2e-benchmark e2e \
docs-check docs-stamp \
test build all clean
Expand Down Expand Up @@ -79,6 +80,25 @@ provider: provider-build provider-test ## Build + test provider
benchmark-wrapper-test: ## Unit-test the Gemma benchmark wrapper (no GPU or weights)
cd scripts && python3 -m unittest discover -s gemma_contbatch/tests -t .

# Keep the pinned CPU dependency isolated and install only when its inputs change.
TOOLING_VENV ?= .venv/tooling
TOOLING_PYTHON = $(TOOLING_VENV)/bin/python
TOOLING_REQUIREMENTS = scripts/benchmarks/attention_packet/requirements.txt

$(TOOLING_VENV)/.requirements-installed: $(TOOLING_REQUIREMENTS) mise.toml
python3 -m venv --clear "$(TOOLING_VENV)"
"$(TOOLING_PYTHON)" -m pip install -r "$<"
touch "$@"

tooling-install: $(TOOLING_VENV)/.requirements-installed ## Prepare the isolated pinned CPU tooling environment

tooling-test: tooling-install ## Run CPU-only Python tooling tests
PYTHONPATH=scripts "$(TOOLING_PYTHON)" -m unittest discover -s scripts -t scripts -p 'test_*.py'
"$(TOOLING_PYTHON)" -m unittest discover -s scripts/benchmarks -p 'test_*.py'
"$(TOOLING_PYTHON)" -m unittest discover -s e2e/testbed -p 'test_*.py'
Comment thread
Gajesh2007 marked this conversation as resolved.
Resolved
"$(TOOLING_PYTHON)" scripts/test-provider-release-resolution.py
"$(TOOLING_PYTHON)" scripts/test-provider-signing-validation.py

benchmark-gemma-contbatch: ## Build and benchmark Gemma 4 26B continuous batching
python3 scripts/benchmark-gemma-contbatch.py $(GEMMA_BENCHMARK_ARGS)

Expand All @@ -98,6 +118,26 @@ ui-test: ## vitest for console-ui

ui: ui-install ui-lint ui-test ui-build ## Install, lint, test, build console-ui

admin-install: ## Install locked dependencies for admin-ui
cd admin-ui && npm ci

admin-build: ## Build the admin dashboard
cd admin-ui && ADMIN_DB_URL="$${ADMIN_DB_URL:-postgresql://unused:unused@127.0.0.1:1/unused}" npm run build

admin-lint: ## Lint admin dashboard sources
cd admin-ui && npm run lint

admin-typecheck: ## Check all admin dashboard TypeScript
cd admin-ui && npx tsc --noEmit

admin-test: ## Run admin dashboard unit tests
cd admin-ui && npm test

admin: admin-install admin-lint admin-typecheck admin-test admin-build ## Check and build admin-ui

landing-test: ## Run dependency-free landing page tests
node --test landing/*.test.js

# ---- E2E integration tests -------------------------------------------------
# Requires Postgres + Swift provider binary + MLX model downloaded.

Expand All @@ -119,12 +159,12 @@ docs-stamp: ## Refresh the freshness stamp on changed docs (FILES=... to target

# ---- Aggregates ------------------------------------------------------------

test: coordinator-test prompt-sidecar-test provider-test ui-test benchmark-wrapper-test docs-check ## Run all unit tests + docs lint
test: coordinator-test prompt-sidecar-test provider-test ui-test admin-test landing-test tooling-test docs-check ## Run all unit tests + docs lint
Comment thread
Gajesh2007 marked this conversation as resolved.
Resolved

build: coordinator-build prompt-sidecar-build provider-build ui-build ## Build all components
build: coordinator-build prompt-sidecar-build provider-build ui-build admin-build ## Build all components
Comment thread
Gajesh2007 marked this conversation as resolved.
Resolved
Comment thread
Gajesh2007 marked this conversation as resolved.
Resolved

all: test build ## Test + build everything

clean: ## Remove built artifacts
rm -f coordinator/coordinator coordinator/coordinator-linux
rm -rf coordinator/promptsidecar/target provider-swift/.build console-ui/.next console-ui/node_modules
rm -rf coordinator/promptsidecar/target provider-swift/.build console-ui/.next console-ui/node_modules admin-ui/.next admin-ui/node_modules
48 changes: 31 additions & 17 deletions docs/developer/build.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build

> Last updated: 2026-09-13 · commit `1f52a71fb`
> Last updated: 2026-09-13 · commit `c24ccb21a`

How to build every component of Darkbloom from a fresh clone: the Go
coordinator, the Rust prompt-contract sidecar, the Swift provider CLI (with its
Expand Down Expand Up @@ -60,15 +60,25 @@ Go/Swift fixture and focused checks are described in [test.md](test.md) and
mise install # installs every pin in mise.toml
git submodule update --init --recursive
git config core.hooksPath .githooks # enables pre-commit + pre-push (see "Git hooks")
make ui-install admin-install tooling-install # dependencies for aggregate build/test
```

`mise` activates the pinned versions per shell; on macOS the system Xcode
`swift` is also acceptable for `provider-swift`.
Activate `mise` in your shell to select the pinned versions; on macOS the system Xcode
`swift` is also acceptable for `provider-swift`. `tooling-install` prepares
`.venv/tooling` from the pinned attention-packet requirements. `tooling-test`
prepares it automatically when missing and recreates the environment when the
requirements file or `mise.toml` changes, using the activated toolchain and removing
dependencies that are no longer declared.
See [the tooling checks](test.md#6-scripts-and-release-integrity).
Use `make tooling-test TOOLING_VENV=.venv/tooling-py312` to select a different
directory (`Makefile`, `TOOLING_VENV`); nested offline bootstrap fixtures retain
their own temporary environments. The CPU tooling target supports macOS and
Linux; its owned-process fixtures manage their own child cleanup.

### 2. Build everything

```bash
make build # coordinator-build prompt-sidecar-build provider-build ui-build
make build # coordinator-build prompt-sidecar-build provider-build ui-build admin-build
make all # test + build (see test.md)
```

Expand Down Expand Up @@ -369,21 +379,22 @@ Local dev server: `cd console-ui && npm run dev`. Bundle budget check:

### 7. Admin UI (Next.js)

No `make` target. From `admin-ui/`:
From the repository root:

```bash
npm install
npm run lint # eslint src/
npm test # vitest run
npm run build # next build
npm run dev # next dev -p 4001
make admin-install
make admin-lint admin-typecheck admin-test admin-build
cd admin-ui && npm run dev # next dev -p 4001
```

`admin-build` supplies a nonconnecting local database URL when `ADMIN_DB_URL`
is unset, so aggregate builds need no database credentials. The running admin
service still requires its configured read-only replica URL.

### 8. Landing page

Static files in `landing/` (`index.html`, `earn-calculator*.js`, `terms.html`,
`privacy.html`); nothing to build. Run its one test with
`node --test landing/earn-calculator-core.test.js`.
`privacy.html`); nothing to build. Run its tests with `make landing-test`.

### 9. Coordinator container image

Expand Down Expand Up @@ -439,15 +450,18 @@ local stub servers; its default observation mode sends only public GETs.
| `benchmark-wrapper-test` | `cd scripts && python3 -m unittest discover -s gemma_contbatch/tests -t .` |
| `benchmark-gemma-contbatch` | `python3 scripts/benchmark-gemma-contbatch.py $(GEMMA_BENCHMARK_ARGS)` (needs GPU + weights) |
| `ui-install` / `ui-lint` / `ui-test` / `ui-build` / `ui` | `npm install` / `npx eslint src/` / `npm test` / `npm run build` in `console-ui/` |
| `admin-install` / `admin-lint` / `admin-typecheck` / `admin-test` / `admin-build` | Locked install, lint, full TypeScript, Vitest and build in `admin-ui/` |
Comment thread
Gajesh2007 marked this conversation as resolved.
Resolved
| `landing-test` | `node --test landing/*.test.js` |
| `tooling-install` / `tooling-test` | Prepare isolated pinned NumPy environment / run Python script packages, benchmark references, owned-host helpers and release validation fixtures |
| `e2e-integration` | `go test ./e2e/... -run TestIntegration -v` |
| `e2e-benchmark` | `go test ./e2e/... -run TestBenchmark -v` |
| `e2e` | `e2e-integration` |
| `docs-check` | `scripts/docs-check.sh` (stamps, links, cited paths, orphans) |
| `docs-stamp` | `scripts/docs-stamp.sh $(FILES)` — refresh freshness stamps |
| `test` | `coordinator-test prompt-sidecar-test provider-test ui-test benchmark-wrapper-test docs-check` |
| `build` | `coordinator-build prompt-sidecar-build provider-build ui-build` |
| `test` | `coordinator-test prompt-sidecar-test provider-test ui-test admin-test landing-test tooling-test docs-check` |
| `build` | `coordinator-build prompt-sidecar-build provider-build ui-build admin-build` |
| `all` | `test build` |
| `clean` | remove `./coordinator/coordinator{,-linux}`, `./coordinator/promptsidecar/target`, `./provider-swift/.build`, `./console-ui/.next`, `./console-ui/node_modules` |
| `clean` | remove `./coordinator/coordinator{,-linux}`, `./coordinator/promptsidecar/target`, `./provider-swift/.build`, `./console-ui/.next`, `./console-ui/node_modules`, `./admin-ui/.next`, `./admin-ui/node_modules` |

## Git hooks

Expand All @@ -456,10 +470,10 @@ components that changed.

| Hook | Trigger | Checks |
|---|---|---|
| [`.githooks/pre-commit`](../../.githooks/pre-commit) | staged `coordinator/**.go` | `gofmt -l` on the staged files (fix: `gofmt -w <file>`) |
| [`.githooks/pre-commit`](../../.githooks/pre-commit) | staged `coordinator/**.go` or `e2e/**.go` | `git show :<path>` into `gofmt -d`, checking index bytes even for partially staged files; format and restage failures |
| | staged `console-ui/**.ts{,x}` | `cd console-ui && npx eslint src/` (fix: `npx eslint --fix src/`) |
| | Swift | skipped — no enforced formatter |
| [`.githooks/pre-push`](../../.githooks/pre-push) | any `coordinator/` change in the pushed range | `gofmt -l .` over `coordinator/`, then `go test $(go list ./... \| grep -v /internal/api)` from `coordinator/` (the slow WebSocket integration tests run in CI only) |
| [`.githooks/pre-push`](../../.githooks/pre-push) | any `coordinator/` change in the pushed range | `gofmt -l .` and `go test ./...` from `coordinator/`; inspect every pushed ref, including new branches and large file lists |
| | any `console-ui/` change | `npx eslint --quiet src/` and `npm run build` |

CI runs the fuller set (`gofmt`, `golangci-lint`, `-race` tests, Swift, Rust,
Expand Down
Loading
Loading