~ knotless Search/
↑↓ move↵ open⇧↵ all results

socialweb.computer/socialweb-computer-kcp

socialweb.computer: a compute market on atproto (kcp)

1 collaborator
0
0

tests: none_since lists {uri, createdAt} through the host (0002:run on prod)

Merged johnandersen777.bsky.social asked to merge into main from socialweb.computer/socialweb-computer-kcp:phase-2
docs/plans/0040-findings.md+33−0
@@ -1431,3 +1431,36 @@ Each: what was seen (with the log), the cause, the fix, its proof.
- The `release` binding rewritten 17:42Z (lead, as socialweb.computer, putRecord with swapRecord): `inputs.association`
removed; before: cid bafyreih2dx77ww... saved at ~/.tmp/release-binding/before.json; after: cid bafyreic7gfekuj...,
inputs {cpus, image, mem}. With it `promote.sh prepare` creates the user r2 itself.
- 0002:run FAIL on prod, by-hand gate 2026-11-18 (main 7a0406d9, alice): `RESULT 0002:run FAIL 1418 since: WASM_TOO_LARGE:
input exceeds 1048576 bytes` (`~/.tmp/prod-hand/gate-1/0002-run.log`, run dir
`~/.tmp/swc-system-tests/runs/0002-composition-1795024381962`). The 1418 s are the entry's own 816 s (17:53:01Z to the
failure at 18:06:37Z: sessions, then the gateway log's session ends, 15 s polls 18:01:32Z to 18:06:35Z) plus the 600 s
freeze; the scan itself ran 1.4 s. Not a slow listing.
CAUSE: the module `assert` (`none_since`, `tests/modules/assert/src/lib.rs`) took every `com.atproto.repo.listRecords`
page (limit 100) of each market and compute collection of the DID as its own event input, full record values included.
alice's `com.publicdomainrelay.temp.compute.vm` records carry their cloud-init `user_data` (median 10.7 KB, max 26 KB per
record; 1151 records since 2026-10-31): its first page is 1126274 bytes, its largest 2321050 (12 pages, 10.5 MB). The
page `l-9` (compute.vm) was the one input past the module cap; the run's ticks stop with `l-9` pending. The result the
module handed 0002 was small; the input inside the assert run was not. bob's repo is under the cap today (largest page
172 KB, compute.vm 5 records) and would fail the same way once his account rents with large user_data; 0006:run calls
the same assert. The 2026-11-14 prod FAIL of 0002:run (gate `~/.tmp/swc-system-tests/gate/20261114T134403Z`, bob) was
another cause: the transient command got `no bids received within 30s` 2 min in, before this step.
FIX: the host lists, the module asserts. `computer.socialweb.test.repo.listCreated` (`tests/host/src/swc.rs`
`list_created`): one listRecords page of the repo's PDS (`Net::pds`), each record reduced to {uri, createdAt}, plus the
cursor. `none_since` calls it instead of listRecords; the scan is the same (every page of every market and compute
collection, createdAt at or after `since` is `left`, none is `undated`, any failure an error, the same retries).
No early stop at `since`: listRecords orders by rkey (newest TID first, verified on alice's repo), but config.wif.simple,
bids.free, accept, offering and the guest events have non-TID rkeys (alice: 147, 147, 92, 30, ...), which sort anywhere.
PROOF (prod, read-only, `swc-test-host compositions/0002 --account alice --instance assert --entry none_since`, no
sign-in, no account lock, `since` 10 min back): before (the gate's host, 7a0406d9) `WASM_TOO_LARGE` after 1.4 s, 23
steps, inputs up to 283 KB logged and the compute.vm page past 1 MiB; after (rc-0002) pass in 10.9 s, 50 steps (48
pages), largest module input 16325 bytes, all events 552933 bytes, result `left: [] errors: []` and the 49 undated
October records (`~/.tmp/rc-0002/{before,after}.log`; runs `0002-composition-1795026240384`, `-1795026333219`).
Unproven: 0002:run whole on prod with this tree (alice's gate slot was busy); the 50-page cap per collection of
`none_since` stops a collection past 5000 records without an error (alice's largest: 1151).
- By-hand prod gate from hat-8 (gate dir ~/.tmp/prod-hand/gate-1, prod on rc180 = main 7a0406d9, target
tests/targets/prod.json with the seven bidders, as bob and alice, kube over ssh): at 18:35Z 13 PASS (0001:run,
0003:run, 0004:run, 0005:run, 0005:b, 0005:r2fail, 0006:run, 0006:compat, 0007:run, 0008:run, 0009:run, 0011:run,
0012:run), 1 FAIL (0002:run: the finding above), 16 to run. It reads the hosts over ssh: the ops routes over iroh
are exercised only by CI's promote. Left open by the 0002 fix: `none_since` stops a collection after 50 pages
(5000 records) without an error (alice's largest: 1151): to plan 0041.
tests/host/src/swc.rs+40−0
@@ -87,6 +87,7 @@ pub const NSIDS: &[&str] = &[
"computer.socialweb.test.bidder.restart",
"computer.socialweb.test.assets.tamper",
"computer.socialweb.test.gateway.log",
"computer.socialweb.test.repo.listCreated",
"com.fedfork.exec.identlink.walk",
"com.fedfork.exec.identlink.plc",
];
@@ -1194,6 +1195,44 @@ impl Swc {
)
}
/// One com.atproto.repo.listRecords page of the repo's PDS, each record as {uri, createdAt} and the cursor: a scan for
/// records created since a time (assert none_since) needs no more, and full values (a compute.vm's user_data) make a
/// page of 100 pass the module input cap.
async fn list_created(&self, input: &Value) -> Result<Value, String> {
let repo = input["repo"].as_str().ok_or("repo is required")?;
let collection = input["collection"].as_str().ok_or("collection is required")?;
let at = testkit::Atproto::new(&self.target);
let pds = at.net.pds(repo).await?;
let mut q = vec![
("repo", repo.to_string()),
("collection", collection.to_string()),
("limit", input["limit"].as_u64().unwrap_or(100).to_string()),
];
if let Some(c) = input["cursor"].as_str() {
q.push(("cursor", c.to_string()));
}
let r = at
.http
.get(format!("{}/xrpc/com.atproto.repo.listRecords", pds.trim_end_matches('/')))
.query(&q)
.send()
.await
.map_err(|e| e.to_string())?;
let status = r.status();
let body = r.text().await.map_err(|e| e.to_string())?;
if !status.is_success() {
return Err(format!("listRecords {repo} {collection}: {status}: {}", tail(&body)));
}
let o: Value = serde_json::from_str(&body).map_err(|e| format!("listRecords {repo} {collection}: {e}"))?;
let records: Vec<Value> = o["records"]
.as_array()
.into_iter()
.flatten()
.map(|r| json!({ "uri": r["uri"], "createdAt": r["value"]["createdAt"] }))
.collect();
Ok(json!({ "records": records, "cursor": o["cursor"] }))
}
async fn handle(&self, nsid: &str, input: Value) -> Result<Value, String> {
let what = nsid.strip_prefix(P).unwrap_or(nsid);
match what {
@@ -1270,6 +1309,7 @@ impl Swc {
}
Ok(json!({ "uris": uris }))
}
"repo.listCreated" => self.list_created(&input).await,
"account.envFile" => {
use std::io::Write;
use std::os::unix::fs::OpenOptionsExt;
tests/modules/assert/src/lib.rs+10−4
@@ -271,10 +271,16 @@ fn agent_chain_handler(run: Run<Value>) -> Result<Handle, String> {
const MARKET: [&str; 2] = ["com.publicdomainrelay.temp.market.", "com.publicdomainrelay.temp.compute."];
/// A listRecords page's records created at or after `since` into `left`, those with no createdAt into `undated`.
/// A listRecords page of the host, each record as {uri, createdAt} only: a record's value can be tens of KB (a compute.vm
/// carries its user_data), so 100 of them pass the module input cap (1 MiB).
fn list(id: String, did: &str, col: &str, cursor: Option<&str>) -> Call {
steps::host(&id, "repo.listCreated", json!({ "repo": did, "collection": col, "limit": 100, "cursor": cursor }))
}
/// A page's records created at or after `since` into `left`, those with no createdAt into `undated`.
fn tally(st: &mut Value, page: &Value, since: f64) {
for r in page["records"].as_array().into_iter().flatten() {
match r["value"]["createdAt"].as_str() {
match r["createdAt"].as_str() {
Some(t) if steps::secs(t) >= since => st["left"].as_array_mut().unwrap().push(r["uri"].clone()),
Some(_) => {}
None => st["undated"].as_array_mut().unwrap().push(r["uri"].clone()),
@@ -306,7 +312,7 @@ fn none_since_handler(run: Run<Value>) -> Result<Handle, String> {
}
let mut h = Handle::new();
for (i, col) in cols.iter().enumerate() {
h = h.call(Call::new(format!("l-{i}"), "com.atproto.repo.listRecords").params(json!({ "repo": did, "collection": col, "limit": 100 })).service(did.clone()));
h = h.call(list(format!("l-{i}"), &did, col, None));
}
st["pending"] = json!(cols.len());
h.state(st)
@@ -318,7 +324,7 @@ fn none_since_handler(run: Run<Value>) -> Result<Handle, String> {
let (i, page) = id.trim_start_matches("l-").split_once('-').map_or((id.trim_start_matches("l-").to_string(), 0), |(a, b)| (a.to_string(), b.parse().unwrap_or(0)));
if let Some(cursor) = o["cursor"].as_str().filter(|_| o["records"].as_array().is_some_and(|r| r.len() == 100) && page < 50) {
let col = o["records"][0]["uri"].as_str().unwrap_or_default().split('/').nth(3).unwrap_or_default().to_string();
let call = Call::new(format!("l-{i}-{}", page + 1), "com.atproto.repo.listRecords").params(json!({ "repo": did, "collection": col, "limit": 100, "cursor": cursor })).service(did.clone());
let call = list(format!("l-{i}-{}", page + 1), &did, &col, Some(cursor));
tally(&mut st, o, since);
return Ok(Handle::new().call(call).state(st));
}
tests/modules/assert/module.json+2−2
@@ -5,9 +5,9 @@
{ "entry": "records_gone", "label": "Records gone", "description": "Reads each record 3 times: left, errors.", "readOnly": true },
{ "entry": "tombstoned", "label": "Tombstoned", "description": "PLC log/last plc_tombstone and no document: alive.", "readOnly": true },
{ "entry": "agent_chain", "label": "Agent chain", "description": "The renter -> R2 -> agent pair + grant chain and walk.", "readOnly": true },
{ "entry": "none_since", "label": "None since", "description": "No market or compute record of the DID created since a time: left, undated, errors.", "readOnly": true }
{ "entry": "none_since", "label": "None since", "description": "No market or compute record of the DID created since a time (every page, {uri, createdAt} each, from the host): left, undated, errors.", "readOnly": true }
],
"calls": ["com.atproto.repo.getRecord", "com.atproto.repo.describeRepo", "com.atproto.repo.listRecords", "com.fedfork.exec.identlink.plc", "com.fedfork.exec.identlink.walk"],
"calls": ["com.atproto.repo.getRecord", "com.atproto.repo.describeRepo", "computer.socialweb.test.repo.listCreated", "com.fedfork.exec.identlink.plc", "com.fedfork.exec.identlink.walk"],
"implements": [
{ "nsid": "computer.socialweb.test.assert.recordsGone", "entry": "records_gone" },
{ "nsid": "computer.socialweb.test.assert.tombstoned", "entry": "tombstoned" },
tests/testkit/README.md+1−1
@@ -162,7 +162,7 @@ SWC_TARGET=$PWD/targets/prod.json cargo run -p swc-test-host -- compositions/000
| `computer.socialweb.test.{requester,request,account,atirc}.*` | `tests/host` (`swc-test-host`) | the requester under test as the account: `run requester` (its kcp becomes cluster `requester:<name>`), `run request` (its log events a subscription), the owner's mesh node; released and stopped after the run |
| `computer.socialweb.test.bidder.health`, `computer.socialweb.test.gateway.log` | `tests/host` | a bidder host's health without sudo (its `run bidder` journal: ERROR lines since start and in the first 10 min, automatic restarts, VM processes), over the bidder's ssh alias or here; the ssh gateway log lines of a DID (target `gateway.log`). A bidder with `ops {url}` (https) or `ops {iroh}` (its iroh market endpoint ticket, fetched over atlibs-iroh's raw `dumbpipe connect`) and no `kcp` in the target (and `gateway.ops`; the secret in the target's `opsSecretFile`) is read through its read-only routes `com.fedfork.exec.ops.*` instead (`tests/host/src/ops.rs`): these calls, `bidder.logCount` / `bidder.logLines`, `vm.memory` without setHigh, and kube `get` / `list` of ComputeVM, FirecrackerVM, MarketIdentity, Bidder and MarketBidder on `bidder:<name>`; every other kube verb there is refused, and the module sees `write: false` on that bidder |
| `com.fedfork.exec.identlink.{walk,plc}` | `tests/host` (to move into atlibs-host) | identlink's verified walk, PLC log/last and documents of the target's PLC |
| `assert` | `tests/modules/assert` | records gone (x3), tombstones, an agent VM's chain, no market or compute record created since a time (`none_since`, every listRecords page); each asks again every 10 s for up to `within` s (180) |
| `assert` | `tests/modules/assert` | records gone (x3), tombstones, an agent VM's chain, no market or compute record created since a time (`none_since`, every listRecords page, each record as {uri, createdAt} from the host's `computer.socialweb.test.repo.listCreated`: full values pass the 1 MiB module input); each asks again every 10 s for up to `within` s (180) |
| `acc-0004` | `tests/modules/acc-0004`, `tests/compositions/0004` | the runbook as a state machine |
### Freeze, inspect, replay