fix(spaces): allow PL omission when users_default matches, handle semaphore errors
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Failing after 5s
Update flake hashes / update-flake-hashes (pull_request) Failing after 4s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 13s

- PL omission check now allows omitting a space-managed user if the
  proposed users_default equals their space-granted PL
- Semaphore acquire errors cause early return instead of silent proceed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ember33 2026-03-18 12:51:19 +01:00
parent cee5aa476c
commit 78d7c56e6f
2 changed files with 10 additions and 4 deletions

View file

@ -719,7 +719,9 @@ impl Service {
pending.insert(space_id.clone())
};
let _permit = this.enforcement_semaphore.acquire().await;
let Ok(_permit) = this.enforcement_semaphore.acquire().await else {
return;
};
// Always repopulate cache first
this.populate_space(&space_id).await;
@ -829,7 +831,9 @@ impl Service {
let this = Arc::clone(self);
self.server.runtime().spawn(async move {
let _permit = this.enforcement_semaphore.acquire().await;
let Ok(_permit) = this.enforcement_semaphore.acquire().await else {
return;
};
// Read the actual m.space.child state event to check via
let child_event_type = StateEventType::SpaceChild;
@ -984,7 +988,9 @@ impl Service {
let this = Arc::clone(self);
self.server.runtime().spawn(async move {
let _permit = this.enforcement_semaphore.acquire().await;
let Ok(_permit) = this.enforcement_semaphore.acquire().await else {
return;
};
if let Err(e) = this.auto_join_qualifying_rooms(&space_id, &user_id).await {
debug_warn!(user_id = %user_id, error = ?e, "Auto-join on Space join failed");

View file

@ -166,7 +166,7 @@ pub async fn build_and_append_pdu(
.max();
if let Some(space_pl) = space_pl {
match proposed.users.get(user_id) {
| None => {
| None if i64::from(proposed.users_default) != space_pl => {
debug_warn!(
user_id = %user_id,
room_id = %room_id,