forge: on 403 from PATCH user email, hint operator to delete core token (#646 argus nit)

This commit is contained in:
damocles 2026-05-30 18:18:56 +02:00 committed by Mara
commit 0b83e5a69e

View file

@ -257,6 +257,17 @@ async fn ensure_user_email(name: &str) {
Ok(status) if status.is_success() => {
tracing::debug!(%name, %email, "forge: user email aligned");
}
Ok(status) if status == reqwest::StatusCode::FORBIDDEN => {
// Almost certainly an existing-deployment migration case:
// pre-#646 the core token was minted without admin scope, so
// /admin/users/* now returns 403 even though `core` is a
// site admin. Tell the operator how to fix it inline (#646).
tracing::warn!(
%name, %email, %status,
"forge: PATCH user email forbidden — core token likely missing admin scope. \
Delete {CORE_TOKEN_PATH} and restart hive-c0re to re-mint with the new scopes (#646)."
);
}
Ok(status) => {
tracing::warn!(%name, %email, %status, "forge: PATCH user email returned non-success");
}