mirror of
https://github.com/block/buzz.git
synced 2026-11-30 21:21:48 +00:00
fix(relay): log unavailable live authorization disconnects
Preserve the explicit access-log reason after the disconnect-reason match introduced on main. Extend the selected revalidation outage journey through the production close-reason reader. Co-authored-by: Honor <e0bf479eeebe47dde1e35705212a4df70616a7bc834d907ddfb18cf0405f8b1b@seiler-test.communities.public.builderlabstaging.xyz> Signed-off-by: Brad Seiler <seiler@squareup.com>
This commit is contained in:
@@ -67,6 +67,7 @@ impl CommunityDisconnectReason {
|
||||
Self::CommunityDeleted => "community_deleted",
|
||||
Self::AuthPolicyUpgraded => "auth_policy_upgraded",
|
||||
Self::AuthorizationDenied => "authorization_denied",
|
||||
Self::AuthorizationUnavailable => "authorization_unavailable",
|
||||
Self::AccessRevoked => "access_revoked",
|
||||
Self::Removed => "removed",
|
||||
}
|
||||
@@ -6681,6 +6682,7 @@ mod live_authorization_tests {
|
||||
const TEST_ISSUER: &str = "https://issuer.example";
|
||||
|
||||
struct LiveConnectionFixture {
|
||||
control: CommunityConnectionControl,
|
||||
cancel: CancellationToken,
|
||||
terminal_rx: mpsc::Receiver<WsMessage>,
|
||||
reason_rx: watch::Receiver<Option<CommunityDisconnectReason>>,
|
||||
@@ -6789,7 +6791,7 @@ mod live_authorization_tests {
|
||||
Arc::new(AtomicU8::new(0)),
|
||||
Arc::new(Mutex::new(HashMap::new())),
|
||||
3,
|
||||
control,
|
||||
control.clone(),
|
||||
);
|
||||
conn_manager.set_authenticated_identity(
|
||||
connection_id,
|
||||
@@ -6805,6 +6807,7 @@ mod live_authorization_tests {
|
||||
}
|
||||
|
||||
LiveConnectionFixture {
|
||||
control,
|
||||
cancel,
|
||||
terminal_rx,
|
||||
reason_rx,
|
||||
@@ -7675,6 +7678,20 @@ mod live_authorization_tests {
|
||||
assert_eq!(expired_grace.closed_for_db_failure, 4);
|
||||
assert!(sessions.iter().all(|session| session.cancel.is_cancelled()));
|
||||
|
||||
// The same terminal chosen by revalidation must reach access logging,
|
||||
// rather than falling back to the generic cancellation reason.
|
||||
let state = crate::state::tests::test_state().await;
|
||||
let (mut conn, _rx) = crate::connection::tests::test_conn_with_auth(
|
||||
crate::connection::tests::authenticated_state(),
|
||||
);
|
||||
Arc::get_mut(&mut conn)
|
||||
.expect("sole fixture owner")
|
||||
.community_control = sessions[0].control.clone();
|
||||
assert_eq!(
|
||||
crate::connection::server_close_reason(&state, &conn),
|
||||
Some("authorization_unavailable")
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
*sessions[0].reason_rx.borrow(),
|
||||
Some(CommunityDisconnectReason::AuthorizationUnavailable)
|
||||
|
||||
Reference in New Issue
Block a user