fix(ci): borrow HeaderMap in rbac user_from_headers calls #3

Merged
HexC0d3rz merged 1 commit from fix/ci-rbac-headers-borrow into main 2026-06-16 09:40:49 -04:00
HexC0d3rz commented 2026-06-16 09:05:50 -04:00 (Migrated from github.com)

Summary

Fixes E0308 (mismatched types) compile errors in crates/zeno-server/src/api/rbac.rs at lines 150 and 243. The function user_from_headers (defined in crates/zeno-server/src/api/auth.rs:112) expects &HeaderMap, but the two call sites were passing the owned HeaderMap value. The compiler suggested borrowing with &headers, which is what this change does.

Failing CI Run

https://github.com/HexC0d3rz/zeno-rmm/actions/runs/27602319638

The "Test" and "Clippy" jobs both failed on commit e468c645 on main due to these two E0308 errors.

Compile Errors Fixed

error[E0308]: mismatched types
   --> crates/zeno-server/src/api/rbac.rs:150:21
    |
150 |     let _user_id = user_from_headers(&state.config.jwt_secret, headers)?;
    |                     ^^^^^^^^^^^^^^^                           -------
    |                     |                                           |
    |                     |                                           help: consider borrowing here: `&headers`
    |                     expected `&HeaderMap`, found `HeaderMap`

error[E0308]: mismatched types
   --> crates/zeno-server/src/api/rbac.rs:243:17
    |
243 |     let _ = user_from_headers(&state.config.jwt_secret, headers)?;
    |                 ^^^^^^^^^^^^^^^                           -------
    |                 |                                           |
    |                 |                                           help: consider borrowing here: `&headers`
    |                 expected `&HeaderMap`, found `HeaderMap`

Diff

@@ -147,7 +147,7 @@ pub async fn list_roles(
     headers: HeaderMap,
 ) -> AppResult<Json<ListRolesResponse>> {
     // Allow any authenticated user to list (read is not restricted)
-    let _user_id = user_from_headers(&state.config.jwt_secret, headers)?;
+    let _user_id = user_from_headers(&state.config.jwt_secret, &headers)?;

@@ -240,7 +240,7 @@ pub async fn get_role(
     headers: HeaderMap,
     Path(id): Path<Uuid>,
 ) -> AppResult<Json<RoleResponse>> {
-    let _ = user_from_headers(&state.config.jwt_secret, headers)?;
+    let _ = user_from_headers(&state.config.jwt_secret, &headers)?;

Verification

  • cargo fmt --all — clean
  • cargo test --workspace --all-targets — all 129 tests pass (27 + 9 + 69 + 0 + 8 + 16 across zeno-server, zeno-agent, zeno-shared, zeno-installer, codec_serde, message_roundtrip test binaries)
  • cargo clippy --workspace --all-targets -- -D warnings — the two rbac.rs E0308 errors are resolved; remaining clippy errors are pre-existing on main and unrelated to this fix
## Summary Fixes E0308 (mismatched types) compile errors in `crates/zeno-server/src/api/rbac.rs` at lines 150 and 243. The function `user_from_headers` (defined in `crates/zeno-server/src/api/auth.rs:112`) expects `&HeaderMap`, but the two call sites were passing the owned `HeaderMap` value. The compiler suggested borrowing with `&headers`, which is what this change does. ## Failing CI Run https://github.com/HexC0d3rz/zeno-rmm/actions/runs/27602319638 The "Test" and "Clippy" jobs both failed on commit `e468c645` on `main` due to these two E0308 errors. ## Compile Errors Fixed ``` error[E0308]: mismatched types --> crates/zeno-server/src/api/rbac.rs:150:21 | 150 | let _user_id = user_from_headers(&state.config.jwt_secret, headers)?; | ^^^^^^^^^^^^^^^ ------- | | | | | help: consider borrowing here: `&headers` | expected `&HeaderMap`, found `HeaderMap` error[E0308]: mismatched types --> crates/zeno-server/src/api/rbac.rs:243:17 | 243 | let _ = user_from_headers(&state.config.jwt_secret, headers)?; | ^^^^^^^^^^^^^^^ ------- | | | | | help: consider borrowing here: `&headers` | expected `&HeaderMap`, found `HeaderMap` ``` ## Diff ```diff @@ -147,7 +147,7 @@ pub async fn list_roles( headers: HeaderMap, ) -> AppResult<Json<ListRolesResponse>> { // Allow any authenticated user to list (read is not restricted) - let _user_id = user_from_headers(&state.config.jwt_secret, headers)?; + let _user_id = user_from_headers(&state.config.jwt_secret, &headers)?; @@ -240,7 +240,7 @@ pub async fn get_role( headers: HeaderMap, Path(id): Path<Uuid>, ) -> AppResult<Json<RoleResponse>> { - let _ = user_from_headers(&state.config.jwt_secret, headers)?; + let _ = user_from_headers(&state.config.jwt_secret, &headers)?; ``` ## Verification - `cargo fmt --all` — clean - `cargo test --workspace --all-targets` — all 129 tests pass (27 + 9 + 69 + 0 + 8 + 16 across zeno-server, zeno-agent, zeno-shared, zeno-installer, codec_serde, message_roundtrip test binaries) - `cargo clippy --workspace --all-targets -- -D warnings` — the two rbac.rs E0308 errors are resolved; remaining clippy errors are pre-existing on main and unrelated to this fix
Sign in to join this conversation.
No description provided.