Add member directory and aggregates, cut citation economics from spec (Draft 0.4)

This commit is contained in:
George Coles
2026-09-15 03:56:11 -04:00
parent 82a95fb907
commit fb45cfa8cf
13 changed files with 890 additions and 79 deletions
+65 -3
View File
@@ -57,6 +57,70 @@ fn no_bounty_winner_selection_or_slashing() {
}
}
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn no_in_protocol_citation_accounting_or_settlement() {
let relay_url = spawn_relay().await;
let http = client();
let key = Keypair::generate();
for msg_type in ["receipt", "settlement", "citation", "invoice"] {
let envelope = Envelope::new(&key, msg_type, serde_json::json!({}));
assert_eq!(
publish(&http, &relay_url, &envelope).await.status(),
reqwest::StatusCode::BAD_REQUEST,
"relay accepted {msg_type} on the broadcast channel"
);
assert_eq!(
unicast(&http, &relay_url, &key.public_hex(), &envelope)
.await
.status(),
reqwest::StatusCode::BAD_REQUEST,
"relay accepted unicast {msg_type}"
);
}
let response = serde_json::to_value(build_response("q1", Vec::new(), 0, 5)).unwrap();
assert_absent_fields(
&response,
&[
"receipt",
"settlement",
"citation",
"cited",
"price",
"payment",
"paid",
],
);
let aggregate = serde_json::to_value(AggregateBody {
period: "2026-03".to_string(),
sent: 0,
passed: 0,
})
.unwrap();
assert_absent_fields(
&aggregate,
&[
"receipt",
"settlement",
"citation",
"cited",
"price",
"payment",
"paid",
],
);
for route in ["/v1/receipt", "/v1/settlement", "/v1/invoice"] {
let response = http
.get(format!("{relay_url}{route}"))
.send()
.await
.unwrap();
assert_eq!(response.status(), reqwest::StatusCode::NOT_FOUND);
}
}
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn no_protocol_query_dedup() {
let relay_url = spawn_relay().await;
@@ -190,7 +254,6 @@ async fn no_aggregate_appeals() {
period: "2026-03".to_string(),
sent: 1,
passed: 1,
cited: 0,
})
.unwrap(),
);
@@ -205,10 +268,9 @@ async fn no_aggregate_appeals() {
period: "2026-03".to_string(),
sent: 1,
passed: 1,
cited: 0,
})
.unwrap();
assert_exact_keys(&body, &["period", "sent", "passed", "cited"]);
assert_exact_keys(&body, &["period", "sent", "passed"]);
assert_absent_fields(&body, &["appeal", "dispute", "complaint", "sanction"]);
for route in ["/v1/appeal", "/v1/dispute"] {