Contributing
socialweb.computer rents VMs between atproto accounts: a requester asks for a VM, bidders bid, and the guest boots on the winner. This repository contains the CLI, the requester, the bidder, the gateways, the guest, and their tests. Everything here is under the Unlicense.
Contents
- Repository Layout
- Running Checks
- Opening a Pull
- CI Workflows
- Reading Failed Runs
- Contribution Rules
- Operating Our Deployment
Repository Layout
Use this table to find where each part lives and which checks to run after changing it. For how the parts fit together, see docs/how-it-works.md and docs/SYSTEM.md.
| Area | Location | What to Run |
|---|---|---|
| CLI (verbs, flags) | cmd/socialweb-computer | deploy/check.sh --fast (runs scripts/check-cli-args.sh) |
| Requester | internal/market/requester | deploy/check.sh --fast (its policy spec tests), then the pull |
| Bidder | internal/market/bidder | deploy/check.sh --fast (its policy spec tests), then the pull |
| Policy | internal/policyengine, internal/policyaction | deploy/check.sh --fast |
| SSH gateway | internal/services/sshserver | deploy/check.sh --fast, then the pull |
| Kubernetes gateway | internal/services/gatewayapi, internal/gatewayhttp | deploy/check.sh --fast, then the pull |
| Guest | internal/guestseed, internal/atproto/cloudinit, internal/guestagent | a VM on a local market, then the pull |
| kcp API types | api/v1alpha1 | go generate ./api/..., deploy/check.sh --fast (drift) |
| Lexicons | lexicons/ | deploy/check.sh --fast (codegen drift) |
| Mesh, pipes | rust/ | deploy/check.sh --local (cargo test) |
| Tests | tests/compositions/NNNN, tests/entries.txt, tests/host, tests/modules | the pull (the staging suite runs every entry) |
| CI | .knotless/workflows/, scripts/ci-*.sh | deploy/check.sh --fast, then the pull |
| Docs | README.md, docs/ | scripts/check-docs.sh |
| Site | site/ | site/build.sh |
Running Checks
Make sure Go, jq, and deno are on your PATH, then run the checks from the repository root:
deploy/check.sh --fast # 5 min: gofmt, codegen drift, go vet for every OS, architecture, docs, CLI args, policy spec tests
scripts/check-docs.sh # 19 s: every run=gate block of README.md, docs/quickstart*.md, docs/deploy.md, docs/bidder.md
site/build.sh # 2 s, warm: the site into site/out
To boot a VM from your local build without touching prod, follow docs/quickstart-local.md. The full staging suite runs every entry in tests/entries.txt on a fresh network (about 2 h 40 min) and runs automatically on your pull.
Opening a Pull
Our knotless instance is at https://knotless.socialweb.computer and this repository is knotless://socialweb.computer/socialweb-computer-kcp. Install the CLI, log in at your PDS, fork the repo, push your branch, and create a pull:
curl -fsSL https://knotless.dev/install.sh | sh
export KNOTLESS_APPVIEW=https://knotless.socialweb.computer
U=knotless://socialweb.computer/socialweb-computer-kcp
knotless login <you> # OAuth at your own PDS
knotless repo fork $U # knotless://<you>/socialweb-computer-kcp
git clone knotless://<you>/socialweb-computer-kcp && cd socialweb-computer-kcp
git checkout -b <branch> # change, commit
git push origin <branch>
knotless pull create $U main knotless://<you>/socialweb-computer-kcp <branch> "<title>" -m "<why>"
pull create prints the pull's at:// URI.
Signing In to the Runner
CI runs for your pull rent their VMs as you using your session, so you need to sign in once in a browser. Run this to print the login link for the current CI composition:
P=did:plc:ocnuqjlzgohypj3zoznermms N=socialweb-computer-cicd
pds() { curl -fsSL "https://plc.directory/$1" | jq -r '.service[] | select(.id == "#atproto_pds") | .serviceEndpoint'; }
CID=$(curl -fsSL "$(pds $P)/xrpc/com.atproto.repo.getRecord?repo=$P&collection=com.fedfork.exec.composition&rkey=$N" | jq -r .cid)
echo "https://knotless-runner.socialweb.computer/oauth/composition/$CID/login?handle=<you>&composition=at://$P/com.fedfork.exec.composition/$N"
If you haven't signed in, the pull's check fails and puts this link in its log. Whenever the CI composition changes (which gives it a new <cid>), you'll need to sign in again.
The runner's client-metadata.json for that composition asks for these scopes and nothing else from your account:
| Scope | Reason |
|---|---|
repo:com.publicdomainrelay.temp.market.{rfp,accept,event}, rpc:...market.submit{Rfp,Accept,Event} | Ask for a VM, accept a bid, and end the contract |
repo:com.publicdomainrelay.temp.compute.vm, ...compute.events.vm.delete, computer.socialweb.vm.kept | Manage the VM's records |
repo:...compute.events.guest.{signalWebRTC,publicKey}, ...badgeBlueKeys | Reach the guest and check what it signs |
repo:...market.association, repo:link.ident.endorsement | Let the CI VM's requester rent the staging VMs as your agent, for that contract only |
repo:computer.socialweb.ingress.offer, rpc:com.atproto.sync.listReposByCollection | Set up ingress for the run and find bidders |
Our secrets never reach a pull's run. Here is how the appview, runner, and bidders coordinate a pull run:
Getting Vouched
Bidders only bid for accounts that their operator vouches for, so until you're vouched your runs will fail with no bids received. Ask an operator by opening an issue with your DID using knotless issue create $U "vouch <your did>". The operator writes a vouch for you and you write one for the operator. See docs/quickstart-prod.md for the records and how to read them, and docs/bidder.md for the bidder's side.
CI Workflows
A pull runs checks, builds, and the staging suite under your account, and after a maintainer lands it on main, CI builds, publishes, runs the staging suite again, and promotes to the stable channel:
If a pull only changes docs or plans, CI skips it with skipped: nothing changed in .... Pushing a new commit to the branch cancels the older run.
Reading Failed Runs
Use knotless run list with the pull's at:// URI to check workflow status and read logs:
P=<the pull's at:// URI>
knotless run list $U --pull $P # status, workflow
knotless run list $U --pull $P --workflow release --log # a log; test: gate: staging: N of 47 PASS
Each RESULT <runbook>:<entry> FAIL line names an entry in tests/entries.txt. See docs/ci-debug.md for more on debugging failed runs.
Contribution Rules
Reviewers hold pulls to these rules (see AGENTS.md for the full set):
- Use watches and events instead of polling. Timers are only for deadlines.
- Add a test for every behavior you add or change. Tests are compositions under
tests/compositions/NNNNwith a line intests/entries.txt, and we don't write unit tests. - Don't add a security control (a cap, a limit, a refusal, or a scope) without the owner's approval. Propose it in docs/security/proposed-controls.md first.
- Keep everything ASCII only, and don't put comments in code.
- Keep docs short, with shell commands that were run and can be pasted, plus mermaid diagrams.
- Keep commits small. Never push a pull to main by hand, since a maintainer lands it through the merge queue.
- Everything in this repo is under the Unlicense.
Operating Our Deployment
For running and debugging our deployment, see these docs:
- docs/operate.md: the operator notebook (dev and release builds, a fresh host, bidders, the gateway, PDS ingress, troubleshooting, and a dev market network)
- docs/bidder.md, docs/gateway.md, and docs/deploy.md
- docs/ci-debug.md: running CI by hand
- docs/README.md: every doc