forge
Explore
Log in

Don't you dare go Hollow

Name the requester and fill a school-wide refresh roster

Browse files at this commit

0f55f34e76c3c3b49a541b55237afb7dbca1719aAhmet Kaan GümüşParent: 0eb20f9
  • feat
    • name the requester and fill a school-wide refresh roster
Show full message
✨ feat(insight): name the requester and fill a school-wide refresh roster

Every `insight.*` dispatch now carries `requested_by` — the caller the door
authenticated, which the service passes as `on_behalf_of` so its per-student
reads (`/marks/{user}` and the rest) answer as that teacher or manager instead
of the synthetic `ai` principal those reads refuse with a 403.

`insight.refresh` also always fills `user_ids`: a caller-named list passes
through exactly as given, while an empty body is filled from the school's own
student roster (every user holding the `student` role), because the service's
own roster discovery reads homework `assigned` lists, which a live school
rarely fills — so an empty body used to sweep nobody. The payload's new
`roster_source` records which roster the list was, and the refresh log names it
so the run ledger's counts are explainable. A school with no students dispatches
an empty list and answers 0 honestly; a roster past
`MAX_INSIGHT_REFRESH_STUDENTS` is refused rather than clipped.
Local-Gate: 644eaaee78ddae2e35af223da2719c3a55697a86 (1488 passed, 466s)
src/ai/insight.rsmodified+47 -7
@@ -55,6 +55,13 @@ pub use crate::constant::{
55 pub struct StudentRequest {55 pub struct StudentRequest {
56 /// The student's user id.56 /// The student's user id.
57 pub user_id: String,57 pub user_id: String,
58+ /// Who asked for this compute: the caller the door authenticated, and the
59+ /// principal every bridge read for this dispatch runs as. The service
60+ /// passes it as `on_behalf_of`, because the synthetic `ai` principal a
61+ /// read with nobody named would run as is refused `403` on a per-student
62+ /// report (`/marks/{user}` and the rest) — the report answers a teacher or
63+ /// a manager, never the service itself.
64+ pub requested_by: String,
58 /// ISO-8601 date to compute from; omitted, the service starts at the65 /// ISO-8601 date to compute from; omitted, the service starts at the
59 /// term's beginning.66 /// term's beginning.
60 #[serde(default, skip_serializing_if = "Option::is_none")]67 #[serde(default, skip_serializing_if = "Option::is_none")]
@@ -95,6 +102,8 @@ pub struct StudentResponse {
95 pub struct ClassRequest {102 pub struct ClassRequest {
96 /// The course or class the analysis is about.103 /// The course or class the analysis is about.
97 pub course_id: String,104 pub course_id: String,
105+ /// Who asked for this compute — see [`StudentRequest::requested_by`].
106+ pub requested_by: String,
98 /// The term to read; omitted, the service uses the current one.107 /// The term to read; omitted, the service uses the current one.
99 #[serde(default, skip_serializing_if = "Option::is_none")]108 #[serde(default, skip_serializing_if = "Option::is_none")]
100 pub term: Option<String>,109 pub term: Option<String>,
@@ -121,16 +130,35 @@ pub struct ClassResponse {
121 pub coverage: Option<Value>,130 pub coverage: Option<Value>,
122 }131 }
123 132
133+/// `roster_source` when the caller named the students themselves: the list is
134+/// passed through exactly as given.
135+pub const ROSTER_SOURCE_EXPLICIT: &str = "explicit";
136+
137+/// `roster_source` when the door filled `user_ids` from the school's own
138+/// student roster (an empty request body).
139+pub const ROSTER_SOURCE_SCHOOL: &str = "school";
140+
124 /// What the backend asks a service to recompute for a whole school.141 /// What the backend asks a service to recompute for a whole school.
125 ///142 ///
126-/// A batch job: with `user_ids` omitted the service works through its own143+/// A batch job, and the door always fills `user_ids`: a caller-named list
127-/// configured student list — the backend does not enumerate one, because a144+/// passes through exactly as given ([`ROSTER_SOURCE_EXPLICIT`]), while an
128-/// school-wide roster is not something the bridge's read scope hands a145+/// empty one is filled from the school's own student roster
129-/// service (same doc, item 3).146+/// ([`ROSTER_SOURCE_SCHOOL`]) — the backend enumerates one now because the
147+/// service's own roster discovery reads homework `assigned` lists, which a
148+/// live school rarely fills, so an empty body used to sweep nobody.
149+/// `roster_source` records which of the two the list was, so the run's counts
150+/// read honestly: a `school` sweep that computed few students is a bounded
151+/// run, not a caller who named few.
130 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]152 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
131 pub struct RefreshRequest {153 pub struct RefreshRequest {
154+ /// Who asked for this sweep — see [`StudentRequest::requested_by`].
155+ pub requested_by: String,
156+ /// The students to recompute, in the order the door resolved them.
132 #[serde(default, skip_serializing_if = "Option::is_none")]157 #[serde(default, skip_serializing_if = "Option::is_none")]
133 pub user_ids: Option<Vec<String>>,158 pub user_ids: Option<Vec<String>>,
159+ /// Which roster [`Self::user_ids`] came from: [`ROSTER_SOURCE_EXPLICIT`]
160+ /// or [`ROSTER_SOURCE_SCHOOL`].
161+ pub roster_source: String,
134 /// Recompute even where a cached result is still valid.162 /// Recompute even where a cached result is still valid.
135 #[serde(default, skip_serializing_if = "Option::is_none")]163 #[serde(default, skip_serializing_if = "Option::is_none")]
136 pub force: Option<bool>,164 pub force: Option<bool>,
@@ -425,22 +453,34 @@ mod tests {
425 fn the_request_names_are_the_contracts() {453 fn the_request_names_are_the_contracts() {
426 let request = StudentRequest {454 let request = StudentRequest {
427 user_id: "user-1".into(),455 user_id: "user-1".into(),
456+ requested_by: "user-9".into(),
428 since: Some("2026-09-01".into()),457 since: Some("2026-09-01".into()),
429 sections: None,458 sections: None,
430 };459 };
431 assert_eq!(460 assert_eq!(
432 serde_json::to_value(&request).unwrap(),461 serde_json::to_value(&request).unwrap(),
433- serde_json::json!({ "user_id": "user-1", "since": "2026-09-01" }),462+ serde_json::json!({
434- "an omitted section list stays off the wire, not null"463+ "user_id": "user-1",
464+ "requested_by": "user-9",
465+ "since": "2026-09-01",
466+ }),
467+ "a requested_by always rides the wire; an omitted section list stays off it, not null"
435 );468 );
436 469
437 let refresh = RefreshRequest {470 let refresh = RefreshRequest {
471+ requested_by: "user-9".into(),
438 user_ids: Some(vec!["user-1".into()]),472 user_ids: Some(vec!["user-1".into()]),
473+ roster_source: ROSTER_SOURCE_EXPLICIT.into(),
439 force: Some(true),474 force: Some(true),
440 };475 };
441 assert_eq!(476 assert_eq!(
442 serde_json::to_value(&refresh).unwrap(),477 serde_json::to_value(&refresh).unwrap(),
443- serde_json::json!({ "user_ids": ["user-1"], "force": true })478+ serde_json::json!({
479+ "requested_by": "user-9",
480+ "user_ids": ["user-1"],
481+ "roster_source": "explicit",
482+ "force": true,
483+ })
444 );484 );
445 }485 }
446 486
src/constant.rsmodified+9 -0
@@ -710,6 +710,15 @@ pub const MAX_INSIGHT_PENDING_STUDENTS: usize = 20_000;
710 /// mistake.710 /// mistake.
711 pub const MAX_INSIGHT_PURGE_STUDENTS: usize = 20_000;711 pub const MAX_INSIGHT_PURGE_STUDENTS: usize = 20_000;
712 712
713+/// The most students one `insight.refresh` may carry when its door fills an
714+/// empty request body from the school's own roster. The service works through
715+/// the list in its own batches (`ZEKA_REFRESH_BATCH`, 25 at a time) and
716+/// records the rest as pending for its next run, so the ceiling is the frame's,
717+/// not one run's — [`MAX_INSIGHT_PENDING_STUDENTS`]'s size class. Over it the
718+/// door **refuses** rather than clipping: a clipped roster would leave students
719+/// unanalysed while the run's ledger read as complete.
720+pub const MAX_INSIGHT_REFRESH_STUDENTS: usize = 20_000;
721+
713 /// How long a `rag.chat` turn may sit `pending` before a reader projects it as722 /// How long a `rag.chat` turn may sit `pending` before a reader projects it as
714 /// failed. The RAG nest mirrors the chatbot's asynchronous send723 /// failed. The RAG nest mirrors the chatbot's asynchronous send
715 /// ([`CHATBOT_PENDING_STALE_SECS`]): the round trip outlives the request that724 /// ([`CHATBOT_PENDING_STALE_SECS`]): the round trip outlives the request that
src/web/insights.rsmodified+61 -10
@@ -54,11 +54,14 @@ use utoipa_axum::router::OpenApiRouter;
54 use utoipa_axum::routes;54 use utoipa_axum::routes;
55 55
56 use crate::ai::insight::{56 use crate::ai::insight::{
57- self, PendingList, ProfileWriteRequest, PurgeRequest, RecommendationWriteRequest,57+ self, PendingList, ProfileWriteRequest, PurgeRequest, ROSTER_SOURCE_EXPLICIT,
58- RefreshRequest, RunWriteRequest, SchoolDirectory, SegmentWriteRequest, StudentRequest,58+ ROSTER_SOURCE_SCHOOL, RecommendationWriteRequest, RefreshRequest, RunWriteRequest,
59- SummaryWriteRequest, TableVerdicts, WriteReceipt,59+ SchoolDirectory, SegmentWriteRequest, StudentRequest, SummaryWriteRequest, TableVerdicts,
60+ WriteReceipt,
61+};
62+use crate::constant::{
63+ AI_INSIGHT_REFRESH_CAPABILITY, AI_INSIGHT_STUDENT_CAPABILITY, MAX_INSIGHT_REFRESH_STUDENTS,
60 };64 };
61-use crate::constant::{AI_INSIGHT_REFRESH_CAPABILITY, AI_INSIGHT_STUDENT_CAPABILITY};
62 use crate::database::Database;65 use crate::database::Database;
63 use crate::db;66 use crate::db;
64 use crate::domain::class_group::ClassGroupId;67 use crate::domain::class_group::ClassGroupId;
@@ -133,8 +136,9 @@ struct ComputeStudentRequest {
133 136
134 #[derive(Deserialize, ToSchema, Default)]137 #[derive(Deserialize, ToSchema, Default)]
135 struct RefreshInsightsRequest {138 struct RefreshInsightsRequest {
136- /// Student user ids to recompute; omit for the service's own configured139+ /// Student user ids to recompute; omit (or send an empty list) to sweep
137- /// list — the backend does not enumerate a school roster for it.140+ /// the school's own student roster — every user holding the `student`
141+ /// role. A named list is used exactly as given.
138 user_ids: Option<Vec<String>>,142 user_ids: Option<Vec<String>>,
139 /// Recompute even where the service considers its cached result valid.143 /// Recompute even where the service considers its cached result valid.
140 force: Option<bool>,144 force: Option<bool>,
@@ -149,6 +153,10 @@ struct RefreshInsightsRequest {
149 /// Authorization is [`student_insight`]'s, gate for gate: the caller must be153 /// Authorization is [`student_insight`]'s, gate for gate: the caller must be
150 /// able to read the student before they may ask for a recompute, and the154 /// able to read the student before they may ask for a recompute, and the
151 /// refusal is a `404` (a foreign id and a missing one look the same).155 /// refusal is a `404` (a foreign id and a missing one look the same).
156+///
157+/// The dispatch names the **caller** as `requested_by`, not the student: the
158+/// service reads the student's marks and the rest as that caller, so a
159+/// teacher's or manager's own reach is what the reads answer against.
152 #[utoipa::path(160 #[utoipa::path(
153 post,161 post,
154 path = "/students/{user}",162 path = "/students/{user}",
@@ -178,6 +186,7 @@ async fn compute_student(
178 let body = body.map(|Json(body)| body).unwrap_or_default();186 let body = body.map(|Json(body)| body).unwrap_or_default();
179 let request = StudentRequest {187 let request = StudentRequest {
180 user_id: target.key(),188 user_id: target.key(),
189+ requested_by: user.get_id().key(),
181 since: body.since,190 since: body.since,
182 sections: body.sections,191 sections: body.sections,
183 };192 };
@@ -212,6 +221,15 @@ async fn compute_student(
212 /// Manager+ only: this is a school-wide batch, and the run it starts spends221 /// Manager+ only: this is a school-wide batch, and the run it starts spends
213 /// the service's whole time budget. `503` when no service offers222 /// the service's whole time budget. `503` when no service offers
214 /// `insight.refresh` — nothing is queued.223 /// `insight.refresh` — nothing is queued.
224+///
225+/// The dispatch names the **caller** as `requested_by` — the principal the
226+/// service's own reads for the sweep run as — and always fills `user_ids`: a
227+/// named list passes through exactly as given, while an empty body is filled
228+/// from the school's own student roster (every user holding the `student`
229+/// role). The service's own roster discovery reads homework `assigned` lists,
230+/// so an empty body used to sweep nobody; the payload's `roster_source` records
231+/// which roster the list was. A school with no students dispatches an empty
232+/// list and answers `0` honestly.
215 #[utoipa::path(233 #[utoipa::path(
216 post,234 post,
217 path = "/refresh",235 path = "/refresh",
@@ -220,7 +238,7 @@ async fn compute_student(
220 request_body = RefreshInsightsRequest,238 request_body = RefreshInsightsRequest,
221 responses(239 responses(
222 (status = 202, description = "Queued; the service writes its run ledger on its own", body = AcceptedResponse),240 (status = 202, description = "Queued; the service writes its run ledger on its own", body = AcceptedResponse),
223- (status = 400, description = "`user_ids` names something that is not a user id", body = ErrorResponse),241+ (status = 400, description = "`user_ids` names something that is not a user id, or the school's roster is larger than one refresh may carry", body = ErrorResponse),
224 (status = 401, description = "Not authenticated", body = ErrorResponse),242 (status = 401, description = "Not authenticated", body = ErrorResponse),
225 (status = 403, description = "Requires manager role or higher", body = ErrorResponse),243 (status = 403, description = "Requires manager role or higher", body = ErrorResponse),
226 (status = 503, description = "No AI service offers `insight.refresh` right now; nothing was queued", body = ErrorResponse),244 (status = 503, description = "No AI service offers `insight.refresh` right now; nothing was queued", body = ErrorResponse),
@@ -230,12 +248,18 @@ async fn compute_student(
230 async fn refresh(248 async fn refresh(
231 State(st): State<AppState>,249 State(st): State<AppState>,
232 tenant: ResolvedTenant,250 tenant: ResolvedTenant,
233- RequireManager(_user): RequireManager,251+ RequireManager(user): RequireManager,
234 body: Option<Json<RefreshInsightsRequest>>,252 body: Option<Json<RefreshInsightsRequest>>,
235 ) -> Result<Response, AppError> {253 ) -> Result<Response, AppError> {
236 let body = body.map(|Json(body)| body).unwrap_or_default();254 let body = body.map(|Json(body)| body).unwrap_or_default();
255+ let (roster, roster_source) = match normalized_ids(body.user_ids)? {
256+ Some(ids) if !ids.is_empty() => (ids, ROSTER_SOURCE_EXPLICIT),
257+ _ => (school_roster(&st.db).await?, ROSTER_SOURCE_SCHOOL),
258+ };
237 let request = RefreshRequest {259 let request = RefreshRequest {
238- user_ids: normalized_ids(body.user_ids)?,260+ requested_by: user.get_id().key(),
261+ user_ids: Some(roster),
262+ roster_source: roster_source.to_string(),
239 force: body.force,263 force: body.force,
240 };264 };
241 let Some(bridge) = st.ai.clone() else {265 let Some(bridge) = st.ai.clone() else {
@@ -249,9 +273,10 @@ async fn refresh(
249 273
250 let slug = tenant.slug.clone();274 let slug = tenant.slug.clone();
251 tokio::spawn(async move {275 tokio::spawn(async move {
276+ let source = request.roster_source.clone();
252 match insight::refresh(&bridge, &slug, &request).await {277 match insight::refresh(&bridge, &slug, &request).await {
253 Ok(answer) => tracing::info!(278 Ok(answer) => tracing::info!(
254- "insight.refresh answered: {} requested, {} computed, {} skipped, {} failed",279+ "insight.refresh ({source} roster) answered: {} requested, {} computed, {} skipped, {} failed",
255 answer.requested.unwrap_or(0),280 answer.requested.unwrap_or(0),
256 answer.computed.unwrap_or(0),281 answer.computed.unwrap_or(0),
257 answer.skipped.unwrap_or(0),282 answer.skipped.unwrap_or(0),
@@ -573,6 +598,32 @@ fn normalized_ids(ids: Option<Vec<String>>) -> Result<Option<Vec<String>>, AppEr
573 .transpose()598 .transpose()
574 }599 }
575 600
601+/// The school's own student roster, as the refresh door fills an empty request
602+/// body with.
603+///
604+/// The same set the office's student table lists: every `app_user` holding the
605+/// `student` role exactly, newest first ([`db::user::list_by_role`]). It is
606+/// what the service cannot assemble itself — its own roster discovery reads
607+/// homework `assigned` lists, which a live school rarely fills — so an empty
608+/// body must name the school here or the sweep computes nobody.
609+///
610+/// Refused, never clipped, past
611+/// [`MAX_INSIGHT_REFRESH_STUDENTS`](crate::constant::MAX_INSIGHT_REFRESH_STUDENTS):
612+/// a clipped roster would leave students unanalysed while the run read as
613+/// complete. A school with no students answers an empty list — a sweep that
614+/// computed nobody is a true answer, not a failure.
615+async fn school_roster(db: &Database) -> Result<Vec<String>, AppError> {
616+ let students = db::user::list_by_role(db, Role::Student).await?;
617+ if students.len() > MAX_INSIGHT_REFRESH_STUDENTS {
618+ return Err(AppError::Validation(ValidationError::Invalid {
619+ field: "user_ids",
620+ reason: "the school's roster is larger than one refresh may carry; \
621+ name the students to recompute explicitly",
622+ }));
623+ }
624+ Ok(students.iter().map(|user| user.get_id().key()).collect())
625+}
626+
576 // ---- the reads -------------------------------------------------------------627 // ---- the reads -------------------------------------------------------------
577 628
578 /// One student's nightly summary. The four module objects are ZEKA's own629 /// One student's nightly summary. The four module objects are ZEKA's own
tests/ai_bridge.rsmodified+127 -0
@@ -3463,6 +3463,7 @@ async fn an_insight_student_dispatch_names_the_school_and_round_trips() {
3463 &demo(),3463 &demo(),
3464 &hezarfen_backend::ai::StudentRequest {3464 &hezarfen_backend::ai::StudentRequest {
3465 user_id: ali.clone(),3465 user_id: ali.clone(),
3466+ requested_by: ali.clone(),
3466 since: None,3467 since: None,
3467 sections: None,3468 sections: None,
3468 },3469 },
@@ -3539,6 +3540,132 @@ async fn no_insight_refresh_worker_means_503_and_nothing_is_dispatched() {
3539 assert_eq!(res.status, StatusCode::FORBIDDEN, "{}", res.body);3540 assert_eq!(res.status, StatusCode::FORBIDDEN, "{}", res.body);
3540 }3541 }
3541 3542
3543+// ---- the requester and the roster a refresh reads -------------------------
3544+
3545+use hezarfen_backend::ai::insight::{ROSTER_SOURCE_EXPLICIT, ROSTER_SOURCE_SCHOOL};
3546+
3547+/// The ids of a JSON array of strings, sorted — the roster's own order is the
3548+/// database's (newest first), which is not what these tests are about.
3549+fn sorted_ids(value: &Value) -> Vec<String> {
3550+ let mut ids: Vec<String> = value
3551+ .as_array()
3552+ .expect("a json array")
3553+ .iter()
3554+ .map(|id| id.as_str().expect("an id string").to_string())
3555+ .collect();
3556+ ids.sort();
3557+ ids
3558+}
3559+
3560+/// Every `insight.*` dispatch names the caller it runs as. The compute doors
3561+/// are authorized for the caller, so the service must read the student's data
3562+/// as that caller too — the synthetic `ai` principal those reads would
3563+/// otherwise run as is refused `403` on `/marks/{user}`. The refresh door also
3564+/// fills an empty body from the school's own student roster: its own discovery
3565+/// (homework `assigned` lists) does not name enough of a live school to sweep.
3566+#[tokio::test]
3567+async fn the_insight_doors_name_the_caller_and_the_refresh_roster_they_read() {
3568+ let bridge = bridge().await;
3569+ let service = connect_service(
3570+ &bridge,
3571+ hello(
3572+ "zeka",
3573+ &[AI_INSIGHT_STUDENT_CAPABILITY, AI_INSIGHT_REFRESH_CAPABILITY],
3574+ ),
3575+ Behaviour::Echo,
3576+ )
3577+ .await;
3578+ await_workers(&bridge, 1).await;
3579+ let (app, db) = chat_app(&bridge).await;
3580+
3581+ let staff = common::login_as(&app, &db, "mudur", "manager").await;
3582+ let staff_id = common::me_id(&app, &staff).await;
3583+ let ayse = common::login_as(&app, &db, "ayse", "student").await;
3584+ let ayse_id = common::me_id(&app, &ayse).await;
3585+ let veli = common::login_as(&app, &db, "veli", "student").await;
3586+ let veli_id = common::me_id(&app, &veli).await;
3587+
3588+ // The student door names the caller beside the student it computes.
3589+ let res = common::send(
3590+ &app,
3591+ "POST",
3592+ &format!("/insights/students/{ayse_id}"),
3593+ Some(&staff),
3594+ Some(json!({})),
3595+ )
3596+ .await;
3597+ assert_eq!(res.status, StatusCode::ACCEPTED, "{}", res.body);
3598+
3599+ let seen = await_seen(&service, 1).await;
3600+ assert_eq!(seen[0].payload["user_id"], ayse_id);
3601+ assert_eq!(seen[0].payload["requested_by"], staff_id);
3602+
3603+ // An empty refresh body carries the school's own roster — both students.
3604+ let res = common::send(
3605+ &app,
3606+ "POST",
3607+ "/insights/refresh",
3608+ Some(&staff),
3609+ Some(json!({})),
3610+ )
3611+ .await;
3612+ assert_eq!(res.status, StatusCode::ACCEPTED, "{}", res.body);
3613+ let seen = await_seen(&service, 2).await;
3614+ assert_eq!(seen[1].payload["requested_by"], staff_id);
3615+ assert_eq!(seen[1].payload["roster_source"], ROSTER_SOURCE_SCHOOL);
3616+ let mut expected = vec![ayse_id.clone(), veli_id.clone()];
3617+ expected.sort();
3618+ assert_eq!(sorted_ids(&seen[1].payload["user_ids"]), expected);
3619+
3620+ // A named list is used exactly as given, never widened to the roster.
3621+ let res = common::send(
3622+ &app,
3623+ "POST",
3624+ "/insights/refresh",
3625+ Some(&staff),
3626+ Some(json!({ "user_ids": [veli_id] })),
3627+ )
3628+ .await;
3629+ assert_eq!(res.status, StatusCode::ACCEPTED, "{}", res.body);
3630+ let seen = await_seen(&service, 3).await;
3631+ assert_eq!(seen[2].payload["roster_source"], ROSTER_SOURCE_EXPLICIT);
3632+ assert_eq!(seen[2].payload["requested_by"], staff_id);
3633+ assert_eq!(seen[2].payload["user_ids"], json!([veli_id]));
3634+}
3635+
3636+/// A school with no students still dispatches an honest empty sweep: the
3637+/// roster fill answers an empty list rather than refusing, so a refresh on a
3638+/// brand-new school completes with `0 requested` instead of vanishing.
3639+#[tokio::test]
3640+async fn an_empty_school_roster_still_dispatches_with_an_empty_list() {
3641+ let bridge = bridge().await;
3642+ let service = connect_service(
3643+ &bridge,
3644+ hello("zeka", &[AI_INSIGHT_REFRESH_CAPABILITY]),
3645+ Behaviour::Echo,
3646+ )
3647+ .await;
3648+ await_workers(&bridge, 1).await;
3649+ let (app, db) = chat_app(&bridge).await;
3650+ let staff = common::login_as(&app, &db, "mudur", "manager").await;
3651+ let staff_id = common::me_id(&app, &staff).await;
3652+
3653+ let res = common::send(
3654+ &app,
3655+ "POST",
3656+ "/insights/refresh",
3657+ Some(&staff),
3658+ Some(json!({})),
3659+ )
3660+ .await;
3661+ assert_eq!(res.status, StatusCode::ACCEPTED, "{}", res.body);
3662+
3663+ let seen = await_seen(&service, 1).await;
3664+ assert_eq!(seen[0].payload["requested_by"], staff_id);
3665+ assert_eq!(seen[0].payload["roster_source"], ROSTER_SOURCE_SCHOOL);
3666+ assert_eq!(seen[0].payload["user_ids"], json!([]));
3667+}
3668+
3542 // ---- a capability a service contradicts --------------------------------3669 // ---- a capability a service contradicts --------------------------------
3543 //3670 //
3544 // The class this closes: a service announces `insight.refresh` in its `Hello`,3671 // The class this closes: a service announces `insight.refresh` in its `Hello`,
tests/limits_completeness.rsmodified+6 -0
@@ -201,6 +201,12 @@ const EXCLUDED: &[(&str, &str)] = &[
201 "students one bridge purge call may name; the roster is the AI \201 "students one bridge purge call may name; the roster is the AI \
202 service's own list, not something a browser assembles",202 service's own list, not something a browser assembles",
203 ),203 ),
204+ (
205+ "MAX_INSIGHT_REFRESH_STUDENTS",
206+ "students one school-wide refresh may carry when its door fills the \
207+ roster itself; the refresh batch is the AI service's own work unit, \
208+ not a client-facing bound",
209+ ),
204 (210 (
205 "AI_PODCAST_SUBMIT_CAPABILITY",211 "AI_PODCAST_SUBMIT_CAPABILITY",
206 "capability string an AI service declares",212 "capability string an AI service declares",