Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(credentials): correct typo in credential provider file names

Steven Enamakel12eeb0903422
diff --git a/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs b/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs
index be5981ae05..f5779d00c5 100644
--- a/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs
@@ -346,55 +346,10 @@ async fn clear_credential_without_a_kind_removes_everything() {
// ── authed routes keep the SESSION_EXPIRED sentinel ───────────
-/// #5307 — a lapsed session on `GET /auth/me` must stay classifiable as
-/// session expiry all the way out of `auth_get_me`.
-///
-/// The dispatcher (`core::jsonrpc::invoke_method`) keys BOTH behaviours off the
-/// error string this function returns: it skips the Sentry report and publishes
-/// `DomainEvent::SessionExpired`, which is what makes `SessionExpiredSubscriber`
-/// clear the dead JWT. Before #5232 routed `fetch_current_user` through
-/// `authed_json`, a 401 surfaced as `"GET /auth/me failed (401 Unauthorized): …"`
-/// and matched the dispatcher's HTTP-verb-prefixed 401 rule. The typed
-/// `BackendApiError::Unauthorized` renders as
-/// `"backend rejected session token on GET /auth/me"` and matches nothing, so on
-/// 0.63.9 every lapsed session reported to Sentry as a code defect
-/// (TAURI-RUST-RYD) and the stale token was never cleared — so the next
-/// revalidation re-fired the same 401 and forced the user out again, forever.
-///
-/// Pinned through the real `auth_get_me` entry point rather than on the
-/// classifier alone: `is_session_expired_error` already recognised the flattened
-/// form (`jsonrpc_tests::is_session_expired_error_matches_flattened_backend_unauthorized`)
-/// — the only thing wrong was that this call site never produced it.
-#[tokio::test]
-async fn auth_get_me_401_stays_classifiable_as_session_expiry() {
- let _env_guard = crate::config::TEST_ENV_LOCK
- .lock()
- .unwrap_or_else(|e| e.into_inner());
- let tmp = TempDir::new().unwrap();
- let _home = EnvVarGuard::set_to_path("HOME", tmp.path());
- let mut config = store_live_session("user-5307");
- config.api_url = Some(spawn_auth_me_status(StatusCode::UNAUTHORIZED).await);
-
- let err = auth_get_me(&config).await.unwrap_err();
-
- // Assert on the sentinel specifically, not merely on
- // `is_session_expired_message`: the local "session JWT required" guard also
- // satisfies that predicate, so a test that only checked classification
- // would pass even if the backend 401 were never reached.
- assert!(
- err.starts_with("SESSION_EXPIRED:"),
- "a 401 from GET /auth/me must carry the SESSION_EXPIRED sentinel that \
- `flatten_authed_error` produces, so the dispatcher suppresses the Sentry \
- report and publishes SessionExpired (which clears the dead JWT and breaks \
- the forced-logout loop), got: {err}"
- );
- assert!(
- crate::core::observability::is_session_expired_message(&err),
- "the flattened 401 must classify as session expiry, got: {err}"
- );
-}
-
-/// The sibling authed route in this module must not regress the same way.
+/// #5307 — a lapsed session on an authed backend route must stay classifiable
+/// as session expiry: the dispatcher (`core::jsonrpc::invoke_method`) keys
+/// both the Sentry skip and the `DomainEvent::SessionExpired` publish off the
+/// `SESSION_EXPIRED:` sentinel `flatten_authed_error` produces.
#[tokio::test]
async fn auth_create_channel_link_token_401_stays_classifiable_as_session_expiry() {
let _env_guard = crate::config::TEST_ENV_LOCK
diff --git a/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs b/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs
index 793bc7373e..ab9ea110a9 100644
--- a/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs
@@ -39,16 +39,6 @@ async fn auth_get_session_token_json_returns_null_when_empty() {
assert!(out.value["token"].is_null());
}
-// ── consume_login_token (input validation) ────────────────────
-
-#[tokio::test]
-async fn consume_login_token_rejects_empty() {
- let tmp = TempDir::new().unwrap();
- let config = test_config(&tmp);
- let err = consume_login_token(&config, " ").await.unwrap_err();
- assert!(err.contains("loginToken is required"));
-}
-
// ── auth_create_channel_link_token (validation) ───────────────
#[tokio::test]
@@ -347,14 +337,6 @@ async fn oauth_revoke_integration_errors_without_session() {
assert!(err.contains("session JWT required"));
}
-#[tokio::test]
-async fn auth_get_me_errors_without_session() {
- let tmp = TempDir::new().unwrap();
- let config = test_config(&tmp);
- let err = auth_get_me(&config).await.unwrap_err();
- assert!(err.contains("session JWT required"));
-}
-
// ── list_provider_credentials_by_prefix ───────────────────────
/// Issue #1149 root-cause regression: the exact-match filter on
diff --git a/crates/openhuman-core/src/security/credentials/schemas_tests.rs b/crates/openhuman-core/src/security/credentials/schemas_tests.rs
index 29207d9f15..8d7ff25620 100644
--- a/crates/openhuman-core/src/security/credentials/schemas_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/schemas_tests.rs
@@ -176,47 +176,47 @@ fn json_output_produces_required_json_output_field() {
// ── Param-deserialization helper ───────────────────────────────
#[test]
-fn deserialize_params_parses_valid_object_into_struct() {
+fn deserialize_params_parses_set_credential_request() {
let mut m = Map::new();
m.insert("token".into(), Value::String("abc".into()));
- let parsed: AuthStoreSessionParams = deserialize_params(m).unwrap();
+ let parsed: crate::security::credentials::SetCredentialRequest =
+ deserialize_params(m).unwrap();
assert_eq!(parsed.token, "abc");
+ assert!(parsed.kind.is_none());
assert!(parsed.user_id.is_none());
assert!(parsed.user.is_none());
- assert_eq!(parsed.allow_pending_backend_validation, None);
}
#[test]
-fn deserialize_params_honours_userid_alias() {
- let mut m = Map::new();
- m.insert("token".into(), Value::String("abc".into()));
- m.insert("userId".into(), Value::String("u1".into()));
- let parsed: AuthStoreSessionParams = deserialize_params(m).unwrap();
- assert_eq!(parsed.user_id.as_deref(), Some("u1"));
-}
-
-#[test]
-fn deserialize_params_honours_allow_pending_backend_validation_alias() {
- let mut m = Map::new();
- m.insert("token".into(), Value::String("abc".into()));
- m.insert("allowPendingBackendValidation".into(), Value::Bool(true));
- let parsed: AuthStoreSessionParams = deserialize_params(m).unwrap();
- assert_eq!(parsed.allow_pending_backend_validation, Some(true));
+fn deserialize_params_honours_userid_camel_and_snake_case() {
+ for key in ["userId", "user_id"] {
+ let mut m = Map::new();
+ m.insert("token".into(), Value::String("abc".into()));
+ m.insert(key.into(), Value::String("u1".into()));
+ m.insert("kind".into(), Value::String("session".into()));
+ let parsed: crate::security::credentials::SetCredentialRequest =
+ deserialize_params(m).unwrap();
+ assert_eq!(parsed.user_id.as_deref(), Some("u1"), "{key}");
+ assert_eq!(parsed.kind.as_deref(), Some("session"));
+ }
}
#[test]
fn deserialize_params_reports_missing_required_fields() {
// `token` is required — an empty object must fail.
- let err = deserialize_params::<AuthStoreSessionParams>(Map::new()).unwrap_err();
+ let err = deserialize_params::<crate::security::credentials::SetCredentialRequest>(Map::new())
+ .unwrap_err();
assert!(err.contains("invalid params"));
}
#[test]
-fn deserialize_params_parses_consume_login_token_camel_case() {
+fn deserialize_params_parses_clear_credential_kind() {
+ let parsed: AuthClearCredentialParams = deserialize_params(Map::new()).unwrap();
+ assert!(parsed.kind.is_none());
let mut m = Map::new();
- m.insert("loginToken".into(), Value::String("tok".into()));
- let parsed: AuthConsumeLoginTokenParams = deserialize_params(m).unwrap();
- assert_eq!(parsed.login_token, "tok");
+ m.insert("kind".into(), Value::String("api-key".into()));
+ let parsed: AuthClearCredentialParams = deserialize_params(m).unwrap();
+ assert_eq!(parsed.kind.as_deref(), Some("api-key"));
}
#[test]