Contributing to Peerborne
Discuss non-trivial, architecture-changing, or security-sensitive work before implementation. Questions and early ideas belong in Discussions; reproducible bugs and actionable proposals belong in Issues. Suspected vulnerabilities must use private vulnerability reporting from the repository Security tab, never a public issue or discussion.
Use Node.js 26.13.1 and Yarn 4.19.0, as pinned by .tool-versions and package.json. Node.js 26 no longer bundles Corepack, so install it first.
git clone https://github.com/Peerborne/peerborne.gitcd peerbornenpm install --global corepack@0.36.0corepack enableyarn install --immutableThe nineteen root workspaces are eleven libraries under packages/, seven browser/SSR examples under examples/, and site/. relay-server/ and e2e/test-app/ are separate projects with their own manifests and lockfiles; they are not root workspaces.
Current workspace package names use @peerborne/*. They are not published to npm, so develop and test against repository workspaces only.
Repository map
Section titled “Repository map”| Path | Purpose |
|---|---|
packages/core/ |
Core documents, storage, networking, crypto, ACL, UCAN, epoch, and BeeKEM primitives |
packages/{automerge,yjs}/ |
CRDT adapters; both contain headless daemon binaries |
packages/{react,redux,index}/ |
Framework bindings and distributed-index primitives |
examples/{browser-test,wiki-swarm,password-manager,peerborne-note}/ |
Vite applications used by the four smoke suites |
site/ |
Astro Starlight documentation and TypeDoc integration |
relay-server/ |
Separate relay project and unit suite |
e2e/integration/ |
Playwright transport integration and NAT specs using e2e/test-app/ |
e2e/test-app/ |
Separate minimal browser project for integration topologies |
e2e/peerborne-nat.spec.ts |
Real Peerborne cross-NAT acceptance spec |
docker-compose.integration.yaml |
Integration service topology |
docker-compose.nat-test.yaml |
isolated transport NAT topology |
docker-compose.peerborne-nat.yaml |
Two isolated browsers and real Peerborne apps |
docs/feature-audit.md |
Capability-to-evidence audit and known end-to-end gaps |
There is no multi-user.spec.ts; the example suites are bounded smoke tests,
not complete multi-user, recovery, or availability showcases. The separate
cross-NAT job supplies the current two-browser invitation evidence.
Build and test commands
Section titled “Build and test commands”yarn build # eleven library workspacesyarn build:examples # libraries, then all seven example appsyarn test # eleven library Jest suitesyarn test:relay # separate relay-server Jest suiteyarn exec playwright install chromiumyarn test:e2e # four example apps and the integration examples; no Dockeryarn test:e2e:peerborne-note:live # deployed app + public relay; set PEERBORNE_NOTE_LIVE_URLBuild the documentation from site/ with the same runtime.
(cd site && yarn build)Use yarn exec playwright install chromium --with-deps when Linux system browser dependencies are also needed.
yarn benchmark:all executes both benchmark packages. Results are informational; benchmark work should define repeatable environments and budgets before making regression claims. Use --iterations 1 --max-documents 100 for a bounded smoke run.
Convergence simulation
Section titled “Convergence simulation”yarn verify:simulation builds the libraries and runs the seeded schedules and regression repros that CI runs. Each schedule drives real Automerge and Yjs replicas over a simulated transport through faults, partitions, restarts and membership changes, then checks convergence, acknowledged edits and removed members. It is randomized testing, not proof.
After yarn build, run, save, replay and shrink schedules directly:
node verification/simulation/run.mjs --seeds 1..20node verification/simulation/run.mjs --seeds 1..20 --adapter yjs --devices 2node verification/simulation/run.mjs --seeds 12 --save /tmp/simnode verification/simulation/run.mjs --replay /tmp/sim/schedule-12.jsonnode verification/simulation/run.mjs --replay /tmp/sim/schedule-12.json --shrink--shrink removes operations while the replay still fails the same way and writes a .min.json schedule. A failing CI run uploads each failing schedule and its log, which replay the same way. Timing is real, so replay a minimized schedule several times before adding it to verification/simulation/repros/. The simulation README describes the checks, suites and evidence boundary.
Docker-backed suites
Section titled “Docker-backed suites”The test command alone does not create the required service topology. GitHub CI is the canonical sequence.
Define the bounded HTTP readiness helper in Bash:
wait_http() { local attempts=0 until curl -fsS "$1" >/dev/null; do attempts=$((attempts + 1)) [ "$attempts" -ge 60 ] && return 1 sleep 2 done}Run one topology at a time and always tear it down afterward:
docker compose -f docker-compose.integration.yaml up -d --buildfor port in 3001 3002; do wait_http "http://127.0.0.1:$port"; doneCI=true yarn test:integrationdocker compose -f docker-compose.integration.yaml down -v
docker compose -f docker-compose.nat-test.yaml up -d --buildfor port in 3001 3002 3003; do wait_http "http://127.0.0.1:$port"; doneCI=true yarn test:natdocker compose -f docker-compose.nat-test.yaml down -v
docker compose -f docker-compose.peerborne-nat.yaml up -d --buildnode scripts/wait-remote-chromium.mjs ws://127.0.0.1:3101/ ws://127.0.0.1:3102/CI=true yarn test:peerborne-natdocker compose -f docker-compose.peerborne-nat.yaml down -vThese helpers mirror CI’s 120-second readiness budget. Remote browsers must complete a Playwright connection; an open Docker TCP port alone does not establish readiness. The workflow remains the canonical sequence, including failure logs and unconditional cleanup.
Integration checks transport discovery, bidirectional messaging, resilience, and NAT behavior through the test app. The real Peerborne cross-NAT job uses two signing identities, accepts a signed invitation without exposing a plaintext document key or injecting one through the test bridge, and asserts fresh document mutations in both directions through Circuit Relay. It does not prove restart recovery, offline acceptance, revocation, partition/rejoin, or relay failover.
Generated API reference
Section titled “Generated API reference”The Site workflow runs the documentation build with the Node runtime pinned in the repository’s .tool-versions. Starlight TypeDoc generates package API Markdown into the ignored site/src/content/docs/reference/api/ directory. Change exported source comments or site/astro.config.mjs, then rebuild the site. Starlight TypeDoc is the only API reference workflow.
Pull request expectations
Section titled “Pull request expectations”- Keep commits and pull requests focused. Add regression tests for fixes and focused adversarial tests for security-sensitive behavior.
- Never expose or log credentials, signing keys, KEM keys, document keys, private payloads, or other secrets.
- Peerborne has no users, so do not add backward compatibility, migrations, deprecation shims, or migration/compatibility tests. Serializer, protocol, key, ACL, and persistence changes update producers and consumers together and need malformed-input, replay, and adversarial tests for the current format.
- Run the relevant commands locally and report evidence without overstating what it proves.
- Address review findings. Repository policy expects Copilot review to return no comments on the latest head and all applicable CI checks to pass.
- Use normal project-style commit messages. Do not add automatic co-author or AI-attribution trailers unless the contributor explicitly requests them.
The CI workflow runs the eleven-package build and unit-test matrix, relay tests, example and integration browser suites, Docker integration, NAT traversal, the real Peerborne cross-NAT job and the convergence simulation. A separate scheduled workflow runs a larger simulation sweep. The separate Site workflow builds generated TypeDoc and the site.
Review timing depends on maintainer availability; there is no response or review-time SLA.
License
Section titled “License”Peerborne and all eleven package manifests use the MIT License.