feat(contract): /v1/calendars joins the tool contract, one allowlist for both doors

The calendar table gets the same contract treatment as every other
data domain: a named route constant, three allowlist rows (GET, POST,
DELETE /v1/calendars/{name}), mock-router arms that enforce the
door's loudest rules — a named calendar, an ics with a URL — and
conformance cases (add, the invalid refused, listed, removed) that
run against the mock and the real daemon alike, so the two cannot
drift. The claw's auth middleware reads the same list, which is how
the rows land there with no claw-side code.

The spec names the doors and the pattern they establish: domains the
daemon reconfigures at runtime live in tables behind their routes,
validation runs at the door, and claw.yaml carries only what boot
needs.
This commit is contained in:
vhaudiquet committed 2026-10-24 01:58:09 +02:00
1 parent 818079d1f4
commit aa9a68ab6d
5 files changed
+94 -17

No files matched your search

+47
View File
@@ -96,6 +96,53 @@ where
)
.await?;
// — Calendars: add, the invalid refused, listed, removed —
ctx.expect(
"the agent lists calendars",
req("GET", "/v1/calendars", Auth::Agent, Some(1), None),
200,
)
.await?;
ctx.expect_success(
"the agent adds a calendar",
req(
"POST",
"/v1/calendars",
Auth::Agent,
Some(1),
Some(serde_json::json!({
"name": "team", "kind": "ics", "url": "https://c.example.net/a.ics"
})),
),
)
.await?;
ctx.expect(
"an urlless ics is refused loudly",
req(
"POST",
"/v1/calendars",
Auth::Agent,
Some(1),
Some(serde_json::json!({"name": "broken", "kind": "ics"})),
),
400,
)
.await?;
let listed = ctx
.expect_success(
"the added calendar is listed",
req("GET", "/v1/calendars", Auth::Agent, Some(1), None),
)
.await?;
if !listed.body.to_string().contains("team") {
return Err("the added calendar is listed: the name is missing".into());
}
ctx.expect_success(
"the agent removes the calendar",
req("DELETE", "/v1/calendars/team", Auth::Agent, Some(1), None),
)
.await?;
// — Notifications: push with and without a device —
let pushed = ctx
.expect_success(