The workflow for contributing bug fixes, docs changes, and features.
- Use the repo map to find a feature and its tests. The AI workflow adds scope, log, and handoff rules for agents.
- Open an issue before writing code for anything beyond a small fix. Discuss the approach there first.
- Check the open issues for existing work on the same thing.
- This project follows a Code of Conduct; by participating you agree to uphold it.
The dashboard uses uv for dependency management; a hashed
uv.lock pins every transitive dependency for reproducible installs. Its Python tooling
(ruff lint + format, pre-commit)
lives in the dev extra. Install uv, then from the repo root:
uv sync --project dashboard --extra dev # deps + tooling into dashboard/.venv, from the lock
uv run --project dashboard pre-commit installmake test and make lint-py run through uv automatically (no venv to activate); pre-commit
runs ruff (plus a few hygiene hooks) on your changed files. If you change dependencies in
dashboard/pyproject.toml, run uv lock --project dashboard and commit the updated uv.lock.
For a transitive security fix, update only the affected package with
uv lock --project dashboard --upgrade-package certifi==2026.10.19 (substitute the package and
verified fixed version). Review the lockfile diff, run the dashboard tests, and require the
built dashboard image's Trivy scan to pass without adding an ignore entry.
dashboard/tests/test_dependency_security.py checks the locked and loaded runtime security
floors, requires locked virtualenv 21.14.13 and filelock 4.2.1 or newer for pre-commit's
dev-only environments, and verifies that Requests' CA bundle excludes the compromised
emSign ECC Root CA - G3.
The root pithead executable is generated and git-ignored. Plain make builds it from the
numbered lib/pithead/*.sh sources; the test targets also build it when needed. Edit the slices,
not the generated file.
The full shell and appliance selftest suite expects Linux and a non-root user, as in
CI. It uses GNU utilities and tests permission failures that root would bypass. On Linux,
install Bash, Git, Make, jq, Node, Python 3, e2fsprogs, xxd, and the shellcheck/shfmt
versions pinned in Makefile, and run under a UTF-8 locale. Missing system Python, xxd, or a
UTF-8 locale does not error — it changes a verdict; see
what each tier needs.
On macOS or Windows, run it in the image instead — it carries that toolchain at the pinned versions and needs nothing on the host but Docker:
make test-container # the whole local suite, as CI runs it
make test-container ARGS="make test-stack" # one target
make test-container ARGS="bash" # a shell in the imageThe shell suite refuses to run directly on macOS and that refusal is correct: the assertions
are written against GNU sed/stat, BSD tools differ without failing loudly, and an
unmodified develop scores 3708 passed / 148 failed there. The container is how you get a
verdict that means something. The dashboard and frontend unit suites still run fine on the host.
The standalone soak probe is also portable: run bash tests/os/soak-probe.sh --self-test
on Linux or macOS with Bash 3.2 or newer, Python 3 and jq; it does not require GNU tools.
-
Fork the repo and create a branch off
develop(the integration branch;mainholds released commits only — it fast-forwards to each release's tagged commit, see Releasing › Branch mechanics). -
Make your change. Keep it focused: one logical change per PR.
-
Run the full test suite locally:
make testThis runs everything CI does that doesn't need a live test server:
- lint — every file surface gets a linter/formatter check (
make lintruns them all; run one withmake lint-<surface>):lint-sh(shellcheck + shfmt),lint-py(ruff),lint-js(Biome),lint-yaml(yamllint),lint-md(markdownlint),lint-docs-voice(banned-word check),lint-path-references(every repo path named in a comment, docstring or doc has to resolve, and so does every statically resolvablesourcetarget — a reorganization moves the target and leaves the pointer, and nothing else here notices; the run prints how manysourceexpressions it could not resolve statically, so that blind spot stays visible; deliberate absences go in the script's ownallowed_absent()with a reason, never a per-file exemption),lint-operator-strings(no issue/PR numbers in operator-facingpithead/dashboard text, including untracked, non-ignored frontend files, and no baredocs/paths inpitheadoperator text — release bundles carry a curated operator-doc subset, not arbitrary repo paths, so point at$DOCS_URL/docs/<file>.md#anchorinstead; comments keep the plain path),lint-topology(no real-looking IPv6/IPv4 literal,/home/<name>path,.lan/.internal/.localhostname, oruser@hoststring — a public repo, so every one of those has to stay a generic class, not a trace of whoever's actual box; an instantiated service drop-in under/systemd/system/is a unit name, not an address;tests/anddocs/are an accepted exemption boundary for illustrative/fixture content, and each class also carries a small, explicit allowlist — see the script's own header — never a per-file exemption comment),lint-file-budget(the file-budget ratchet, issue #1105 Phase 0 — see File budget gate),lint-pithead-build(the generatedpitheadmust build fromlib/pithead/*.shin a clean checkout — issue #1105 Phase 2),lint-trivy-parity(the CVE gate installs trivy once per job via./.github/actions/install-trivy, and that step'sversion:is the only line that decides which engine scans — every trivy-action step passesskip-setup-trivy: trueand declares no version of its own. The gate holds those literals acrossci.yml,os-rootfs.ymlandtest-images.yml, andscripts/watch/trivyignore-watch.sh, to one trivy engine version — issue #1290 — and holds the shape that keeps that meaningful: per workflow, the counts of trivy-action steps,install-trivysteps andskip-setup-trivy: truelines must match, noversion:may reappear in a trivy-action step where nothing would resolve it, and neitherinstall-trivynorretry-trivy-scanmay carry a pin of its own — so the cached installer keeps a transient GitHub Releases outage from redding every scan, issue #2214),lint-proto(buf),lint-toml(taplo). The non-Python tools run vianpx/uvx/docker, so a contributor needs Node, uv, and Docker on PATH (plusshfmt);pre-commitruns the same checks on changed files. Link-checking (lychee) runs on a weekly schedule, not per-PR. - test-dashboard — the dashboard
pytestsuite (must stay ≥ the 80% total coverage gate). CI also runsmake test-patch-coverage(diff-cover): new/changed lines must be ≥ 90% covered against the PR's own base branch, the ratchet that stops coverage rotting at the margin. The gate says so explicitly when a diff has nothing it measures (shell/docs-only PRs pass loudly), and fails if a changed dashboard Python file is missing fromcoverage.xmlentirely — the silent no-op it used to be. Run it right aftermake test-dashboard, socoverage.xmlis fresh. - test-frontend — the frontend logic tests (
node --test); uses the same Node that the lint surfaces already require. - test-stack — the
pitheadshell test suite. - test-compose —
docker-compose.ymlinterpolation validation. - test-integration-selftest — the integration harness's logic and bounded local transport fixtures.
- test-tools — bounded build-log sanitization, shell-suite timeout guards, pinned CI uv installs, and Monero archive download recovery, integrity and deadline checks against a local HTTPS fixture. The download tests need curl, OpenSSL and sha256sum; they run without Docker or public-network access.
- test-fakes — the tier-2 contract test (real dashboard clients vs controllable fakes).
Bigger, infra-dependent suites run separately:
make test-mini-stack(tier-3 docker) andmake test-integration(tier-4 live, against a real box; start with--check). - lint — every file surface gets a linter/formatter check (
-
Add or update tests for your change. Cover the intent (a behavior/contract), not just the line. The Testing Guide has per-change recipes; the Testing Strategy explains the tiers.
-
Update the docs in
docs/(and the README, if relevant) for any user-facing change. To see what the suites cover,make test-inventorywrites a generated (git-ignored) inventory you can read locally.
The required gitleaks check scans the full history reachable from HEAD, using
.config/gitleaks.toml and .config/gitleaksignore. Removing a literal from the
current file does not remove its historical finding. Verify that a reported value
is synthetic before adding an exact commit:file:rule:line fingerprint to the
ignore file; a squash merge has a different commit and therefore a different
fingerprint. Keep real credentials out of exceptions and rotate them if exposed.
The history-scan job also runs bash scripts/lint/selftest-gitleaks-history.sh.
It checks the synthetic restore-connection Digest exception, detects the finding
with that exception removed, and detects an identical fixture in a new commit.
The stale dashboard-hash exception accepts only the complete reviewed fixture
line in its exact test paths. The selftest requires both findings at distinct
columns when another credential precedes that fixture, and detects altered
lines and copies in unreviewed paths. The connection-bound libcurl fixture
remains authenticated and verifies the wire response independently with OpenSSL.
The file-budget ratchet (issue #1105 Phase 0). A new tracked file has a hard ceiling of 800 lines, target
400; an existing offender's current line count is its personal ceiling in docs/dev/file-budget.tsv, and a
PR may not grow it past that — ceilings only ever move down, and the gate rejects a budget edit that raises
one.
A deliberate, justified addition to a budgeted file therefore has exactly one legal path: split or shrink
the file so the addition fits under a ceiling that stays put or drops — see issue #1258 for the worked
example, where a security test that outgrew its file moved into its own — and note that two same-wave merges
can each pass alone and fail together, so re-run make lint after merging onto the tip.
Actions PR validation compares against the fetched origin/$GITHUB_BASE_REF,
the PR's target branch. A missing target ref fails instead of falling back to
develop. Keep fetch-depth: 0 on the lint job so that ref is available.
For local validation of a release-branch PR, fetch its base and select it explicitly:
git fetch origin develop-v2.1.0
make lint-file-budget FILE_BUDGET_BASE_REF=origin/develop-v2.1.0FILE_BUDGET_BASE_REF takes precedence over GITHUB_BASE_REF and must resolve
to a commit. Without either selection, the gate tries origin/develop, then
local develop. If neither resolves, CI fails; a local checkout prints a note
and skips the ratchet comparison. Enumeration and per-file checks still run.
make lint-file-budget exercises these modes with isolated Git fixtures,
including divergent integration and release-branch budgets. The self-tests
clear inherited base selections before creating their fixture refs.
Generated code, vendored files, data/config, and prose docs are exempt by glob — see is_exempt() in the
script. The generated, git-ignored pithead is outside the tracked-file budget; the gate governs its
lib/pithead/*.sh sources.
One row was exempt from the ceilings-only-move-down half, and only that half: lib/pithead/99-remainder.sh
measured how much of that generated artifact Phase 2 had not split out yet, not the size of a file anyone
writes. Without that, the CLI could not gain a line, because the row refused to rise and the artifact grew
past it (issue #1464). That row has retired, and not by
reaching the 400 target: Phase 2 split the remainder out completely, so the file was deleted at 949 lines
and nothing in docs/dev/file-budget.tsv names it now. monotonic_exempt() in the script still carries the
arm and the reasoning behind it.
develop is the integration branch for everything the repo ships — the Docker Compose product and
the appliance OS tree under os/ — and it is the repo's default branch. Until 2026-09-06 the
appliance lived on a twin branch, develop-v2; that branch was fast-forwarded into develop and
retired, so a reference to it anywhere in this tree is stale and should be fixed, not followed.
Automation that GitHub reads from a fixed location must live on the default branch. GitHub
fires a workflow's schedule: trigger from the default branch only, and Dependabot reads
.github/dependabot.yml from the default branch only. A scheduled workflow or a Dependabot entry
that lives anywhere else never runs — and a job that never runs looks exactly like a job that ran
and found nothing, which is why this went unnoticed three times while the twin existed
(#1146, #1162, #1163). Its sibling is #1048, worth knowing next to it: there the schedule did fire,
and the job skipped itself behind an unset repository variable, so main showed green for a gate
that had never run. Nothing in the tree needs an explicit checkout ref: or a Dependabot
target-branch: any more; if you find one, it is left over from the twin.
Check this from run history, never from the file — the file always looks fine:
gh run list --workflow=<name>.yml --limit 200 --json event \
--jq '[.[].event] | group_by(.) | map({event: .[0], n: length})'No schedule key in that breakdown means the schedule has never fired. A schedule key is
necessary but not sufficient — #1048's shape passes that test — so open the newest scheduled run and
check its steps actually ran rather than skipping:
gh run view <run-id> --json jobs \
--jq '.jobs[].steps[] | "\(.conclusion) \(.name)"'The Dependabot equivalent of the first check is to group its PRs by baseRefName.
-
Target the
developbranch and fill out the PR template. Security and bug fixes always targetdevelop; adevelop-vX.Y.Zrelease line takes feature work for a later release only. -
Link the issue your PR addresses (e.g.
Closes #123). -
Make sure
make testpasses; CI runs the same checks. -
For a PR targeting
develop, read merge readiness frommergeableandmergeStateStatus, never from the check rollup. Run:gh pr view <number> --repo p2pool-starter-stack/pithead --json mergeable,mergeStateStatus
Documentation alone does not close this gap: a conflicting PR can still report every check green unless repository rules block it. Track that separate enforcement work in issue #2237.
-
A PR into
developmerges on green required checks plus theadversarial-reviewstatus recorded on its head SHA by a session that did not author it, human-driven or automated; see AI workflow. The merge is a squash, and only the owner's account performs it. Two merges are not squashed: a forward merge into adevelop-v*line, and folding a line back intodevelop; see Releasing. A PR intomainalso needs the code owner.
- Match the surrounding code. Shell scripts should pass
shellcheck --severity=warning; Python is linted and formatted byruff(config indashboard/pyproject.toml). Runmake lint-py, orcd dashboard && ruff formatto apply it. - Keep commits tidy and messages descriptive.
By contributing, you agree that your contributions are licensed under the project's MIT License.