docs: the workspace-scoped guest_activity delete moves an instance-wide count; assert the mint records the guest

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BayTppRCstWX6qTf3LMco5
This commit is contained in:
Ruben Fiszel
2026-09-04 15:50:41 +02:00
co-authored by Claude Fable 5.1
parent 943789533d
commit 6081e286c9
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -94,6 +94,17 @@ async fn the_allowance_caps_strangers_and_meters_an_enterprise_plan(
mint(&db, "g1@example.com")
.await
.expect("a guest already in the window is let back in");
let recorded: bool = sqlx::query_scalar(
"SELECT EXISTS(SELECT 1 FROM guest_activity
WHERE email = 'g1@example.com' AND workspace_id = 'test-workspace'
AND day = CURRENT_DATE AND last_seen_at > now() - interval '1 minute')",
)
.fetch_one(&db)
.await?;
assert!(
recorded,
"the mint writes the guest_activity row the allowance is counted on"
);
let list: serde_json::Value = authed(
client().get(format!(
@@ -1119,6 +1119,8 @@ pub(crate) async fn delete_workspace(
.execute(&mut *tx)
.await?;
// Unlike the rest of this list, this also moves an instance-wide figure: the guest
// allowance and the seats past it are counted over every workspace's rows.
sqlx::query("DELETE FROM guest_activity WHERE workspace_id = $1")
.bind(&w_id)
.execute(&mut *tx)