0
0
plan 0040: one plan, no SKIP, 0010 removed; promote asked-only (step 0)
.knotless/workflows/promote.yml+7−8
| @@ -1,12 +1,11 @@ | ||
# knotless CI: plan 0040 step 6, the release of a green main. After `test`, on the `release` executor binding (only main's names | ||
# socialweb-computer-release, whose release-workload module holds the socialweb.computer session with the software.release.* | ||
# scopes): its one step is `release <command>`: the module writes the rc's manifest and version and moves channel rc, runs the | ||
# command on the VM (scripts/promote.sh: the droplets, the rc operators' heartbeats, the prod gate), then moves stable on exit 0, | ||
# or moves rc back and runs `scripts/promote.sh rollback`. | ||
# knotless CI: plan 0040's promote, the release of a green main. Runs only when asked until plan 0040 step 15 (its push | ||
# trigger, with paths internal/**, cmd/**, api/**, tests/**, rust/**, deploy/**, scripts/**, go.mod, go.sum, .knotless/**, | ||
# comes back then). After `test`, on the `release` executor binding (only main's names socialweb-computer-release, whose | ||
# release-workload module holds the socialweb.computer session with the software.release.* scopes): its one step is | ||
# `release <command>`: the module writes the rc's manifest and version and moves channel rc, runs the command on the VM | ||
# (scripts/promote.sh: the droplets, the rc operators' heartbeats, the prod gate), then moves stable on exit 0, or moves rc | ||
# back and runs `scripts/promote.sh rollback`. | ||
on: | ||
push: | ||
refs: [refs/heads/main] | ||
paths: [internal/**, cmd/**, api/**, tests/**, rust/**, deploy/**, scripts/**, go.mod, go.sum, .knotless/**] | ||
asked: | ||
refs: [refs/heads/main] | ||
runners: [aliceoa.bsky.social] | ||
docs/acceptance/0010-ios-app.mddeleted+0−262
| @@ -1,262 +0,0 @@ | ||
# Acceptance 0010: iOS app, embedded kcp requester (AT-IRC) | ||
| ||
Acceptance procedures for the AT-IRC iOS app: the in-process kcp + socialweb | ||
requester, the market (Agents) flow, presence, and device performance. This is | ||
the iOS counterpart to the k8s, ssh, and browser-page acceptance docs. | ||
| ||
- Author: the `atirc-ios-client-dev` peer agent; folded here by the docs agent (device ids replaced by placeholders) | ||
- Plan: [0038](../plans/0038-ios-embedded-kcp.yaml) | ||
- Final pass: simulator 2026-11-10, alice, final code (kcp 5e6c4e3d, app a8d1678, rollout 8 bidders + gateway): A1 | ||
19:52Z (13 scopes, Ready after relaunch); A2/A3 forced to webrtc 20:01-20:06Z (3 bidders connected in 1.5-1.8 s, | ||
won by did:plc:2l2wdr..., peer record published, released, peer and association deleted, 14 of 14 records deleted). | ||
One launch before it sat after `requester_started` with no discovery for 6 min; a relaunch went through | ||
- Last pass: simulator 2026-11-10, alice, bidders reached over WebRTC only (kcp aaab79d0, app 37c9b0f, rollout 6 | ||
bidders): A1 16:24Z (41 scopes granted), A2 hat-9 Held 16:27Z, A3 Released 16:31:34Z (14 of 14 records deleted), | ||
A4 cross-restart release 16:37:37Z. A5/A6 not re-run (no change since 2026-10-31) | ||
- Related: [0004](0004-vm-atirc-agent.md) (agent path), [0008](0008-host-observer.md) (host evidence) | ||
- Bidders advertise iroh and webrtc endpoints (hat-7's `market-https=true` transition ended 2026-11-10; no prod bidder advertises https). The embedded | ||
requester has no dumbpipe, so it takes webrtc (`internal/ingress/webrtc` MeshDialer: sealed | ||
`computer.socialweb.ingress.offer` record, answer by getRecord, HTTP over datachannels); the simulator runs force | ||
it with `SIMCTL_CHILD_SOCIALWEB_REQUESTER_BIDDER_ENDPOINTS=webrtc` | ||
| ||
## Artifacts | ||
| ||
| Item | Value | | ||
| --- | --- | | ||
| App repo | `~/src/atirc-client-ios/AT-IRC` (local only; no remote) | | ||
| Framework | `GoLib/AtircGo.xcframework`, built by `GoLib/build.sh` from `SOCIALWEB_COMMIT` of `SOCIALWEB_SRC` (a socialweb-computer-kcp clone); it seeds the patched apiserver module under /tmp itself | | ||
| Framework target | socialweb-computer-kcp `5e6c4e3d` (`a8d1678`, final); A1-A4 accepted on `aaab79d0` (`37c9b0f`), A1-A3 again on `c770a887` and `5e6c4e3d` | | ||
| App build | `a8d1678` (client_id scope = `RequesterOAuthScope`, 13 tokens; presence `2c23c1f`, perf `a43e389`) | | ||
| Simulator | iPhone 17e (`<simulator udid>`) | | ||
| Device | owner iPhone (`<device udid>`) | | ||
| Bundle id | `com.fedfork.irc.AT-IRC` | | ||
| ||
Never add a second gomobile framework: one Go runtime per app. | ||
| ||
## Preconditions | ||
| ||
- Build succeeds: | ||
`xcodebuild -project AT-IRC.xcodeproj -scheme AT-IRC -configuration Debug -destination 'platform=iOS Simulator,id=<simulator udid>' -derivedDataPath .build build` | ||
- Tests pass: `xcodebuild ... test` (17 unit + 2 UI at `f8e4841`). | ||
- IRC account signed in (the app's own atproto OAuth account): `Scripts/sim-signin.sh <simulator udid>` (alice). | ||
- `OAuthClient.scope` (the loopback client_id's scope) equals the pinned kcp's `oauth.RequesterOAuthScope` | ||
(`OAuthScopeTests`): the market sign-in reuses that client_id. | ||
- Market identity may be `SessionExpired`; A1 re-signs it. | ||
- Gateway/socialweb services reachable; bidders Ready. | ||
| ||
## A1 - Market sign-in and persistence | ||
| ||
Purpose: the requester's OAuth callback must reach the requester and survive a | ||
restart. | ||
| ||
Steps: | ||
1. Open Agents (`ATIRC_OPEN_AGENTS=1` automates this in the simulator). | ||
2. If identity is `SessionExpired`, tap **Sign in to market**. | ||
3. Complete the PDS OAuth flow in the Safari sheet. | ||
4. Confirm the return page says signed in and the Agents screen turns Ready. | ||
5. Kill the app, relaunch, open Agents. | ||
| ||
Pass criteria: | ||
- App log `market-oauth: callback received keys=code,iss,state` followed by | ||
`callback forwarded status=200`. | ||
- `market identity ready`, then `marketidentity phase=Ready`. | ||
- After kill/relaunch: `marketidentity phase=Ready` (not `SessionExpired`). | ||
| ||
Failure signatures: | ||
- `callback forward failed: kcp HTTP 404` -> OAuth callback was routed at the | ||
apiserver instead of the requester (`X-Atirc-Direct` must be absent on | ||
`/oauth/callback/requester`). | ||
- `SessionExpired` after restart -> requester snapshot was not persisted on | ||
Ready. | ||
- No sign-in URL -> loopback bind failed or config empty; check | ||
`market-oauth` logs and the visible error text. | ||
- `callback received keys=error,error_description,iss,state` and the browser shows `Sign-in failed: | ||
invalid_scope` -> the requester asks for a scope the app's client_id does not declare; regenerate | ||
`OAuthClient.scope` from the pinned kcp's `RequesterOAuthScope`. | ||
- The PDS password step says `The data you submitted is invalid` -> the loopback client_id (it carries the whole | ||
scope) is too long: 44-46 single-collection tokens (client_id about 3.6-3.8 KB) failed, through PAR too. Since | ||
c770a887 the requester asks multi-collection repo permissions (`repo?collection=..&collection=..&action=..`, | ||
13 tokens) and signs in with PAR. | ||
| ||
## A2 - Launch, agentStart, join | ||
| ||
Purpose: the app launches a market VM and the agent speaks on the channel. | ||
| ||
Steps: | ||
1. Agents -> **Launch** (or `ATIRC_TEST_AGENT_LAUNCH=1`). | ||
2. Wait for a new contract to reach `Held`. | ||
3. Persist the snapshot (`KCPHost.persistSnapshot()`, automatic in the test | ||
hook after the mint). | ||
4. Tap **Start agent** (ContractEvent `guest.agentStart`). Test hook does this | ||
after 40 s. | ||
5. Watch the channel for the agent's join and first message. | ||
| ||
Pass criteria: | ||
- Contract shows `Held` with a VM name. | ||
- Console (`simctl launch --console-pty`): `webrtc_mesh_connected` per bidder (about 1.4 s), no iroh or https | ||
bidder endpoint. | ||
- `ContractEvent` outbound `guest.agentStart` settles: `agentStart ... Submitted: submitted to webrtc://...`. | ||
- Token-less agent: `requester_agent_lease_written`, `requester_agent_mesh_key_written`, | ||
`requester_agent_peer_published` (no `requester_agent_peer_failed`; a ScopeMissingError there means the | ||
session lacks `repo:computer.socialweb.peer`; sign in again). | ||
- Agent process runs on a bidder host; request host-side logs confirm the VM. | ||
- Guest join on the channel: 0004 / 0011 own the mesh agent; not re-checked from the app on 2026-11-10. | ||
| ||
## A3 - Release before termination | ||
| ||
Purpose: Release ends the VM and removes the agent's lease, its mesh peer record and the contract's records. | ||
Token-less agents hold no atirc token, so there is no revoke step (the lease latch and the association expiry make | ||
a missed cleanup harmless). | ||
| ||
Steps: | ||
1. With a Held/running contract, tap **Release** (the test hook releases 240 s after agentStart). | ||
2. Observe the release over WebRTC and the record cleanup. | ||
| ||
Pass criteria: | ||
- `requester_released`, then `requester_agent_peer_deleted` and `requester_association_deleted`. | ||
- `requester_contract_records_deleted deleted=N of=N` and no `requester_record_delete_skipped`. | ||
- No `computer.socialweb.ingress.offer` record left in the account. | ||
- Host reports the VM gone (no firecracker for it). | ||
| ||
Observed accepted run (2026-11-10, hat-9): released 16:31:34Z, peer and association deleted the same second, | ||
14 of 14 records deleted (`einfra-atirc-ios-z2g1t8`). | ||
| ||
## A4 - Cross-restart release from sealed snapshot | ||
| ||
Purpose: a Release must complete from persisted state after the app process | ||
died. | ||
| ||
Steps: | ||
1. Launch a contract and wait for the mint. | ||
2. Persist the snapshot (release build does this automatically at launch and | ||
after contract changes). | ||
3. Terminate the app. | ||
4. Relaunch and open Agents; the contract row must still be present. | ||
5. Release it. | ||
| ||
Pass criteria: | ||
- Chat shows the restored contract row before any network refresh. | ||
- The fresh requester signals a new WebRTC session to the winner and releases: `requester_released`, | ||
`requester_agent_peer_deleted`, `requester_association_deleted`, `requester_contract_records_deleted`. | ||
- Evidence: `infra restore visible=true`, then `released contracts=<id>`. | ||
- The requester compose must not stall on `Workspace <app|socialweb-provider> phase Initializing initializers | ||
[system:apibindings]` (see Known pitfalls; fixed in the kcp fork, kcp-ios 120706ba2). | ||
| ||
If restore says the snapshot was discarded as stale, the app cold-boots; the | ||
release must still work from a fresh requester once identity is Ready. | ||
| ||
## A5 - Presence: member list and join/leave lines | ||
| ||
Purpose: the chat view shows who is connected and streams join/leave. | ||
| ||
Steps: | ||
1. Open a busy channel (e.g. the owner channel) with several agents online. | ||
2. Tap the people badge. | ||
3. Let peers join and leave. | ||
| ||
Pass criteria: | ||
- Badge count matches the `presence_snapshot` identities and updates live. | ||
- Member sheet lists nicks (colored) and hosts, with the local account marked | ||
**you**. | ||
- Inline dim lines appear: `-- nick joined` / `-- nick left`. | ||
- A second tab of the **same** DID produces no extra join/leave (presence is | ||
per identity); use two different DIDs to test. | ||
| ||
Notes: | ||
- Presence snapshot arrives on every subscribe; members are cleared on | ||
reconnect and repopulated from the next snapshot. | ||
- Joins/leaves are coalesced to one state update per 250 ms. | ||
| ||
## A6 - Performance baseline | ||
| ||
Purpose: presence churn and chat scrolling must not degrade the app. | ||
| ||
Pass criteria: | ||
- Idle CPU ~0 % with kcp/requester running and presence churn on the channel. | ||
- No `glassEffect() tried to update multiple times per frame` warnings. | ||
- Chat scroll stays put when the reader is scrolled up (owner bug 3981); | ||
a "N new messages" pill appears instead. | ||
- Launch: kcp ready ~4 s, requester ready ~5-6 s on simulator. | ||
| ||
## Known pitfalls | ||
| ||
| Symptom | Cause / fix | | ||
| --- | --- | | ||
| requester compose stuck on `Workspace app` (or `socialweb-provider`) `phase Initializing initializers [system:apibindings]`, every default APIBinding `Bound`, about 1 launch in 13-20 (2026-11-10) | the kcp workspace scheduling reconciler retried after a conflicting Workspace patch and set the already initialized LogicalCluster back to `Initializing`; admission re-armed `status.initializers` and the APIBinder had no event left to react to. Fixed in the kcp fork (github.com/johnandersen777/kcp branch kcp-ios 120706ba2: only Scheduling -> Initializing; the app pins f233e4f2c); 25 of 25 relaunches compose after it. Same code is in upstream kcp; servers run unpatched upstream kcp | | ||
| a launch "sits after `requester_started`" with no `infra_contract_requested` and no bidder discovery (1 launch in ~8) | the app's launch PATCHes the session EphemeralInfra at the resourceVersion it read, and the infra controller writes the object's status right after the requester starts: `launch failed: kcp HTTP 409 ... the object has been modified` (logged since the fix; before, only errorText). Fixed in the app (atirc-ios-client adab576): read-modify-apply retries on 409 (launch, release, release all); 10 of 10 launches request a contract (2026-11-10, bob) | | ||
| VMs keep running after the app was killed during launch loops (8 bob VMs on hat-9, 2026-11-10) | the app persisted the infra snapshot at launch, before the receipt; a killed app restored a receipt-less contract, requested a new one and orphaned the VM. Fixed in the app (adab576): the snapshot is persisted every 5 s while the requester runs (unchanged state not rewritten); each relaunch then releases the previous VM. Bidders end any VM with no association proof at accept + 24 h (kcp 97b635a6); before that, operator delete (0007) | | ||
| a watch silently misses events after a burst (any controller) | the kcp fork's memory store dropped a watch replay beyond 100 events with the watch still open; fixed in the fork (kcp-ios f233e4f2c, replay buffered whole) | | ||
| ||
Stall diagnosis: the console (`simctl launch --console-pty`) carries the kcpapply wait error with the Workspace | ||
phase, initializers and every False LogicalCluster condition; a stall with no `APIBindingsInitialized=False` | ||
condition and all APIBindings Bound is the re-armed initializer above. | ||
| ||
## Automation hooks (DEBUG) | ||
| ||
| Variable | Effect | | ||
| --- | --- | | ||
| `ATIRC_OPEN_AGENTS=1` | open the Agents sheet at launch | | ||
| `ATIRC_OPEN_CHANNEL=#name` | open a specific channel | | ||
| `ATIRC_MARKET_SIGNIN=1` | trigger requester identity generation bump | | ||
| `ATIRC_MARKET_SIGNIN_EXPORT=1` | write the sign-in URL to a 0600 file for headless tests | | ||
| `ATIRC_TEST_LAUNCH=1` | launch a contract, wait, persist, log policy runs | | ||
| `ATIRC_TEST_AGENT_LAUNCH=1` | launch -> persist -> agentStart -> hold -> release all | | ||
| `ATIRC_RELEASE_ALL=1` | release every held contract | | ||
| `ATIRC_DUMP_WORKSPACE=1` | log workspace/policy state every 5 s | | ||
| `ATIRC_SIGNIN_HANDLE=<handle>` | app-level atproto sign-in helper | | ||
| ||
## Sequence: market sign-in | ||
| ||
```mermaid | ||
sequenceDiagram | ||
participant App | ||
participant Loopback as Loopback listener | ||
participant Safari | ||
participant Requester as Embedded requester | ||
participant PDS | ||
App->>Loopback: start (127.0.0.1 ephemeral port) | ||
App->>Requester: reconfigure identity (generation bump) | ||
Requester->>App: pending OAuth URL | ||
App->>Safari: present authorize URL | ||
Safari->>PDS: PAR + PKCE consent | ||
PDS->>Loopback: redirect ?code&iss&state | ||
Loopback->>Requester: GET /oauth/callback/requester (no direct header) | ||
Requester->>PDS: token exchange + DPoP | ||
Requester->>App: MarketIdentity Ready | ||
App->>App: persist requester snapshot | ||
``` | ||
| ||
## Sequence: launch and release | ||
| ||
```mermaid | ||
sequenceDiagram | ||
participant App | ||
participant KCP as Embedded kcp | ||
participant Requester | ||
participant Gateway as Gateway requester | ||
participant Bidders | ||
participant VM | ||
participant Atirc | ||
App->>KCP: Launch (requester config) | ||
Requester->>Gateway: RFP | ||
Bidders->>Requester: bids | ||
Requester->>VM: accept + provision | ||
VM->>Requester: Held + lease | ||
Requester->>Requester: lease, mesh key, computer.socialweb.peer record | ||
App->>VM: ContractEvent guest.agentStart | ||
VM->>Atirc: agent joins channel | ||
App->>Requester: Release | ||
Requester->>VM: release (over WebRTC) | ||
Requester->>VM: terminate | ||
Requester->>Requester: delete peer record, association, contract records | ||
``` | ||
| ||
## Security constraints | ||
| ||
- The credential source file is read only inside the one signing command; | ||
never print, log, or post its values or any sign-in URL. | ||
- Snapshots (kcp, requester, infra, provider identities) are sealed with a | ||
Keychain key, Data Protection Complete, excluded from backups. | ||
- The agent is token-less: the requester writes a contract-scoped lease (association) and a mesh peer record; | ||
release deletes both, and their expiry makes a missed cleanup harmless. | ||
- Local commits only; never push the app repo. | ||
docs/acceptance/README.md+0−2
| @@ -19,7 +19,6 @@ Each runbook is also a Rust system test, `tests/system/tests/acc_NNNN_*.rs` ([.. | ||
| [0007](0007-bidder-termination.md) | bidder-side VM termination (ops) | operator delete ends an orphan cleanly: released, `vm.terminated` pinned, leased tokens dead, host empty | one bidder | ~1 min | CLI v0.0.0-rc99.0.20261114122108-4d54b2b459d6 4d54b2b4, bidders 4d54b2b4, 2026-11-14 (`0007:run` vs prod, 82 s, bob); CLI (devel) a529874b, bidders a529874b (dev build), 2026-11-14 (`0007:restart` vs staging, 99 s, alice); CLI v0.0.0-rc99.0.20261114031527-2898680b24ce 2898680b, bidders 2898680b, 2026-11-14 (`0007:run` vs prod, 91 s, bob); rollout 19 e190a3b1, 2026-11-12 (hat-8, alice, no bidders list: delete + expiry); e496cbff, 2026-11-11 (hat-8, delete + expiry) | | ||
| [0008](0008-host-observer.md) | host observer verification | per-host watcher protocol: CONFIRMED after rollout, VM timeline, `vm.terminated` pin, orphan check | each bidder | continuous | CLI v0.0.0-rc99.0.20261114122108-4d54b2b459d6 4d54b2b4, bidders 4d54b2b4, 2026-11-14 (`0008:run` vs prod, 89 s, alice); CLI v0.0.0-rc99.0.20261114031527-2898680b24ce 2898680b, bidders 2898680b, 2026-11-14 (`0008:run` vs prod, 92 s, bob); rollout 19 e190a3b1, 2026-11-12 (hat-7, hat-8, hat-9 CONFIRMED; hat-8 timelines + pins; 0/0/0); rollout 5 438ca0fa, 2026-11-10 (hat-7, hat-9) | | ||
| [0009](0009-browser-page.md) | browser requester page | A1-A3, A6, A7: unit, OAuth sign-in, VM lifecycle over the bidder's WebRTC endpoint (no https), compat, `/chat` | browser, bidders | ~5 min / test | CLI v0.0.0-rc99.0.20261114122108-4d54b2b459d6 4d54b2b4, bidders 4d54b2b4, 2026-11-14 (`0009:run` vs prod, 142 s, bob); CLI v0.0.0-rc99.0.20261114031527-2898680b24ce 2898680b, bidders 2898680b, 2026-11-14 (`0009:run` vs prod, 157 s, bob); rollout 20 (rc165-pre1 038bd32e), 2026-11-13 (A1-A3, A6 on hat-7, hat-9, local, A7; alice, no bidders list; hat-9 needed mdns allowed); 2026-11-10 prod page vs hat-9 (438ca0fa), alice | | ||
| [0010](0010-ios-app.md) | iOS app, embedded kcp | A1-A6: market sign-in + persistence, launch / agentStart / join, revoke before terminated, cross-restart release, presence, perf | simulator / device, bidders | ~5 min / test | simulator, 2026-10-31 (not re-run on rc158/rc159) | | ||
| [0011](0011-atirc.md) | atirc | repo + deploy gates, token lifecycle gates for the minting paths (ssh gateway, r2), token-less mesh gates for VM agents, pipes, `/chat`, lease death | irc.fedfork.com, an owner mesh node | ~10 min | CLI v0.0.0-rc99.0.20261114122108-4d54b2b459d6 4d54b2b4, bidders 4d54b2b4, 2026-11-14 (`0011:token` vs prod, 10 s, alice); CLI v0.0.0-rc99.0.20261114122108-4d54b2b459d6 4d54b2b4, bidders 4d54b2b4, 2026-11-14 (`0011:run` vs prod, 1 s, alice); CLI v0.0.0-rc99.0.20261114031527-2898680b24ce 2898680b, bidders 2898680b, 2026-11-14 (`0011:token` vs prod, 10 s, bob); CLI v0.0.0-rc99.0.20261114031527-2898680b24ce 2898680b, bidders 2898680b, 2026-11-14 (`0011:run` vs prod, 2 s, alice); atirc e962ee8 + kcp rollout 20 038bd32e, 2026-11-13 (sections 1-4: repo gates, deploy gates over HTTP, ssh gateway mint/JOIN/answer/revoke 1.26 s before termination, `/chat` signed in + Origin lock, lease death after its 60 s liveness window; not run: prod pipes, revocations.ndjson); 9e83813, 2026-11-11 (sections 1, 2; section 4 FAIL with kcp e496cbff, see 0004); 2026-11-01 (atirc v0.1.0-5a8dfa2); mesh 2026-11-10 (atirc 2898af3) | | ||
| [0012](0012-infra-quickstart.md) | Infra quickstart | kubectl apply of every `examples/infra` file: VM ssh, tenant k8s node + pod, Deno sandbox stdout, agent VM refused before its RFP locally (`.local` handle; join on prod, 0013), release | own market network (+ prod for the agent join) | ~15 min | CLI v0.0.0-rc99.0.20261114122108-4d54b2b459d6 4d54b2b4, bidders 4d54b2b4, 2026-11-14 (`0012:run` vs prod, 86 s, alice); CLI v0.0.0-rc99.0.20261114031527-2898680b24ce 2898680b, bidders 2898680b, 2026-11-14 (`0012:run` vs prod, 100 s, alice); rollout 20 release binary (rc165-pre1 038bd32e, 24a8b530) on own network `a12r`, 2026-11-13 (steps 1-9; tenant node slow: 4 m 40 s behind the guest OIDC issuer); 2026-11-10 eb018e0e; main ec97f78e local, 2026-11-01 | | ||
| [0013](0013-mixed-prod.md) | Mixed prod on a user-configured bidder | `run requester` / `install requester` with a real account, `mixed-prod.yaml` pinned to one bidder under the default policies and both vouches: VM ssh, Deno stdout, agent join, restart keeps Held, delete revokes before `vm.terminated`; the gateway part waits on plan 0039 C | a user-configured bidder, irc.fedfork.com | ~20 min | CLI v0.0.0-rc99.0.20261114031527-2898680b24ce 2898680b, bidders 2898680b, 2026-11-14 (`0013:c` vs prod, 290 s, bob); CLI v0.0.0-rc99.0.20261114031527-2898680b24ce 2898680b, bidders 2898680b, 2026-11-14 (`0013:run` vs prod, 269 s, bob); rollout 20 (rc165-pre1 038bd32e), 2026-11-13, bob, no pin: A, B, C (A6 re-run after a kit-file key fault); rollout 19 e190a3b1 (C), 2026-11-12; rc159 (A, C) and rc160 CLI (B), 2026-11-01 | | ||
| @@ -55,7 +54,6 @@ Each runbook is also a Rust system test, `tests/system/tests/acc_NNNN_*.rs` ([.. | ||
| page build | requester repo `scripts/deploy-page.sh`, then 0009 A1-A3 on prod | | ||
| Infra / EphemeralInfra, examples, quickstart-local / quickstart-prod | 0012 | | ||
| run requester / install requester, agent identity, bidder compute kinds or operator sign-in | 0013 | | ||
| iOS app / pkg/embedded | 0010 | | ||
| bidder capacity, accept refusal, requester fallback | 0014 (staging) | | ||
| VM cgroup limits, QEMU drive options, guest memory | 0015 | | ||
| `run request` owner / release / takeover (request.go), devsup restart after a killed stop | 0017 | | ||
docs/plans/0040-release-pipeline.md+250−71
| @@ -1,39 +1,64 @@ | ||
# 0040 - Release pipeline: main to staging, rc, self-updating bidders, prod, stable | ||
# 0040 - The plan: every acceptance entry green, released by CI to prod and stable | ||
| ||
Status: approved by the owner; steps 1-8 built, 9-12 open (2026-11-17) | ||
Status: the only plan in flight (owner, 2026-11-17); docs/plans/0001-0039 and NEXT.yaml are history. How to run, hold | ||
and debug CI by hand: `docs/ci-debug.md`. The state before this work: main e39097c2 (2026-11-12). | ||
| ||
## Flow | ||
| ||
Every push to main that changes code, in order. No hand roll. | ||
Every push to main that changes code, in order: | ||
| ||
``` | ||
release gate checks, the one build, publish bucket main/<sha>/binaries/{..., SHA256SUMS} | ||
| | ||
test one ephemeral staging network; EVERY tests/gate.sh entry, as staging's own alice and bob | ||
test one ephemeral staging network; every entry below (43), as staging's own alice and bob | ||
| green | ||
promote on the release VM, as socialweb.computer (release-workload): | ||
1. write manifest + version vT-rcN, move channel rc | ||
2. deploy the socialweb.computer droplet (gateway, ssh gateway) to the same binary | ||
3. wait until every rc-operator bidder heartbeats rcN (10 min): the bidders update themselves | ||
4. prod retest: EVERY tests/gate.sh entry against prod, as prod bob and alice | ||
5. green: version vT on the same manifest, move channel stable; the bidders that follow stable update | ||
red: move rc back to the previous version, deploy its binary to the droplet; the bidders follow rc back | ||
2. deploy the socialweb-computer droplet (gateway, ssh gateway) to the same binary | ||
3. wait until every rc-operator bidder heartbeats rcN's sha256 (10 min): the bidders update themselves | ||
4. prod retest: every *both* entry below against prod, as prod bob and alice | ||
5. green: version vT on the same manifest, move channel stable, copy main/<sha>/ to releases/vT/ (no build) | ||
red: at once (no debug hold): move rc back to the version it pointed at before (what this promote rolled | ||
forward from), deploy its binary to the droplet, wait until every bidder heartbeats it; debug from the | ||
run's artifacts | ||
``` | ||
| ||
A failed `test` or `promote` is held for debug and fixed in place (plans 0044, 0048) before the next CI cycle. | ||
A failed, cancelled or timed-out `test` is held for debug (cancelled or timed out: from step 7; before then, a Finding and | ||
a rerun) and fixed in place (`docs/ci-debug.md`) before the next CI cycle. A red, cancelled or timed-out `promote` rolls | ||
back at once (owner, 2026-11-17) and is debugged from its artifacts (`gate-runs`) and fixed before the next cycle; it ends | ||
with `rc` and the droplet on this promote's version (green) or the one it rolled forward from. | ||
Until step 15 lands, `promote.yml` runs only when asked (`asked:`), so main never releases an untested gate. | ||
| ||
## Decisions | ||
| ||
- Bidders follow their channel pointer both ways; a rollback is a channel move. CI never deploys the hats. | ||
- Bidders follow their channel both ways; a rollback is a channel move. | ||
- A hand roll moves prod to a binary that promote did not release; there is none. A host may be reinstalled or repaired by | ||
hand at its channel's current release (e.g. hat-7 as bob). | ||
- The socialweb.computer account (`did:plc:gmlkrhimoueejcertevr4hl3`) owns every `software.release.*` record. | ||
- Binaries stay in the bucket; a manifest points at them by URL, CID (CIDv1 raw sha2-256) and size. | ||
- A bidder is on a release when its own executable's CID equals the artifact's (CI's rcs are main builds, | ||
`v0.0.0-rc99.0.<time>-<sha>`, never named `vT-rcN`). | ||
- Stable is cut only by a green prod retest. Never shrink the retest or the staging suite to get a green. | ||
- A bidder is on a release when its own executable's sha256 (heartbeat `version.sha256`) equals the artifact's (its CID is | ||
CIDv1 raw of that sha256). CI's rcs are main builds (`v0.0.0-rc99.0.<time>-<sha>`). | ||
- Stable is cut only by a green prod retest. | ||
- No SKIP state (owner, 2026-11-17): an entry PASSes or FAILs. A module that skips (a missing target field, a missing input, | ||
a partial reading) FAILs the run. Each entry declares where it runs, *both* or *staging* (it fills or restarts the shared | ||
prod bidders, or needs root on a staging host); the gate selects by the target's declared kind (`network` present: | ||
staging; else prod; anything else fails), never by name, and never skips. The list of record is `tests/entries.txt` | ||
(entry, both|staging; shipped with the gate); the Entries table mirrors it and step 6 checks they match; reclassifying | ||
an entry is the owner's decision. A single-entry rerun on a held network (`docs/ci-debug.md`) is debug, never a result. | ||
- An entry's assertions are its runbook's. Loosening one (a fail path removed, a skip turned into a pass, a wider accepted | ||
outcome) needs the owner; any `tests/modules` diff that removes a fail path gets a cold subagent review first. | ||
- Never shrink a list, a target or an input to get a green. | ||
- Work that would turn main red lands only after a hand cycle on a branch proved it green (`docs/ci-debug.md`). | ||
- Accounts (owner, 2026-11-17): `test` = the staging network's throwaway alice and bob (`tests/compositions/staging/target.sh`). | ||
Prod retest = prod alice (`aliceoa.bsky.social`) and bob (`bobvmbuilder.bsky.social`); in CI their app passwords are knotless | ||
secrets sealed to `refs/heads/main` (`knotless secret set`), never printed, logged, committed or put in an artifact. | ||
- Discovery is always relay, Jetstream or firehose; `bidderDids` only filters it (step 1). | ||
Prod retest = prod alice (`aliceoa.bsky.social`) and bob (`bobvmbuilder.bsky.social`). Each creds file exports | ||
`<P>_ATPROTO_HANDLE` and `<P>_ATPROTO_PASSWORD` (P = ALICE, BOB), the password the account's main one (not app-password | ||
format; alice's also `ALICE_CASCADE_APP_PASSWORD`); both sign-in paths read them (testkit's pdsAccount takes the first | ||
`*ATPROTO_PASSWORD`, `target.rs` `password()`; `oauth-signin.ts --account P` the handle and password). What | ||
CI gets: decision 7. Whatever is sealed goes to `refs/heads/main` only, never printed, logged, committed or put in an | ||
artifact. One driver per account: no | ||
hat-8 gate while a promote runs. | ||
- Discovery is always relay, Jetstream or firehose; `bidderDids` only filters it. | ||
- Proof: a CI result is its knotless workflow log link; a hat-8 gate is its summary (RESULT lines) and gate dir, recorded in | ||
`.plans.yaml`; a docs example is the run of its check. | ||
| ||
## Versions | ||
| ||
| @@ -42,67 +67,221 @@ target T = last stable vX.Y.Z -> vX.Y.(Z+1); no stable -> v0.0.0 | ||
rc = rcs of T exist -> vT-rc(max+1); none -> vT-rc0 | ||
``` | ||
| ||
Records (2026-11-17): versions v0.0.0-rc169 (seeded by hand), rc170, rc172, rc173, rc175 (CI, red), rc171 (the bootstrap, | ||
by hand), rc174 (CI, cancelled before its gate); channel `rc` -> rc174; no stable yet. Next: rc176, target v0.0.0. | ||
Records (socialweb.computer repo): `software.release.project/socialweb-computer`, `software.release.manifest/<rkey>`, | ||
`software.release.version/socialweb-computer:<v>`, `software.release.channel/socialweb-computer:{rc,stable}`. 2026-11-17: | ||
rc169 (seeded) to rc175 written, channel `rc` -> rc174 (whose promote was cancelled before its retest), no stable. | ||
| ||
Record keys, all in the socialweb.computer repo: | ||
## Operators | ||
| ||
``` | ||
software.release.project/socialweb-computer | ||
software.release.manifest/<rkey> per rc (artifacts: url, cid, size, target os/arch) | ||
software.release.version/socialweb-computer:<v> per rc and per stable | ||
software.release.channel/socialweb-computer:rc and :stable | ||
``` | ||
`deploy/release/rc-operators.json`: bob's `did:plc:2l2wdry77c7jtucbslstagkj` (hat-8), `did:plc:4vcig7s43z3nyqrnepmcfzqt` | ||
(hat-9), `did:plc:7fj5jk5jxadrqtc5txp7xitp` (hat-10); john's `did:plc:7q5lnitxv4meizdon5fmhzrq` (hat-7), per | ||
`tests/targets/prod.json` (which lacks hat-10). | ||
| ||
## Operators | ||
## Entries | ||
| ||
`tests/gate.sh` `all=` (43): *staging* entries run on staging only (13); the rest run on both (30). 0010 (iOS) was | ||
removed (owner, 2026-11-17). | ||
| ||
| Entry | Proves | | ||
|---|---| | ||
| 0001:run | tenant cluster on the gateway, kubeconfig + no-expiry revoke, deployment 1 -> 2 -> 1 -> 0, one replica per bidder | | ||
| 0001:s2 | *staging* (root on a staging host): a temporary oauthQr bidder of its own account Ready (iroh + webrtc), removed after | | ||
| 0002:run | `ssh <handle>@gateway` rents a VM as the user; `atirc agent run` transient and held | | ||
| 0003:run | `run request --hold`, ssh over WebRTC fresh and after a restart, no plaintext secrets, released clean | | ||
| 0004:run | agent VM: the owner's mesh node reaches it and it answers; records deleted, DIDs tombstoned | | ||
| 0005:run | outer VM with guest requester R2 Held on a nested VM; the release cascades; R2 tombstoned | | ||
| 0005:b | R2 with a co-located account; the outer VM deleted out of band; both DIDs tombstoned | | ||
| 0005:r2fail | an R2 failed after reporting its DID leaves no live DID | | ||
| 0006:run | every bidder: identity Ready, policy, 0 ERROR and 0 restarts in its first 10 min | | ||
| 0006:compat | the previous rc's CLI (`SWC_COMPAT_REQUESTER` = `sha:<previous rc commit>`) rents and releases against the new servers | | ||
| 0007:run | a VM deleted on its bidder: gone in 2 min, vm.terminated pinned, records deleted | | ||
| 0007:restart | *staging* (restarts a bidder's core): the bidder core restarted in place under a Held VM, its unit unchanged | | ||
| 0008:run | a VM's timeline on its host, release, vm.terminated, records gone, orphan check on every host | | ||
| 0009:run | the browser page rents per bidder over webrtc, a shell over the datachannel, nothing left | | ||
| 0011:run | atirc deploy gates (binary, /chat, unauthenticated revoke 401) | | ||
| 0011:token | a minted atirc token posts; refused after revoke | | ||
| 0012:run | every examples/infra file dry-runs; VM, Deno sandbox, restart while Held; deletes remove every record | | ||
| 0013:run | long-lived requester: vm1 (iroh + webrtc), sbx1, agent1 (association, answer); restart; clean delete | | ||
| 0013:c | `run requester --with-gateway`: a cluster, a k8s workload on a market node, scale to zero | | ||
| 0013:b | *staging* (root on a staging host): `install requester` as root, Ready, DID kept across a restart, purge | | ||
| 0014:run | *staging* (fills bidders): more rentals than room: 409 CapacityExceeded, next bid, new RFP | | ||
| 0014:concurrent | *staging* (fills bidders): fillers plus four concurrent rentals all placed | | ||
| 0014:exhausted | *staging* (fills bidders): all rentals but one Held, never on a refusing bidder | | ||
| 0014:giveup | *staging* (fills bidders): bidders full: waits in rounds, fails at its deadline | | ||
| 0014:wait | *staging* (fills bidders): bidders full: waits; placed once a filler frees a slot | | ||
| 0014:impossible | a request no bidder can take fails fast with the reason | | ||
| 0014:abandon | an accept whose record is gone: bounded retries, abandoned, one line | | ||
| 0014:backtoback | *staging* (fills one bidder): 6 VMs one after another on one bidder, every one Held | | ||
| 0014:overcommit | *staging* (fills bidders): CPU overcommit capacity honoured exactly (default 2x) | | ||
| 0015:run | a VM fills ~95% RAM and fsyncs for 10 s and survives (no OOM, no reboot) | | ||
| 0015:pressure | *staging* (drives a VM's cgroup to pressure): memory-pressure events fire once per crossing and re-arm | | ||
| 0016:run | a VM boots the requester-chosen image (input `image`, `marker`: `deploy/vm-images/ci-toolchain.json`), marker verified | | ||
| 0016:badsha | a wrong image sha256 is refused by every bidder | | ||
| 0016:bigmarker | a large image marker works | | ||
| 0017:run | a separate release while the owner holds an interactive ssh session: Released in 60 s | | ||
| 0017:killed | the owner killed inside the release: it still settles | | ||
| 0017:killedlate | the owner killed while stopping after Released: summary Released | | ||
| 0017:half | a half-ended invocation is not released by mistake | | ||
| 0017:devsup | 12x `dev down` SIGKILLed then `dev up` at once: every kcp ready | | ||
| 0017:samename | two instances of one name in two state dirs are independent | | ||
| 0018:run | *staging* (tampers a binary on the test host): a tampered downloads tree or build record is healed or refused | | ||
| 0019:run | a rental's `bidderDids` filters discovery, never replaces it | | ||
| 0020:run | *staging* (root on a staging host): an installed bidder follows the rc channel to A, then B | | ||
| ||
`deploy/release/rc-operators.json`: bob's bidders `did:plc:2l2wdry77c7jtucbslstagkj` (hat-8), `did:plc:4vcig7s43z3nyqrnepmcfzqt`, | ||
`did:plc:7fj5jk5jxadrqtc5txp7xitp`, and john's `did:plc:7q5lnitxv4meizdon5fmhzrq` (step 12). The others run on hat-7, hat-9 and | ||
hat-10; which DID is which host is unverified. `updateWithin: 10m`. | ||
Last full prod gate: 2026-11-14, main 4d54b2b4 (gate dir `~/.tmp/swc-system-tests/gate/20261114T134403Z`, `results.tsv`): | ||
36 entries, 20 genuine PASS; 11 recorded PASS were skips (0001:s2, 0007:restart, 0013:b, 0014:run, concurrent, | ||
exhausted, giveup, wait, backtoback, 0015:pressure, 0018:run); 0016:badsha's PASS was a 3617 s capacity give-up; SKIP | ||
0010:run and 0017:killedlate (`GATE_SKIP`); FAIL 0002:run, 0013:c. | ||
| ||
## Built | ||
| ||
1. `bidderDids` filters discovery (`internal/market/requester/market.go`). 0019. | ||
2. The heartbeat names the running version (`heartbeat#runningVersion`). | ||
3. Release lexicons and records (`lexicons/software/release/*`, `internal/atproto/release`). | ||
4. Bidder self-update: an AtprotoRecordWatch on the channel (`release-channel-watch@<profile>`), `internal/releasefollow`, | ||
`install.Upgrade`, restart in place; options `release-channel`, `release-repo` in `--bidder-spec-file`. 0020; on prod | ||
every bidder heartbeat followed rc172, back to rc171, and rc174. | ||
5. Every rental's `bidderDids` is its requester's `spec.bidderDids`; a market network sets its children's. 0012, 0013. | ||
6. Release composition `socialweb-computer-release` (requester repo `modules/release-workload`, session `release`: project, | ||
manifest/version create, channel create + update), named by main's `release` binding. | ||
7. `.knotless/workflows/promote.yml` (`after: [test]`, executor `release`, artifacts `gate-runs`). | ||
8. `scripts/deploy.sh`: the binary checked against its sha256 before the move, 3 tries; `bin/previous` kept. | ||
9. Requester port parity (requester repo 481f25e, unpublished): `wait_capacity_s` defaults to 1800 s; a policy that denied | ||
every bid fails at once. | ||
| ||
Every proof above came from runs that counted a skip as a pass: each is proven again by step 10 (staging) and step 11 (prod). | ||
| ||
## Steps | ||
| ||
1. `bidderDids` filters discovery, never replaces it (`internal/market/requester/market.go` `discover`). Proven: 0019. | ||
2. The heartbeat names the running version (`heartbeat#runningVersion` {version, commit, sha256}). Built. | ||
3. Release records and lexicons (`lexicons/software/release/*`, `internal/atproto/release`). Built. | ||
4. Bidder self-update: MarketBidder composes an AtprotoRecordWatch on the channel (`release-channel-watch@<profile>`), | ||
`internal/releasefollow` resolves channel -> version -> manifest (CIDs checked), downloads, `install.Upgrade`, restarts | ||
in place. Channel option `release-channel` (`rc|stable`; default `rc` for a version with `-rc`), repo option | ||
`release-repo`, both in `--bidder-spec-file`. Proven: 0020 in CI; prod: all four bidders followed rc172 -> rc171 and | ||
rc174 (2026-11-17). | ||
5. `bidderDids` through every rental: a requester's `spec.bidderDids` (`GatewaySpec.bidderDids`, `run requester -- --bidder-dids`, | ||
with `--with-gateway` the nodes too); a market network sets its children's. 0012 and 0013 pass the target's bidders | ||
outside a network. Proven: 0012, 0013 on staging. | ||
6. Release composition `socialweb-computer-release` (requester repo `modules/release-workload`, session `release` with the | ||
scopes `repo:software.release.project`, `manifest?action=create`, `version?action=create`, `channel?action=create&action=update`). | ||
Only main's `release` executor binding names it. A step `release <cmd>` runs `scripts/release-artifacts.sh`, writes the rc, | ||
runs `<cmd>` (`scripts/promote.sh`), then stable or the rollback (`scripts/promote.sh rollback`). Built; rollback proven | ||
(rc170, rc172, rc173, rc175). | ||
7. `.knotless/workflows/promote.yml`: `after: [test]`, executor `release`, secrets `PROD_DEPLOY_SSH_KEY`, `ATIRC_AGENT_CONFIG`, | ||
artifacts `gate-runs` (the gate's run dumps). Built. | ||
8. Droplet deploy: `scripts/deploy.sh` ships the binary (sha256 checked before the move, 3 tries) and keeps `bin/previous`. | ||
CI deploys the socialweb-computer droplet only; the relays (`atproto-reverse-proxy`, `mini-cloud-0002`) and the QR | ||
associator are deployed by their own scripts. Built. | ||
9. `test` runs every entry: `scripts/ci-test.sh` `input_default` = the full `tests/gate.sh` list (today 17 of 44), each | ||
failure root-caused and fixed (plan 0052). Open. | ||
10. The prod retest as prod bob and alice: their app passwords as main-sealed secrets, `promote.sh` runs | ||
`tests/gate.sh <prod target> --account bob,alice` with the full list (remove `GATE_R2_ENTRIES`), `AGENTS.md` records the | ||
secret exception. Open. | ||
11. Hold promote for debug: a red gate keeps its failed entries' VMs and the release VM frozen (`GATE_FREEZE_TTL`, attachable) | ||
before the rollback; `scripts/promote.sh --dry-run` (everything but records, deploys and the gate's writes) rehearsed by | ||
hand on a VM with the release image before every promote change. Open. | ||
12. hat-7's bidder operated by bob, as the other three (`rc-operators.json` one operator). Open. | ||
| ||
## Order | ||
| ||
1. Steps 9, 10, 11 (each rehearsed by hand first), then a green CI cycle. | ||
2. Step 12. | ||
Each CI stage change rehearsed by hand first (`docs/ci-debug.md`); release-workload's record logic (steps 12, 15) by its | ||
`modules/release-workload/test.mjs` against a stub session, extended per change; a step's decision is answered before it starts. Phase 2 | ||
work lands on main only once a hand cycle on its branch is green. | ||
| ||
Phase 1, the means to prove: | ||
| ||
0. `promote.yml` to `asked:` only (no push trigger) until step 15; prod stays on rc174 (decision 6); `docs/ci-debug.md`'s | ||
cycle runs on the branch commit and lands only once green. | ||
1. `scripts/promote.sh --dry-run` (prints the droplet deploys, the heartbeat wait and the gate command it would run; runs | ||
none; release-workload writes the records, rehearsed by its `test.mjs`), run by hand on a VM with the release image; `docs/ci-debug.md` gains the promote rehearsal, getting that VM, and the hat-8 gate command. | ||
2. Hand builds go only to `local/<sha>/` (testkit `local:`): `scripts/ci-release.sh` publish and verify (any ref but main | ||
and tags), `scripts/ci-staging-binary.sh` and `docs/ci-debug.md`; `main/<sha>/` is CI's alone, so promote can never | ||
release a hand build. 0020 takes build A from the installed build's own prefix (`main/`, `local/`), no skip path. | ||
3. `AGENTS.md`: the CI table with `promote.yml`; the release pipeline as this Flow (no hand pipeline, no hand rc tags); one | ||
landing rule (remote `swc`, the CI repo); `test` described as it runs; `docs/plans` rules match this plan's proof rule; | ||
comments citing old step numbers (`promote.yml`, `promote.sh`, `acc-0020`); the dead 0010 links (`docs/FEATURES.md`, | ||
`docs/acceptance/0004`, `0008`, `0009`, `tests/testkit/README.md`). | ||
4. One bidder set: hat-7's bidder as bob; `rc-operators.json` and `tests/targets/prod.json` list the same four (prod.json | ||
lacks hat-10: a hat-10 winner fails 0005, 0007, 0008 today). | ||
5. Publish the requester module (built 9: capacity wait, policy denials fail at once); the page (0009) uses it. | ||
| ||
Phase 2, staging all green (one branch, hand cycles, then one landing): | ||
| ||
6. No SKIP: `tests/gate.sh` fails a run whose module skipped: `steps::skip`, the host's `{"skipped"}` (0017:devsup, | ||
samename), and every partial reading: each module reading that says not read, not applied, not seen, unchecked, | ||
unknown, out_of_band or skipped becomes a fail path (grep every instance: today 0001:s2, 0004 x2, 0005, 0008, 0013:run, | ||
0014, 0015:run, 0015:pressure, 0016); and every check over "each bidder" or the gateway that drops a bidder whose kcp | ||
or `cluster` the target lacks fails instead (today 0001:run, 0003 per-host and winner-host, 0006, 0008 `reach` empty, | ||
0014); an unset `SWC_COMPAT_REQUESTER`, a missing composition; `tests/entries.txt` read; `GATE_SKIP` and entry arguments removed; 0016:badsha requires the fast every-bidder refusal; the runbooks and | ||
`AGENTS.md` lose SKIP (0007, 0014, 0015, 0017, 0018, 0019, 0020, README, AGENTS.md "Full suite against prod"). | ||
7. `test` runs every entry through `tests/gate.sh <staging target> --account bob,alice`: the suite tarball carries | ||
`tests/gate.sh`, `tests/entries.txt` and `deploy/vm-images/`; `GATE_HOST` the shipped test host, `SWC_HEAVY_HELD=1`, `GATE_VMS` for two small | ||
bidders, a freeze within `deadlineMin`; 0016's image input; `SWC_COMPAT_REQUESTER` = `sha:<previous rc commit>`; the | ||
gate's summary printed into the step log (the proof), its per-entry logs in the artifact; 43 entries fit `deadlineMin` | ||
and test.yml's step timeout on a push run (one network, every entry: limits are raised, entries never dropped or | ||
split); a | ||
cancel or timeout holds the network as a failure does: the knotless fork keeps attach open through `stop:` and takes | ||
the stop budget from the workflow and adds it to the machine's lifetime, and the `stop` job gets the workflow's env | ||
and granted secrets as a step does (deployed fork `af321883`: `drop(attaching)` before a 20 min `run.stop`, lifetime | ||
= step limits + 20 min checkout + 15 min margin, `composition.rs:434-435`, `lib.rs:3687-3694`; the stop job is bare | ||
`{"steps":[{"name":"stop","run":...}]}`, `composition.rs:970-973`); the runner's `--step-timeout` (7200 s, | ||
`knotless-fork-infra/host/systemd/knotless-fork-runner.service`, which caps every push run's step: `lib.rs` | ||
`limit()`) raised to cover test's and promote's timeouts; deployed by knotless-fork-infra. The change is based on the | ||
fork's branch of record `runner-atlibs-composition` (125cdc9f, `versions.env` `KNOTLESS_BRANCH`), not the deployed | ||
af321883 (on `artifacts-slices` only): its 6 undeployed commits (4cb9bbb3 finish on main and tags only, cancel | ||
reaches deleted refs, recovery; c16554c9) are rehearsed and deployed with it. The `stop:` hook freezes, not | ||
releases; single-entry reruns stay on `swc-test-host` (debug only). | ||
8. Staging layers: the gateway and ssh gateway on the gateway VM, `gateway.kcp` and `gateway.log` in the target, the | ||
network's own atirc (its accounts live on the network's PLC, which prod atirc cannot resolve), the page and headless Chrome (`pageRepo`), staging bidders on a backend with per-VM cgroups (systemd-user; | ||
0015:pressure); for 0001, 0002, 0004, 0009, 0011, 0013:c, 0015:pressure. | ||
9. Staging names, not addresses: in-network PDS and relay traffic on https names (no `hosts` overrides), the target's | ||
`xrpcFront` override gone, the PLC's DNS in its own component. | ||
10. Each staging FAIL root-caused and fixed until a hand cycle is 43 of 43 PASS; then the branch lands and CI `test` is | ||
43 of 43 PASS. | ||
| ||
Phase 3, prod: | ||
| ||
11. Prove by hand both sign-in paths (pdsAccount, `oauth-signin.ts`) from the sealed creds (decision 7). A CI prod target | ||
the release VM can use: decision 7's secrets (main only) written to creds files (0600, r2-owned), reachable bidder | ||
kcps (the sealed kubeconfigs) and `gateway.log` (`PROD_DEPLOY_SSH_KEY` reaches the droplet), headless Chrome, the page repo, | ||
`SWC_COMPAT_REQUESTER`, per-slot iroh keys; `promote.sh` runs `tests/gate.sh <prod target> --account bob,alice` | ||
(`GATE_R2_ENTRIES` removed); gate plus heartbeat wait fit `timeout: 240` on a push run (step 7's runner limit); `AGENTS.md` records the secret exception. | ||
12. Promote rolls back at once on red, cancel or timeout (decision 4) and keeps its artifacts. A cancel or timeout drops | ||
the workload mid-run (its red branch never runs: how rc174 was left): release-workload records on each new rc version | ||
the version `rc` pointed at before, and gains a rollback job (`rc` back to it, no new rc, its own session) that | ||
`promote.yml`'s `stop:` invokes (step 7's fork change gives `stop` its env and secrets); every rollback waits for | ||
every rc-operator bidder's heartbeat. | ||
13. CI's own rentals vs the prod retest: no landing on main while a promote or the hat-8 gate runs; the retest leaves room | ||
for the release VM. | ||
14. The hat-8 gate: `requester` = `sha:<the rc's commit>`, every *both* entry, run on the stable promote just cut; a red | ||
hat-8 gate voids that roll (a Finding, and the next roll counts instead). The command is quoted in `docs/ci-debug.md`. | ||
15. Stable visible to tools: promote gets the bucket key (`SPACES_*`, main only) and vT from release-workload (today it | ||
passes only the rc's `RELEASE_VERSION`), and copies | ||
`main/<sha>/` to `releases/vT/` before it exits 0; testkit's `release` reads the stable channel (not GitHub `v*` tags); | ||
`release.yml` stops building `refs/tags/v*`; then `promote.yml` back on push. | ||
| ||
Phase 4, then the rolls: | ||
| ||
16. atlibs port parity: the Rust compose host shows nested instances' outputs (`on_event` with the instance name, as the JS | ||
host); knotless-run shows the root's. | ||
17. A docs checker: blocks marked to run (`run=gate`, as atlibs) in the docs it lists (atlibs `docs/`, kcp `README.md`, | ||
`docs/quickstart*.md`, `docs/deploy.md`, `docs/bidder.md`) run in CI and pass; prod-acting and debug docs are out of its | ||
list. | ||
18. atlibs docs and examples: minimal wording, copy-pastable examples run by the checker, highlighted code; using, writing | ||
and publishing libs and compositions. | ||
19. kcp docs and examples, the same standard, for every mode: prod, rc and dev builds, foreground and systemd, bidder, | ||
requester, gateway, the release channels and self-update. | ||
20. One pins source: socialweb.computer's `com.fedfork.exec.pins/atlibs` is a copy of johnandersen777's (the runner takes a | ||
binding's pins only from its owner), so a republish moves john's alone; the pin cascade writes both. | ||
21. Two consecutive green CI rolls (Done when 3), the last step. | ||
| ||
## Owner decisions | ||
| ||
All answered 2026-11-17. | ||
| ||
1. No SKIP; 0010 removed; the 13 *staging* entries run on staging only (they fill, restart or install on prod hosts that | ||
also carry promote's own release VM); staging proves them on the same binary. | ||
2. Pushes to every repo we own are approved and expected: commit and push as we go. | ||
3. 0011, 0002, 0004 on staging use the network's own atirc (step 8; prod atirc cannot resolve the network's DIDs). | ||
4. A red, cancelled or timed-out promote rolls back at once, no debug hold; debug from its artifacts. | ||
5. No memory right-sizing step: a VM that runs out of memory is a failure, root-caused in the step it breaks. | ||
6. No baseline: a rollback goes to the version that promote rolled forward from (none is clean yet). prod stays on rc174. | ||
7. Sealed to `refs/heads/main`: alice's and bob's handle and main password, and the prod target's other access: the | ||
bidder kcp kubeconfigs (hat-7, 8, 9, 10) and the bucket key `SPACES_*` (step 15); `PROD_DEPLOY_SSH_KEY` and | ||
`ATIRC_AGENT_CONFIG` are already sealed. | ||
| ||
## Done when | ||
| ||
1. staging: every `tests/gate.sh` entry passes in CI `test` (owner-approved SKIPs only: 0010 iOS paused). "N of M". | ||
2. prod: the full gate passes in CI `promote` (prod bob, alice) and by hand on hat-8. "N of M" each. | ||
3. Two green CI rolls of prod through the flow: stable moved each time, every rc-operator bidder updated itself, no hand | ||
roll. The second is a small CLI help-text change. | ||
Steps 0-20 done, then step 21; on the commit of step 21's second roll: | ||
| ||
1. staging: CI `test` 43 of 43 PASS, 0 FAIL on a push run: the step log's gate summary. | ||
2. prod: CI `promote` (a push run) 30 of 30 *both* entries PASS as prod bob and alice (its log), and the hat-8 gate 30 of 30 on the | ||
stable it cut (its summary and dir). | ||
3. Two consecutive green CI promote runs on distinct main commits: each moves stable, every `rc-operators.json` DID | ||
heartbeats its sha256, no hand roll; between the two promoted commits, the only change under the workflows' `paths:` | ||
is CLI help text (docs and `.plans.yaml` may change). | ||
| ||
## Findings (open) | ||
| ||
Each: what was seen (with the log), the cause, the fix, its proof. | ||
| ||
Each with the knotless workflow log that shows it. | ||
- 0002:run and 0013:c FAIL on prod (2026-11-14 gate): not root-caused. | ||
- 0016:badsha passed on a capacity give-up (3617 s) on 2026-11-14: the module accepts any Failed contract (step 6). | ||
- 0017:killedlate was skipped with `GATE_SKIP` ("bootstrap fix pending, rc167 follow-up") on 2026-11-14: not root-caused. | ||
- The guest's dumbpipe listener (`iroh.service`) exits 0 on its own (`Endpoint dropped without calling Endpoint::close`); the | ||
staging install retries around it; the cause is in the pinned upstream dumbpipe. | ||
- A bidder's release follower logs `releasefollow_failed ... context canceled` on its own unit's restart (fix staged: | ||
`releasefollow_restarting`, INFO). | ||
- `superseded: finish` applies on every ref in the deployed runner (af321883 `lib.rs` 2492, 2629), so an asked branch | ||
`test` waits behind a running or frozen one (up to 300 min); `test.yml`'s comment and `AGENTS.md` say a branch push | ||
cancels (true only from 4cb9bbb3, step 7). Until then: cancel the older branch run by hand. | ||
- `scripts/ci-hand-market.sh` uses sudo on the bidder hosts (sudo on the hats is allowed by the owner). | ||
docs/plans/0041-cpu-oversubscription.mddeleted+0−84
| @@ -1,84 +0,0 @@ | ||
# 0041 - CPU oversubscription: 2:1 by default; memory stays committed | ||
| ||
Status: approved by the owner 2026-11-15 ("2:1 yes build it set as default"). Memory is planned here and not changed by | ||
this work. | ||
| ||
## Why | ||
| ||
A push to main asks for about 48 vCPU at its peak. The market has 36: hat-7 has 12 cores, hat-8 16 and hat-9 8. Most of | ||
those vCPUs idle at any moment, for example staging VMs waiting on each other, a build waiting on the network, or a VM | ||
booting. KVM shares cores, so a saturated host runs slower, not wrong. | ||
| ||
## Change | ||
| ||
The bidder's capacity check counts committed vCPUs against cores x ratio. One VM is still at most the host's cores. | ||
| ||
``` | ||
today: running + reserved + asked <= cores (internal/market/bidder/vmsize.go capacityRefused) | ||
after: running + reserved + asked <= cores * cpuOvercommit | ||
asked <= cores (staticRefused, unchanged) | ||
``` | ||
| ||
`cpuOvercommit` is a bidder setting, default 2: | ||
| ||
```sh | ||
socialweb-computer install bidder … --cpu-overcommit 2 # config.json "cpu-overcommit": 2 | ||
``` | ||
| ||
| Host | Cores | Sellable vCPU at 2:1 | | ||
|---|---|---| | ||
| hat-7 | 12 | 24 | | ||
| hat-8 | 16 | 32 | | ||
| hat-9 | 8 | 16 | | ||
| market | 36 | 72 | | ||
| ||
The offering's `maxCpus` stays the cores, the largest single VM. The refusal message names both numbers: | ||
`… hold 30 of its 32 (16 cores x 2)`. | ||
| ||
Test: a composition in `gate.sh` and CI, on a dev net with a 2-core bidder. Two 2-vCPU VMs are accepted at once, and a | ||
third is declined `capacity`. A 3-vCPU VM is declined `unservable`. With `--cpu-overcommit 1` the second VM is declined. | ||
| ||
Built as: | ||
| ||
- The setting is `spec.cpuOvercommit` of the MarketBidder (and of the Bidder component and a MarketNetwork bidder app), set by | ||
`run bidder --cpu-overcommit`, `install bidder --cpu-overcommit` (config.json `cpu-overcommit`, kept by `upgrade`) and | ||
`dev up --cpu-overcommit` (every network bidder). 0 or unset is the default 2. | ||
- The test is composition 0014 entry `overcommit` (`tests/compositions/0014`, in `gate.sh`). No dev net reports 2 cores, so | ||
it sizes from the bidder's offering the way the other 0014 entries do: pinned fillers (each at most the bidder's cores) leave | ||
room for exactly `overcommit` 2-vCPU guests, then `overcommit` + 1 are rented at once. At 2 two are Held and the third is | ||
refused 409 CapacityExceeded; against a net up with `--cpu-overcommit 1`, `--input '{"overcommit":1}'`, the second is refused. | ||
The `unservable` leg is entry `impossible` (maxCpus + 1, which is under cores x 2, so only the static check refuses it). | ||
- Every 0014 entry now sizes a bidder's room as `maxCpus` x the input `overcommit` (default 2) less its live guests. | ||
| ||
## Memory: not oversubscribed | ||
| ||
Memory accounting does not change: | ||
| ||
- **Commit:** a guest commits its memory plus VMM overhead (`contracthost.VMCommitMiB`). Committed memory stays at or | ||
under host memory, and a new VM must fit the host's available memory minus pending reservations. | ||
- **cgroup:** each VM gets `MemoryMax = MemoryHigh = 2 x guest`, `MemorySwapMax = guest` (`contracthost.VMLimits`). The | ||
owner's rule is that the host can always page to swap. Every bidder host needs real disk swap. | ||
| ||
With 2:1 CPU, memory is the tighter limit. The load of one CI run and the market's capacity are in plan 0042, | ||
"Per push": its peak is 30 vCPU and 52 G, against 80 vCPU and 122 G. | ||
| ||
Measured on 2026-11-13: the knotless gate on a 12 vCPU / 16 G VM peaked at 1.6 G of used RAM. That build is CPU bound | ||
and its memory is oversized. | ||
| ||
Per-role staging VM memory (atproto, bidder-1, bidder-2, gateway) is not measured here: the owner's decision (2026-11-15) is that | ||
the staging module's own poll records it in normal staging runs, from their ticks. Numbers: from the staging poll, pending. The | ||
module's defaults stay as they are until then. | ||
| ||
Right-sizing memory is the owner's decision, not part of this change. Options: | ||
| ||
1. Measure each workflow's real peak, using the method in the build-sizing notes: cgroup `memory.peak` less page cache. | ||
Then set each binding's `mem` to the peak plus margin. | ||
2. Lower the staging module's default VM memory (8 G) to what a staging VM uses. | ||
3. Both. | ||
| ||
## Order | ||
| ||
1. `--cpu-overcommit`, default 2, and its composition test, landed through the queue. | ||
2. It rides the next rc. After it rolls, the prod gate shows the capacity waits shrink. (2026-11-15: the default is 2, so | ||
the roll is the next prod rollout of main, after the staging suite passes by hand; it is not a separate step.) | ||
3. Memory right-sizing, once the owner picks an option. | ||
docs/plans/0042-ci-two-workflows.mddeleted+0−104
| @@ -1,104 +0,0 @@ | ||
# 0042 - CI: two workflows, one build, one staging network | ||
| ||
Status: plan. The decisions are the owner's (2026-11-15). | ||
| ||
## Shape | ||
| ||
``` | ||
push to main or a v* tag (a branch: only when asked) | ||
│ | ||
├── release executor kcp-build | ||
│ ├── toolchain | ||
│ ├── checks go vet, the clean-tree check (no release build) | ||
│ ├── build THE build: socialweb-computer for every platform, | ||
│ │ swc-test-host, the wasm test modules, socialweb-meshd | ||
│ │ (skipped per tree when already published) | ||
│ ├── guest image | ||
│ └── publish main/tags only: bucket staging/<sha>/ → main/<sha>/, main/latest/ (tag: releases/<tag>/), | ||
│ then a check from the public URLs | ||
│ | ||
└── test after: [release] executor kcp-test | ||
├── binary main: the bucket's main/<sha>/ · branch: release's build, ttl.sh by digest | ||
└── staging ONE staging network (atproto, gateway, 2 bidders); every acceptance entry, one at a time: | ||
0003 0005 0006 0007 0008 0012 0013 0007:restart 0014:* 0015:pressure 0016:* | ||
``` | ||
| ||
## Rules | ||
| ||
- **One build per push.** Only `release` compiles. `test` consumes what it built. | ||
- **No reproducible-build verification**, in any form: no second clean build and no check-reproducible. | ||
- **One staging network per push.** | ||
- **CI runs on main and v* tags only.** A branch runs `release` or `test` only when asked (`knotless run rerun … --workflow …`). The merge queue runs no CI (owner, 2026-11-15). | ||
- **Push triggers (back 2026-11-16):** `release` on pushes to main and v* tags, `test` on pushes to main that change code; both also `asked:` on any branch. CI's repository is socialweb.computer/socialweb-computer-kcp (plan 0051). | ||
- **`superseded: finish`** on main and v* tags for both workflows. A newer asked run on a branch cancels the older one. | ||
| ||
## Every step is a script, run by hand first | ||
| ||
Owner, 2026-11-15: no logic inline in a workflow. Each step's body is a function of one script per workflow; the YAML step | ||
only calls it. The same script runs by hand from hat-8, so the hand run is what CI runs. | ||
| ||
| Workflow | Script | Steps | | ||
|---|---|---| | ||
| `release` | `scripts/ci-release.sh <step>` | toolchain, checks, binaries, staging-binary, test-host, guest-image, asset-cache, build-cache, stage, publish, verify | | ||
| `test` | `scripts/ci-test.sh <step>` | host, binary, staging (no step: all three in order) | | ||
| ||
By hand, only these differ, and only through the environment: | ||
| ||
| | CI | by hand (hat-8) | | ||
|---|---|---| | ||
| requester account | `r2`, the CI VM's guest requester (root runs it with `runuser`) | `CI_ACCOUNT=alice` (bob for a bidder sign-in) | | ||
| work dirs | `/home/r2`, `/work/runs`, `/usr/local/bin`, `/root/...` | `CI_HOME` (default `~/.tmp/ci-hand`) | | ||
| ref | `KNOTLESS_RUN_REF`, `KNOTLESS_RUN_SHA` | unset: `git rev-parse HEAD`; publish writes `main/<sha>/` only, never `main/latest/` | | ||
| artifacts between workflows | `KNOTLESS_ARTIFACTS_URL` | none: the bucket (published by hand) | | ||
| ||
Rules: | ||
| ||
- Building and publishing to the bucket by hand is allowed until a clean staging run by hand. | ||
- A step goes back into CI only after its script passed by hand. | ||
- No pushes to main until every step passed by hand and CI is expected to pass. | ||
| ||
## Removed | ||
| ||
| Workflow | Where it went | | ||
|---|---| | ||
| `gate.yml` | the `checks` step of `release`; its builds are gone | | ||
| `testhost.yml` | the `build` step of `release` | | ||
| `publish.yml` | the `publish` step of `release` | | ||
| `compositions.yml` | its entries run in `test`, on the same staging network | | ||
| `vmm.yml` | dropped: staging's nested-virt bidders boot QEMU guests on every entry that rents a VM. Firecracker, if it needs coverage, becomes a staging entry. | | ||
| `release`'s `reproducible` step | dropped | | ||
| `release`'s `dev build` step | dropped, unless it is the same build | | ||
| ||
## Per push: the market load of one CI run | ||
| ||
This section is the source of truth for CI load. Plans 0040 and 0041 point here. | ||
| ||
| Phase | Running | vCPU | Memory | How long | | ||
|---|---|---|---|---| | ||
| 1 | `release` (kcp-build) | 12 | 16 G | ~20 min | | ||
| 2 | `test` VM (kcp-test 4/8) + one staging network (atproto 4/8, gateway 4/8, 2 bidders 4/8 each) | 20 | 40 G | the suite (measure; step cap 300 min) | | ||
| peak | the next commit's `release` beside this commit's `test` | 32 | 56 G | | | ||
| ||
Market capacity (all bidders are bob): | ||
| ||
| Host | Cores | Sellable at 2:1 (plan 0041) | RAM | | ||
|---|---|---|---| | ||
| hat-7 | 12 | 24 | 31 G | | ||
| hat-8 | 16 | 32 | 46 G | | ||
| hat-9 | 8 | 16 | 30 G | | ||
| hat-10 | 4 | 8 | 15 G | | ||
| market | 40 | 80 | 122 G | | ||
| ||
The peak is 32 of 80 vCPU (40%) and 56 of 122 G (46%), room for about two pushes in flight beside prod. Until 2:1 rolls to | ||
the bidders, sellable vCPU equals cores (40). Memory right-sizing (plan 0041) uses the staging poll's readings. | ||
| ||
## Order | ||
| ||
1. Fix the staging `bidders` in `target.sh` and the staging module (the target listed `bidders: []` in the multi layout). | ||
1b. The network's accounts vouch the joined bidders (plan 0044 finding 11; `target.sh`, as `applyRequesterVouches` does for | ||
a network's own bidders), and a joined bidder's kcp front binds its overlay address (finding 12). | ||
2. Move every step into `scripts/ci-test.sh` and `scripts/ci-release.sh`. | ||
3. By hand from hat-8: `ci-release.sh` for this commit (publish to `main/<sha>/`), then `CI_ACCOUNT=alice | ||
scripts/ci-test.sh` until every entry passes. | ||
4. Land 1 and 2 in one push to main, the commit proven by hand. The main `test` is the CI proof. | ||
4. Plan 0040's release steps follow `test` on main. | ||
docs/plans/0043-rc168-prod-gate-findings.mddeleted+0−65
| @@ -1,65 +0,0 @@ | ||
# 0043 - rc168 prod gate: two findings | ||
| ||
Status: approved by the owner 2026-11-15. Found by the rc168 prod gate (2026-11-15, gate dir | ||
`~/.tmp/swc-system-tests/gate/rc168-20261115T033216Z` on hat-8). | ||
| ||
## 1. A retried write conflict counts as a startup error (0006:run, 0008:run) | ||
| ||
hat-7's bidder logged, about 4 min after its in-place roll: | ||
| ||
``` | ||
Reconciler error: Operation cannot be fulfilled on hostprocesses.socialweb.computer "vm-fc-ocnuqjlzgohy-0f239076": | ||
the object has been modified; please apply your changes to the latest version | ||
``` | ||
| ||
That is an optimistic-concurrency conflict, which the controller retries. The 0006 check (`tests/modules/acc-0006/src/lib.rs:80`) | ||
fails on any ERROR line in a bidder's first 10 min after a start. 0008 reads the same result ("hat-7 not CONFIRMED"). | ||
| ||
Steps: | ||
| ||
1. The controllers log a conflict they retry at Info, not Error: one place, the reconcile error handler. Built | ||
2026-11-15: `internal/controllers/runtime` (the adapter's `failed` logs it at Info; `Reconcile` requeues it rate-limited | ||
with no error, so controller-runtime logs no `Reconciler error`). | ||
2. The check is unchanged: any other ERROR line in the first 10 min still fails it. | ||
3. Prove: 0006 and 0008 on prod after an in-place roll. | ||
| ||
## 2. The browser page requester gives up on a refused accept (0009:run) | ||
| ||
The page's `submitAccept` to hat-7 failed `CapacityExceeded … hold 16 of its 16`. The round had no winner and no receipt, | ||
and the page stopped. The kcp and atlibs requesters handle this: they take the next bid, then send a new RFP that leaves | ||
out the bidders that refused, then wait for capacity on a round with no bids. | ||
| ||
Steps: | ||
| ||
1. Port parity: the page requester takes the next bid on a refused accept, then sends a new RFP, then does a | ||
capacity-wait round. It works like the atlibs requester module, which it is built from (if it is not, use its code). | ||
2. 0009 keeps pinning each round to one bidder. A full pinned bidder then waits for capacity instead of failing. | ||
3. Prove: 0009 on prod while a bidder is full. | ||
| ||
## 3. Informer-sync timeouts at a bidder's start count as startup errors (staging 0006, 0008) | ||
| ||
Proposed (plan 0044 finding 24): a nested staging bidder's kcp start logs `get informer failed: Timeout: failed | ||
waiting for *v1alpha1.Pds Informer to sync` and `unexpected error handling add event` at ERROR, then recovers. Like finding 1, | ||
a retried transient start condition, logged at Info. The 0006 check stays: any other ERROR in the first 10 min fails it. | ||
| ||
Read (2026-11-15, cycle 12): the cause is a watch started before kcp serves its resource (an APIBinding not ready at a | ||
start). Two paths log it: | ||
- our awaits and caches (`kube.Resource.ListWatch`, `kcpapply.watchFor`): client-go's reflector logs `Failed to watch ... | ||
could not find the requested resource` (klog `E`, not counted by 0006) each retry. Built: `kube.ListServed` waits quietly | ||
while a list is NotFound (the resource not served), so the reflector sees no error. | ||
- controller-runtime's sources under the multicluster APIExport provider: `get informer failed: Timeout: failed waiting | ||
for *v1alpha1.Pds Informer to sync` (logr at ERROR, counted). Read on cycle 13's bidders (plan 0044 finding 31): every | ||
one at the millisecond the dev-core stopped its first controller manager. A joined bidder's core started without its | ||
network value (`run bidder --market-network-file` applies the root after the core is up) and restarted its whole | ||
component controller 2 s later; the stop cancels informer syncs, which multicluster-runtime reports as `Timeout`. Prod | ||
bidders have no network value and never restart. Built: the value rides the instance record (`Record.Network`), the | ||
core starts with it. The same restart leaked the guests' loopback forwards (finding 30, built). No log level is lowered. | ||
- also at a joined bidder's start: `the MarketIdentity .../operator signs for "", not did:...` (a record asked for the | ||
operator identity's session before it signed in; plan 0044 finding 32). Built: an identity with no DID yet is | ||
`ErrNotFound`, the record waits. | ||
- Prove: 0006 and 0008 on staging (cycle 14), and on prod after the next roll. | ||
| ||
## Order | ||
| ||
1. Finding 1, then finding 2, each through the merge queue. | ||
2. Neither blocks the rc168 tag. Both are logged in the gate's readings. The tag waits on the rest of the gate. | ||
docs/plans/0044-ci-by-hand.mddeleted+0−416
416 lines changed: not loaded until asked for.
docs/plans/0045-network-handle-resolution.mddeleted+0−94
| @@ -1,94 +0,0 @@ | ||
# 0045 - Handles resolve inside a market network (staging, dev nets) | ||
| ||
Status: plan (owner, 2026-11-15: "fix the DNS issue or whatever is wrong with the staging networks directory and etc. handle | ||
resolution"). Found by the hand run of plan 0044 (run 2, 0005). | ||
| ||
## Why | ||
| ||
On staging, 0005's requester refused its agent contract before Held: | ||
| ||
``` | ||
refused: the atirc agent needs a requester handle that resolves to did:plc:qs4t...: alice-55841783.bob.test does not | ||
resolve to it: handle not found: DNS NXDOMAIN for HTTP well-known resolution of alice-55841783.bob.test | ||
``` | ||
| ||
No handle of a market network resolves: | ||
| ||
1. The requester's directory (`internal/services/requester/wiring.go` `directoryFor`) takes the network's PLC URL only; | ||
handles go to public DNS and public HTTPS. | ||
2. The network PDS's `/.well-known/atproto-did` (`internal/atproto/pds/wellknown.go`) answers its own service DID for every | ||
Host, never an account's DID. | ||
3. The network's hosts (`status.network.hosts`) name each PDS by its service name only; nothing routes | ||
`<account>.bob.test` or `<account>.alice.test`. | ||
| ||
## Steps | ||
| ||
The atproto way (an account's handle host answers `/.well-known/atproto-did`, as bsky.social's PDSes do), inside the network: | ||
| ||
1. The PDS answers `/.well-known/atproto-did` with the DID of its account whose handle is the request's Host; any other Host | ||
gets the service DID, as today. | ||
2. A network PDS serves TLS for `*.<its handle domain>` too (`PdsSpec.Hostnames`: `pds.default.bob.svc.kcp.local`, | ||
`*.bob.test`; alice the same with `alice.test`). | ||
3. The network's hosts add `alice.test` and `bob.test` at their PDS addresses (`networkValueFromLeases`, `boundValue`); the | ||
host map matches by suffix, so `<account>.bob.test` dials the bob PDS. | ||
4. A requester in a network resolves a handle whose host is in the network's host map over | ||
`http://<handle>/.well-known/atproto-did` with the network's egress client (the network's services speak plain HTTP inside it, | ||
as its PLC does), then checks the DID document's handle (`internal/services/requester/networkdirectory.go`). Any other | ||
handle resolves as before. (Run 4 of plan 0044: the PDS port answered HTTP to the HTTPS well-known fetch.) | ||
5. Prove: plan 0044's hand run, 0005 on staging. | ||
| ||
## Next: HTTPS, one code path (owner, 2026-11-15) | ||
| ||
Step 4 as built (HTTP inside the network) is a staging-only code path. The owner: the network's certs come from its OpenBao, | ||
only in staging and dev nets, never prod; staging runs prod's code. So handle resolution stays HTTPS everywhere, and only | ||
config differs: | ||
| ||
Read on 2026-11-15: inside a market network every service speaks plain HTTP (`target.sh`: `bidderPds=http://...`, | ||
`plc=http://...`); TLS is only on the front (`relay.localhost`, `*.relay.localhost`, its leaf from the network CA in | ||
`internal/app/marketnetwork/guesttls.go`) and the guest paths. So one code path means the network's services serve TLS, | ||
not only the handle hosts: | ||
| ||
Steps 6 to 9 are plan 0050 (2026-11-15), which builds them as the owner designed them. | ||
| ||
6. The staging requester's OpenBao (the one the test drives, which rents the staging VMs: alice's host requester by hand, | ||
R2 on CI) mints a root CA for the run (a `pki` mount, staging only) and a leaf for each network service name: the PLC, | ||
relay, dispatcher TLS front (`relay.localhost`, `*.relay.localhost`), PDSes (`pds.default.<x>.svc.kcp.local`, `<x>.test`, | ||
`*.<x>.test`). | ||
7. The staging module puts the root into every staging VM's user_data (`ca_certs: trusted`, the system store), with each | ||
VM's leaves and `/etc/hosts` lines for the service names at their fixed overlay addresses (10.44.0.x). The network takes | ||
the root as its `caBundle`, so a nested guest (rented from a staging bidder) gets it in its system store through | ||
`guestseed.WithNetwork`, and its services serve TLS from those leaves (`spec.TLS`; the dispatcher's self-made guest CA | ||
goes). The network's URLs become `https://<name>`. | ||
8. One code path: every client trusts the system store, as on prod (the Rust clients take `reqwest`'s | ||
`rustls-tls-native-roots`, not its bundled roots); handle resolution is the prod HTTPS well-known code; | ||
`networkdirectory.go` (the HTTP path) is removed; no CA bundle is threaded through a client. | ||
Handles (plan 0044 finding 40: R2 in a guest could not resolve `alice-<n>.alice-<n>.bob.test`): arbitrary subdomains | ||
of the account domains cannot go in `/etc/hosts`, and `.localhost` is not an atproto handle TLD. They resolve the | ||
prod way, by DNS TXT (`_atproto.<handle>`, which handle resolution tries first): the network answers DNS for its | ||
account domains (`*.alice.test`, `*.bob.test`) from its PDSes' accounts on 10.44.0.1:53, and every staging VM's | ||
resolver, and every network guest's, sends `~alice.test ~bob.test` there (systemd-resolved per-domain DNS; a guest | ||
reaches it through a host port its network bidder forwards, as the guest TLS front). No HTTPS well-known for handles. | ||
Owner, 2026-11-15: "if whatever you just did doesn't work i suggest we start running dns". Built as: | ||
a. The network's PLC component also answers DNS (`PlcSpec.dns`: a serve address, leased like the PLC's port, and the | ||
zones: each account domain with its PDS). For `_atproto.<name>` TXT under a zone it asks that PDS | ||
(`com.atproto.identity.resolveHandle`) and answers `did=<did>`; for a zone's names, A to the network's bind address. | ||
UDP and TCP, `golang.org/x/net/dns/dnsmessage` (already in the module graph). The network value names it | ||
(`MarketNetworkValue.dns`, `host:port`). | ||
b. Every staging VM: after `dev up`, the staging module writes `/etc/systemd/resolved.conf.d/socialweb-network.conf` | ||
(`DNS=<dns host:port>`, `Domains=~alice.test ~bob.test`) and restarts systemd-resolved. | ||
c. A network guest: its network bidder forwards a host port to the DNS address (TCP, as the guest TLS port) and | ||
`guestseed` writes the same drop-in naming `<gateway>:<port>` with `DNSOverTLS=no` and TCP (`resolved` falls back | ||
to TCP when UDP gets no answer; the drop-in sets the server so). | ||
d. `networkdirectory.go` (the HTTP handle path) is removed: handles resolve by the prod code (DNS TXT first). | ||
Prove: 0005 on staging (R2's handle `alice-<n>.alice-<n>.bob.test` resolves in its guest). | ||
9. Prove: the staging suite; prod unchanged (no staging root anywhere on prod: public certs, public handles). | ||
| ||
Until then step 4 (HTTP inside the network) keeps staging moving. Order: after the staging suite passes by hand, before | ||
the push triggers come back. | ||
| ||
Prod is unchanged: public handles, public DNS and HTTPS. | ||
| ||
## Order | ||
| ||
1. Steps 1 to 4 in one change. | ||
2. Step 5; then the other directories of a network participant (bidder, gateway) if an entry shows the same refusal. | ||
docs/plans/0046-associated-host-requester.mddeleted+0−54
| @@ -1,54 +0,0 @@ | ||
# 0046 - A host requester associated to its owner: no owner sign-in per run | ||
| ||
Status: steps 1 to 4 built (2026-11-15); a hand runner sets it up from plan 0044 "Setup" (its DID in its own env file). Owner, 2026-11-15: the hand runs use alice "via requester associate mode ... so we don't run into rate | ||
limits"). Plan 0044 step 5a. | ||
| ||
## Why | ||
| ||
Every test-host requester signs alice in with her app password (`pdsAccount`): one `createSession` per run. In CI, R2 needs | ||
none: it is a guest requester associated by the runner. By hand there is no CI VM, and a host requester cannot be | ||
associated today: | ||
| ||
- `run request` / `run requester --identity <name>` makes a `localRepo` identity, but a new one is `Skip` unless | ||
`--association-ref` names a record, and that record's rkey is the DID the identity does not have yet | ||
(`cmd/socialweb-computer/request.go` `openIdentity`). | ||
- The wait form (`--association-ref` with an empty ref file) is the guest's only: it reads the guest's association request. | ||
- No CLI option sets `approvedAssociations`; only the gateway composes it (`SOCIALWEB_GATEWAY_APPROVED_ASSOCIATIONS`), | ||
with its `agent-of` link on its own PDS. | ||
| ||
## Steps | ||
| ||
1. `run requester --identity <name> -- --associate-with <owner DID>`: a new `localRepo` identity, association | ||
`RequireApproval`, `approvedAssociations: [<owner DID>]`, kept in `identity.json`; its PDS adds | ||
`https://ident.link/agent-of/<owner DID>` to the DID's `alsoKnownAs`, as the gateway requester's does. It prints the DID. | ||
2. Once, the owner writes the standing association (`scripts/associate-bidder.ts --creds <owner creds> --account <PREFIX> | ||
--agent-did <DID>`): `market.association/<DID>` and `link.ident.endorsement/<DID>`. Her one sign-in. | ||
3. Every later start: `--identity <name>` with nothing new after `--`; the identity controller walks the DID to the owner | ||
(`Associated`), no password. | ||
4. The test host: a target account `identity {name, stateDir}` starts its requesters with `--state-dir <stateDir> | ||
--identity <name>`; one requester at a time per identity (its PDS lock). | ||
5. Prove: plan 0044's staging hand run as alice that way, `pds_session_created` count 0. | ||
7. An associated identity's handle is declared under its owner's verified handle (plan 0044 finding 64): the atirc agent | ||
needs a requester handle that resolves to it, or that it declares under the verified handle of a principal it is | ||
associated with (`identlink.HandleOK`). A `localRepo` identity with an approved principal and no `--atproto-handle` | ||
takes `<identity name>.<principal's verified handle>` (e.g. `alice.aliceoa.bsky.social`): `spec.identity.handle`, the | ||
PDS account's handle and `at://<handle>` in its `alsoKnownAs`; an existing one whose declared handle is another | ||
(`root.requester.local`) has it replaced through the local PDS (`UpdateAlsoKnownAs`, its rotation key), as `agent-of` | ||
is. R2 already takes `<label>-<rfp rkey>.<renter handle>` (its association request entry's `handle`). Prove: plan 0044's prod gate 0005 through alice's host requester, and staging 0005. | ||
6. Units of a `run requester` are keyed by its state dir and name, not the name alone (plan 0044 finding 7). | ||
Read (2026-11-15): the key is `install.RequesterKey(name)` = `req-` + `HandleID(name)` (`internal/stack/request/core.go`, | ||
`internal/install/bootstrap.go` for installed requesters), the units `table.Names` of it. Keying it by state dir and name | ||
renames every existing requester's units: an upgrade must stop the old-named units of that state dir first (the | ||
invocation's `requester.json` names its kcp), with no dual naming. Not before the push triggers: one `stg` requester per | ||
host until then. | ||
As built: two parts, both keyed by the instance's state dir. (a) A dev instance's runtime dir (its devsup socket) is | ||
`<runtime root>/<RuntimeKey(state dir)>` (`devinstance.NewLayout`), and its devsup's process tag (`SWC_INSTANCE`, what | ||
`dev down` kills by) is `ProcessTag` = ID plus that key: before, two instances of one name shared the devsup socket | ||
(the second adopted the first's units) and a `dev down` of one killed the other's processes. Unit names (`Short`) stay | ||
by ID. (b) An installed requester's key and layout ID hash `RequesterInstanceDir(state, name)`. No code migration (no | ||
backcompat): a running dev instance is stopped before the binary that moves its socket runs it (hat-8's hand | ||
requesters). Testcase: composition 0017 entry `samename` (fails on a529874b, passes on a44c4af8). | ||
| ||
## Order | ||
| ||
1. Steps 1 to 4, then 5. CI keeps R2. | ||
docs/plans/0047-staging-no-open-policy.mddeleted+0−31
| @@ -1,31 +0,0 @@ | ||
# 0047 - Staging runs prod's market policies: no `open`, the vouches prod has | ||
| ||
Status: plan (owner, 2026-11-15: "we should NEVER be running with `open` policy"). Found by plan 0044 (findings 11, 12). | ||
| ||
## Why | ||
| ||
The multi-layout staging ran its joined bidders with `--bidder-policy open` and its stand-up probes with `-- --policy open`, | ||
because a market network writes its vouches only between its own apps (`internal/app/marketnetwork/vouches.go`) and the | ||
joined bidders are not apps. So every entry with the default policies got no bid (`PolicyRejected`), and staging never ran | ||
the trust path prod runs. | ||
| ||
Prod's trust: the bidders' operator vouches the requester (`bidder-tangled-vouch`), and the requester vouches the bidders | ||
(`requester-tangled-vouch`, the policy an RFP carries). | ||
| ||
## Steps | ||
| ||
1. Network Ready: `trust.sh accounts` makes the throwaway accounts (alice, bob) before the bidders join. | ||
2. The joined bidders run the default policy and vouch the accounts themselves: `run bidder --bidder-vouch <did,...>` (MarketBidder | ||
option `vouch`; the bidder's composer writes one `sh.tangled.graph.vouch` AtprotoRecord per DID into its own repo, under its | ||
own repo link, `compose.ApplyVouches`). A joined bidder is `localRepo` with no operator, so it is its own voucher. | ||
3. Once they joined: `trust.sh vouch`, each account vouches every bidder and its operator (`applyRequesterVouches`' record). | ||
4. The stand-up probes run as alice and bob (`probe.sh`) with the default policies, then the suite. | ||
5. Prove: the staging suite by hand (plan 0044); no policy `open` in what staging runs. | ||
| ||
Read on the held network (2026-11-15): writing the bidder's vouch from the atproto VM is not possible (its kcp is on the | ||
bidder VM's loopback, plan 0048); a hand AtprotoRecord in the bidder's kcp was `LinkDenied` until it carried the root's labels | ||
(the bidder's own repo link takes `apps.socialweb.computer/root: marketbidder.app`). Done by hand there, then step 2 in code. | ||
| ||
## Order | ||
| ||
1. Steps 1 to 5 in one change; 6 by hand. Before the push triggers come back (plan 0042). | ||