forge
Explore
Log in

Don't you dare go Hollow

2bf64d3133e61a8fff66a1ae86dddddba6844872Ahmet Kaan GümüşParent: 1b12ff7
  • style
    • cargo fmt
Show full message
🎨 style: cargo fmt
src/ai/protocol.rsmodified+6 -3
@@ -536,11 +536,14 @@ mod tests {
536536 }))
537537 .unwrap();
538538 assert_eq!(bare.on_behalf_of, None);
539- assert!(serde_json::from_value::<BlobRequest>(json!({ "id": "01J", "school": "demo" }))
540- .is_err());
539+ assert!(
540+ serde_json::from_value::<BlobRequest>(json!({ "id": "01J", "school": "demo" }))
541+ .is_err()
542+ );
541543 // The school is required here too.
542544 assert!(
543- serde_json::from_value::<BlobRequest>(json!({ "id": "01J", "file": "01FILE" })).is_err()
545+ serde_json::from_value::<BlobRequest>(json!({ "id": "01J", "file": "01FILE" }))
546+ .is_err()
544547 );
545548 // And the two shapes never parse as each other.
546549 assert!(
src/ai/server.rsmodified+11 -4
@@ -24,11 +24,11 @@ use crate::constant::{
2424 REQUEST_TIMEOUT_SECS,
2525 };
2626 use crate::database::Database;
27-use crate::error::AppError;
2827 use crate::domain::course::Course;
2928 use crate::domain::course_note::CourseNote;
3029 use crate::domain::course_note_file::{CourseNoteFile, CourseNoteFileId};
3130 use crate::domain::user::{User, UserId};
31+use crate::error::AppError;
3232 use crate::state::DbHealth;
3333 use crate::tenant::{Slug, Tenants};
3434 use crate::web::blob_path;
@@ -75,8 +75,12 @@ impl ApiHandle {
7575 /// switched off — a service that retries the first two forever learns
7676 /// nothing, while the third is worth retrying later.
7777 async fn school(&self, school: &str) -> Result<(Slug, Database), (&'static str, String)> {
78- let slug = Slug::try_new(school)
79- .map_err(|err| ("malformed", format!("`{school}` is not a school slug: {err}")))?;
78+ let slug = Slug::try_new(school).map_err(|err| {
79+ (
80+ "malformed",
81+ format!("`{school}` is not a school slug: {err}"),
82+ )
83+ })?;
8084 let db = self.tenants.get(&slug).await.map_err(|err| match err {
8185 AppError::Unauthorized => (
8286 "unknown_school",
@@ -600,7 +604,10 @@ async fn open_blob(
600604 /// never trusted from the frame: a service holding a stale id must not act as a
601605 /// user who has since been deleted or demoted, nor as a same-named user of
602606 /// another school. With nobody named the principal is the synthetic `ai` role.
603-async fn principal(db: &Database, on_behalf_of: Option<&str>) -> Result<User, (&'static str, String)> {
607+async fn principal(
608+ db: &Database,
609+ on_behalf_of: Option<&str>,
610+) -> Result<User, (&'static str, String)> {
604611 let Some(who) = on_behalf_of else {
605612 return Ok(User::ai_principal());
606613 };
src/state.rsmodified+7 -2
@@ -173,7 +173,9 @@ impl BoardHub {
173173 pub fn publish(&self, slug: &Slug, board: &str, frame: String) {
174174 let sender = {
175175 let boards = self.0.lock().expect("board hub lock");
176- boards.get(&scoped_key(slug, board)).map(|room| room.0.clone())
176+ boards
177+ .get(&scoped_key(slug, board))
178+ .map(|room| room.0.clone())
177179 };
178180 if let Some(sender) = sender {
179181 let _ = sender.send(frame);
@@ -239,7 +241,10 @@ mod tests {
239241 let mut in_b = hub.subscribe(&b, "board-1");
240242
241243 hub.publish(&a, "board-1", "alpha stroke".to_string());
242- assert_eq!(in_a.recv().await.expect("alpha's own stroke"), "alpha stroke");
244+ assert_eq!(
245+ in_a.recv().await.expect("alpha's own stroke"),
246+ "alpha stroke"
247+ );
243248 assert!(
244249 in_b.try_recv().is_err(),
245250 "beta's board must not hear alpha's stroke"
src/web/builder.rsmodified+11 -8
@@ -206,11 +206,7 @@ async fn builder_login(
206206 let password = Password::try_new(&req.password).map_err(|_| AppError::Unauthorized)?;
207207 let builder = match Builder::find_by_username(req.username.trim(), control).await? {
208208 Some(builder) => {
209- if !builder
210- .get_password_hash()
211- .verify_async(&password)
212- .await
213- {
209+ if !builder.get_password_hash().verify_async(&password).await {
214210 return Err(AppError::Unauthorized);
215211 }
216212 builder
@@ -401,14 +397,18 @@ async fn update_school(
401397 let control = st.tenants.control();
402398 // An empty patch on an unknown school is still a 404, so the existence
403399 // check is not left to whichever field happened to be present.
404- School::read(&slug, control).await?.ok_or(AppError::NotFound)?;
400+ School::read(&slug, control)
401+ .await?
402+ .ok_or(AppError::NotFound)?;
405403 if let Some(name) = name {
406404 School::update_name(&slug, &name, control).await?;
407405 }
408406 if let Some(status) = status {
409407 st.tenants.set_status(&slug, status).await?;
410408 }
411- let school = School::read(&slug, control).await?.ok_or(AppError::NotFound)?;
409+ let school = School::read(&slug, control)
410+ .await?
411+ .ok_or(AppError::NotFound)?;
412412 Ok(Json(SchoolResponse::new(&school)))
413413 }
414414
@@ -445,7 +445,10 @@ async fn delete_school(
445445 if let Err(err) = tokio::fs::remove_dir_all(&dir).await
446446 && err.kind() != std::io::ErrorKind::NotFound
447447 {
448- tracing::warn!("failed to remove the files of {slug} at {}: {err}", dir.display());
448+ tracing::warn!(
449+ "failed to remove the files of {slug} at {}: {err}",
450+ dir.display()
451+ );
449452 }
450453 Ok(StatusCode::NO_CONTENT)
451454 }
tests/ai_bridge.rsmodified+37 -8
@@ -332,7 +332,11 @@ async fn concurrent_requests_share_one_connection_without_blocking_each_other()
332332
333333 let calls = (0..N).map(|i| {
334334 let bridge = bridge.clone();
335- tokio::spawn(async move { bridge.dispatch(&demo(), "ocr.extract", json!({ "n": i })).await })
335+ tokio::spawn(async move {
336+ bridge
337+ .dispatch(&demo(), "ocr.extract", json!({ "n": i }))
338+ .await
339+ })
336340 });
337341 let answers = futures_util::future::join_all(calls).await;
338342
@@ -356,8 +360,14 @@ async fn requests_route_to_the_service_declaring_the_capability() {
356360 let grader = connect_service(&bridge, hello("grader", &["grade.essay"]), Behaviour::Echo).await;
357361 await_workers(&bridge, 2).await;
358362
359- bridge.dispatch(&demo(), "grade.essay", json!("text")).await.unwrap();
360- bridge.dispatch(&demo(), "ocr.extract", json!("png")).await.unwrap();
363+ bridge
364+ .dispatch(&demo(), "grade.essay", json!("text"))
365+ .await
366+ .unwrap();
367+ bridge
368+ .dispatch(&demo(), "ocr.extract", json!("png"))
369+ .await
370+ .unwrap();
361371
362372 assert_eq!(ocr.seen().len(), 1, "ocr only saw its own capability");
363373 assert_eq!(ocr.seen()[0].capability, "ocr.extract");
@@ -572,7 +582,12 @@ async fn a_silent_service_times_out_and_gives_the_slot_back() {
572582 // An abandoned request must not leak the worker's capacity.
573583 assert_eq!(bridge.workers()[0].inflight, 0);
574584 // And the worker is immediately usable again.
575- assert!(bridge.dispatch(&demo(), "ocr.extract", json!(null)).await.is_err());
585+ assert!(
586+ bridge
587+ .dispatch(&demo(), "ocr.extract", json!(null))
588+ .await
589+ .is_err()
590+ );
576591 }
577592
578593 #[tokio::test]
@@ -593,7 +608,12 @@ async fn a_per_call_timeout_overrides_the_default() {
593608 ));
594609 // ...but a capability known to be slow can ask for more.
595610 let answer = bridge
596- .dispatch_with_timeout(&demo(), "ocr.extract", json!("slow"), Duration::from_secs(5))
611+ .dispatch_with_timeout(
612+ &demo(),
613+ "ocr.extract",
614+ json!("slow"),
615+ Duration::from_secs(5),
616+ )
597617 .await
598618 .expect("the longer deadline held");
599619 assert_eq!(answer["echo"], "slow");
@@ -667,7 +687,10 @@ async fn a_disconnected_service_is_deregistered() {
667687 let bridge = bridge().await;
668688 let service = connect_service(&bridge, hello("ocr", &["ocr.extract"]), Behaviour::Echo).await;
669689 await_workers(&bridge, 1).await;
670- bridge.dispatch(&demo(), "ocr.extract", json!(null)).await.unwrap();
690+ bridge
691+ .dispatch(&demo(), "ocr.extract", json!(null))
692+ .await
693+ .unwrap();
671694
672695 service.conn.close(0u32.into(), b"service shutting down");
673696 drop(service);
@@ -715,7 +738,10 @@ async fn losing_one_service_leaves_the_other_serving() {
715738 await_workers(&bridge, 1).await;
716739
717740 for _ in 0..4 {
718- bridge.dispatch(&demo(), "ocr.extract", json!("x")).await.unwrap();
741+ bridge
742+ .dispatch(&demo(), "ocr.extract", json!("x"))
743+ .await
744+ .unwrap();
719745 }
720746 assert_eq!(
721747 survivor.seen().len(),
@@ -1795,7 +1821,10 @@ async fn a_course_note_is_indexed_and_its_output_stored_with_its_sources() {
17951821 // The service saw the note itself, under the documented capability.
17961822 let seen = service.seen();
17971823 assert_eq!(seen[0].capability, AI_RAG_INDEX_CAPABILITY);
1798- assert_eq!(seen[0].school, DEMO_SLUG, "the frame names the caller's school");
1824+ assert_eq!(
1825+ seen[0].school, DEMO_SLUG,
1826+ "the frame names the caller's school"
1827+ );
17991828 assert_eq!(seen[0].payload["course_note"], note);
18001829 assert_eq!(seen[0].payload["title"], "Bölüm 3");
18011830 assert_eq!(seen[0].payload["content"], "özet");
tests/ai_protocol.rsmodified+40 -16
@@ -553,7 +553,8 @@ async fn the_request_frame_carries_exactly_the_published_keys() {
553553 let id = request["id"].as_str().unwrap().to_string();
554554 raw::answer(
555555 send,
556- format!(r#"{{"status":"ok","id":"{id}","school":"{SCHOOL}","payload":{{"text":"hi"}}}}"#).as_bytes(),
556+ format!(r#"{{"status":"ok","id":"{id}","school":"{SCHOOL}","payload":{{"text":"hi"}}}}"#)
557+ .as_bytes(),
557558 )
558559 .await;
559560 let answer = call.await.unwrap().expect("dispatch succeeded");
@@ -714,7 +715,8 @@ async fn each_request_gets_its_own_stream_and_answers_may_come_back_in_any_order
714715 let n = request["payload"]["n"].clone();
715716 raw::answer(
716717 send,
717- format!(r#"{{"status":"ok","id":"{id}","school":"{SCHOOL}","payload":{{"n":{n}}}}}"#).as_bytes(),
718+ format!(r#"{{"status":"ok","id":"{id}","school":"{SCHOOL}","payload":{{"n":{n}}}}}"#)
719+ .as_bytes(),
718720 )
719721 .await;
720722 }
@@ -912,7 +914,8 @@ async fn several_raw_services_serve_one_capability_together() {
912914 let n = request["payload"]["n"].clone();
913915 raw::answer(
914916 send,
915- format!(r#"{{"status":"ok","id":"{id}","school":"{SCHOOL}","payload":{n}}}"#).as_bytes(),
917+ format!(r#"{{"status":"ok","id":"{id}","school":"{SCHOOL}","payload":{n}}}"#)
918+ .as_bytes(),
916919 )
917920 .await;
918921 }
@@ -1006,7 +1009,10 @@ async fn a_chat_request_names_the_askers_school_role() {
10061009 let id = request["id"].as_str().expect("trace id").to_string();
10071010 raw::answer(
10081011 send,
1009- format!(r#"{{"status":"ok","id":"{id}","school":"{SCHOOL}","payload":{{"text":"F = ma"}}}}"#).as_bytes(),
1012+ format!(
1013+ r#"{{"status":"ok","id":"{id}","school":"{SCHOOL}","payload":{{"text":"F = ma"}}}}"#
1014+ )
1015+ .as_bytes(),
10101016 )
10111017 .await;
10121018 }
@@ -1118,9 +1124,13 @@ async fn the_api_refusal_frame_carries_exactly_the_published_keys_and_codes() {
11181124 ),
11191125 (
11201126 "unknown_user",
1121- r#"{"id":"t5","school":"demo","path":"/auth/me","on_behalf_of":"nobodyatall"}"#.to_string(),
1127+ r#"{"id":"t5","school":"demo","path":"/auth/me","on_behalf_of":"nobodyatall"}"#
1128+ .to_string(),
1129+ ),
1130+ (
1131+ "malformed",
1132+ r#"{"id":"t6","school":"demo","path":42}"#.to_string(),
11221133 ),
1123- ("malformed", r#"{"id":"t6","school":"demo","path":42}"#.to_string()),
11241134 // A frame that names no school at all: required, never defaulted.
11251135 ("malformed", r#"{"id":"t7","path":"/auth/me"}"#.to_string()),
11261136 // A string that is no slug — the service's own bug, not a missing
@@ -1173,8 +1183,10 @@ async fn an_api_read_answers_a_named_user_with_that_users_own_data() {
11731183
11741184 let (answer, _) = raw::api_read(
11751185 &service.conn,
1176- format!(r#"{{"id":"tme","school":"{SCHOOL}","path":"/auth/me","on_behalf_of":"{student}"}}"#)
1177- .as_bytes(),
1186+ format!(
1187+ r#"{{"id":"tme","school":"{SCHOOL}","path":"/auth/me","on_behalf_of":"{student}"}}"#
1188+ )
1189+ .as_bytes(),
11781190 )
11791191 .await;
11801192 assert_eq!(answer["outcome"], "ok", "{answer}");
@@ -1204,7 +1216,10 @@ async fn two_schools(bridge: &AiBridge) -> (axum::Router, Tenants, String, Strin
12041216 let beta_cookie = common::login_as_school(&app, &beta_db, "beta", "ayse", "student").await;
12051217 let demo_ayse = common::me_id(&app, &demo_cookie).await;
12061218 let beta_ayse = common::me_id(&app, &beta_cookie).await;
1207- assert_ne!(demo_ayse, beta_ayse, "two schools, two separate `ayse` rows");
1219+ assert_ne!(
1220+ demo_ayse, beta_ayse,
1221+ "two schools, two separate `ayse` rows"
1222+ );
12081223 (app, tenants, demo_ayse, beta_ayse)
12091224 }
12101225
@@ -1222,8 +1237,10 @@ async fn an_api_read_answers_out_of_the_school_the_frame_named() {
12221237 for (school, who) in [("demo", &demo_ayse), ("beta", &beta_ayse)] {
12231238 let (answer, _) = raw::api_read(
12241239 &service.conn,
1225- format!(r#"{{"id":"t-own","school":"{school}","path":"/auth/me","on_behalf_of":"{who}"}}"#)
1226- .as_bytes(),
1240+ format!(
1241+ r#"{{"id":"t-own","school":"{school}","path":"/auth/me","on_behalf_of":"{who}"}}"#
1242+ )
1243+ .as_bytes(),
12271244 )
12281245 .await;
12291246 assert_eq!(answer["outcome"], "ok", "{answer}");
@@ -1272,7 +1289,10 @@ async fn a_suspended_school_is_refused_with_its_own_code() {
12721289 let (answer, _) = raw::api_read(&service.conn, read.as_bytes()).await;
12731290 assert_eq!(answer["outcome"], "err", "{answer}");
12741291 assert_eq!(answer["code"], "school_suspended", "{answer}");
1275- assert_eq!(answer["school"], "beta", "the refusal names the school back");
1292+ assert_eq!(
1293+ answer["school"], "beta",
1294+ "the refusal names the school back"
1295+ );
12761296 assert_eq!(answer["id"], "t-susp");
12771297
12781298 // The demo school is untouched by its neighbour's suspension.
@@ -1295,8 +1315,10 @@ async fn a_blob_read_names_its_school_too() {
12951315
12961316 let (header, _, body) = raw::blob_read(
12971317 &service.conn,
1298- format!(r#"{{"id":"t-b1","school":"{SCHOOL}","file":"{file}","on_behalf_of":"{student}"}}"#)
1299- .as_bytes(),
1318+ format!(
1319+ r#"{{"id":"t-b1","school":"{SCHOOL}","file":"{file}","on_behalf_of":"{student}"}}"#
1320+ )
1321+ .as_bytes(),
13001322 )
13011323 .await;
13021324 assert_eq!(header["status"], "ok", "{header}");
@@ -1459,8 +1481,10 @@ async fn an_api_read_still_answers_on_the_shared_client_stream_path() {
14591481
14601482 let (answer, _) = raw::api_read(
14611483 &service.conn,
1462- format!(r#"{{"id":"t-api","school":"{SCHOOL}","path":"/auth/me","on_behalf_of":"{student}"}}"#)
1463- .as_bytes(),
1484+ format!(
1485+ r#"{{"id":"t-api","school":"{SCHOOL}","path":"/auth/me","on_behalf_of":"{student}"}}"#
1486+ )
1487+ .as_bytes(),
14641488 )
14651489 .await;
14661490 assert_eq!(answer["outcome"], "ok", "{answer}");
tests/builder_api.rsmodified+87 -24
@@ -164,7 +164,10 @@ async fn creating_a_school_seeds_an_admin_who_can_log_in() {
164164 );
165165 let me = send(&app, "GET", "/auth/me", Some(&cookie), None).await;
166166 assert_eq!(me.status, StatusCode::OK);
167- assert_eq!(me.body["role"], "admin", "the seed is an admin, not a student");
167+ assert_eq!(
168+ me.body["role"], "admin",
169+ "the seed is an admin, not a student"
170+ );
168171
169172 // The slug is the identity: a second school may not take it.
170173 assert_eq!(
@@ -187,9 +190,15 @@ async fn creating_a_school_seeds_an_admin_who_can_log_in() {
187190 );
188191 // …and nothing was left behind by the refusal.
189192 assert_eq!(
190- send(&app, "GET", &format!("/schools/{bad}"), Some(&builder), None)
191- .await
192- .status,
193+ send(
194+ &app,
195+ "GET",
196+ &format!("/schools/{bad}"),
197+ Some(&builder),
198+ None
199+ )
200+ .await
201+ .status,
193202 StatusCode::NOT_FOUND,
194203 "slug {bad:?} left a school behind"
195204 );
@@ -220,7 +229,9 @@ async fn a_suspension_closes_the_school_and_a_resume_reopens_it() {
220229 let (app, _db, _tenants) = deployment().await;
221230 let builder = builder_login(&app).await;
222231 assert_eq!(
223- create_school(&app, &builder, "beta", "secret1").await.status,
232+ create_school(&app, &builder, "beta", "secret1")
233+ .await
234+ .status,
224235 StatusCode::CREATED
225236 );
226237
@@ -302,7 +313,9 @@ async fn a_suspension_closes_the_school_and_a_resume_reopens_it() {
302313 "a suspended school refuses login"
303314 );
304315 assert_eq!(
305- send(&app, "GET", "/auth/me", Some(&live), None).await.status,
316+ send(&app, "GET", "/auth/me", Some(&live), None)
317+ .await
318+ .status,
306319 StatusCode::FORBIDDEN,
307320 "…and the cookie it had already issued, on its very next call"
308321 );
@@ -336,7 +349,9 @@ async fn a_suspension_closes_the_school_and_a_resume_reopens_it() {
336349 )
337350 .await;
338351 assert_eq!(
339- send(&app, "GET", "/auth/me", Some(&live), None).await.status,
352+ send(&app, "GET", "/auth/me", Some(&live), None)
353+ .await
354+ .status,
340355 StatusCode::OK,
341356 "resuming restores the very same session"
342357 );
@@ -374,7 +389,11 @@ async fn resetting_an_admin_password_revokes_the_old_credential_and_its_sessions
374389 .unwrap();
375390 hezarfen_backend::domain::user::User::create(
376391 Username::try_new("veli").unwrap(),
377- Password::try_new("secret1").unwrap().hash_async().await.unwrap(),
392+ Password::try_new("secret1")
393+ .unwrap()
394+ .hash_async()
395+ .await
396+ .unwrap(),
378397 &gamma_db,
379398 )
380399 .await
@@ -632,8 +651,8 @@ async fn probe_hostile_slug_segments_never_delete_anything() {
632651 "Demo",
633652 "control",
634653 "builder",
635- "%C4%B1demo", // dotless i, non-ascii
636- "d%E2%80%8Bemo", // zero-width space
654+ "%C4%B1demo", // dotless i, non-ascii
655+ "d%E2%80%8Bemo", // zero-width space
637656 "de%20mo",
638657 "a",
639658 "-lead",
@@ -675,12 +694,25 @@ async fn probe_hostile_slug_segments_never_delete_anything() {
675694 // Also the empty segment, which is a different route shape entirely.
676695 for method in ["GET", "DELETE", "PATCH"] {
677696 let res = send(&app, method, "/schools/", Some(&builder), None).await;
678- assert!(!res.status.is_success() || method == "GET", "{method} /schools/ -> {}", res.status);
697+ assert!(
698+ !res.status.is_success() || method == "GET",
699+ "{method} /schools/ -> {}",
700+ res.status
701+ );
679702 }
680703
681- assert!(keep_dir.join("keep.bin").exists(), "a bystander school lost its bytes");
682- assert!(root_canary.exists(), "the FILES_PATH root canary was deleted");
683- assert!(outside_file.exists(), "a file outside FILES_PATH was deleted");
704+ assert!(
705+ keep_dir.join("keep.bin").exists(),
706+ "a bystander school lost its bytes"
707+ );
708+ assert!(
709+ root_canary.exists(),
710+ "the FILES_PATH root canary was deleted"
711+ );
712+ assert!(
713+ outside_file.exists(),
714+ "a file outside FILES_PATH was deleted"
715+ );
684716 assert!(
685717 files_dir().exists() && outside.path().exists(),
686718 "a directory root was removed"
@@ -784,7 +816,14 @@ async fn probe_remote_mode_database_statements_execute_for_every_accepted_slug()
784816 let mut broken: Vec<String> = Vec::new();
785817
786818 for raw in [
787- "demo", "abc", "ata-koleji", "x-y", "trail-", "2024school", "12345", "a1",
819+ "demo",
820+ "abc",
821+ "ata-koleji",
822+ "x-y",
823+ "trail-",
824+ "2024school",
825+ "12345",
826+ "a1",
788827 ] {
789828 let Ok(slug) = Slug::try_new(raw) else {
790829 continue;
@@ -820,8 +859,23 @@ async fn probe_remote_mode_database_statements_execute_for_every_accepted_slug()
820859 #[tokio::test]
821860 async fn probe_slug_accept_set_and_published_reserved_list() {
822861 for bad in [
823- "control", "builder", "Demo", "DEMO", "..", "", "a", "-lead", "de mo", "de.mo", "de_mo",
824- "demo/", "demo\\", "٢٣demo", "démo", "demo\u{200b}", "demo\n",
862+ "control",
863+ "builder",
864+ "Demo",
865+ "DEMO",
866+ "..",
867+ "",
868+ "a",
869+ "-lead",
870+ "de mo",
871+ "de.mo",
872+ "de_mo",
873+ "demo/",
874+ "demo\\",
875+ "٢٣demo",
876+ "démo",
877+ "demo\u{200b}",
878+ "demo\n",
825879 // 33 characters
826880 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
827881 ] {
@@ -831,7 +885,10 @@ async fn probe_slug_accept_set_and_published_reserved_list() {
831885 );
832886 }
833887 for good in ["ab", "demo", "a1", "2024", "ata-koleji"] {
834- assert!(Slug::try_new(good).is_ok(), "Slug::try_new rejected {good:?}");
888+ assert!(
889+ Slug::try_new(good).is_ok(),
890+ "Slug::try_new rejected {good:?}"
891+ );
835892 }
836893 // Documented boundary: a trailing hyphen IS accepted today.
837894 assert!(
@@ -971,7 +1028,9 @@ async fn probe_admin_targets_and_reset_revokes_all_sessions() {
9711028 assert_eq!(reset.status, StatusCode::NO_CONTENT);
9721029 for (n, cookie) in [(1, &s1), (2, &s2)] {
9731030 assert_eq!(
974- send(&app, "GET", "/auth/me", Some(cookie), None).await.status,
1031+ send(&app, "GET", "/auth/me", Some(cookie), None)
1032+ .await
1033+ .status,
9751034 StatusCode::UNAUTHORIZED,
9761035 "session {n} survived the password reset"
9771036 );
@@ -1036,9 +1095,7 @@ async fn probe_builder_session_hygiene() {
10361095 let builder = builder_login(&app).await;
10371096 let student = login(&app, "veli").await;
10381097
1039- let builder_token = builder
1040- .trim_start_matches("session=builder.")
1041- .to_string();
1098+ let builder_token = builder.trim_start_matches("session=builder.").to_string();
10421099 let student_token = cookie_token(&student).to_string();
10431100
10441101 // The builder's own token, worn as a school cookie.
@@ -1116,7 +1173,9 @@ async fn probe_builder_session_hygiene() {
11161173 );
11171174 // Logout is idempotent and safe without a cookie.
11181175 assert_eq!(
1119- send(&app, "POST", "/builder/logout", None, None).await.status,
1176+ send(&app, "POST", "/builder/logout", None, None)
1177+ .await
1178+ .status,
11201179 StatusCode::NO_CONTENT
11211180 );
11221181 }
@@ -1283,7 +1342,11 @@ async fn probe_remote_deployment_creates_and_deletes_a_hyphenated_school() {
12831342 login.status,
12841343 );
12851344 assert_eq!(retry.status, StatusCode::CONFLICT, "a made school is taken");
1286- assert_eq!(login.status, StatusCode::OK, "the admin logs into the hyphenated school");
1345+ assert_eq!(
1346+ login.status,
1347+ StatusCode::OK,
1348+ "the admin logs into the hyphenated school"
1349+ );
12871350 assert_eq!(deleted.status, StatusCode::NO_CONTENT);
12881351 assert!(!listed(&after_delete.body));
12891352 assert_eq!(
tests/spec_bounds.rsmodified+12 -2
@@ -64,8 +64,18 @@ fn expectations() -> Vec<(&'static str, &'static str, &'static str, i64)> {
6464 // --- builder (the vendor surface) ---
6565 ("CreateSchool", "slug", "minLength", MIN_SLUG_LEN as i64),
6666 ("CreateSchool", "slug", "maxLength", MAX_SLUG_LEN as i64),
67- ("CreateSchool", "name", "maxLength", MAX_SCHOOL_NAME_LEN as i64),
68- ("UpdateSchool", "name", "maxLength", MAX_SCHOOL_NAME_LEN as i64),
67+ (
68+ "CreateSchool",
69+ "name",
70+ "maxLength",
71+ MAX_SCHOOL_NAME_LEN as i64,
72+ ),
73+ (
74+ "UpdateSchool",
75+ "name",
76+ "maxLength",
77+ MAX_SCHOOL_NAME_LEN as i64,
78+ ),
6979 (
7080 "CreateSchool",
7181 "admin_username",