You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plans/2026-07-27-issue-795-auth-error-classification.md
+9-13Lines changed: 9 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,19 +16,15 @@ An authorized streamable HTTP client can currently report the same caller action
16
16
17
17
The variants should remain distinct internally. The HTTP form carries a `WWW-Authenticate` header, while the OAuth-manager form describes local credential state and is only available with the `auth` feature. Merging them would either lose challenge data or make the streamable HTTP transport depend on OAuth even when OAuth support is disabled.
18
18
19
-
The proposed additive API is:
19
+
The public API addition is:
20
20
21
21
```rust
22
-
implDynamicTransportError {
23
-
pubfnis_authorization_required(&self) ->bool;
24
-
}
25
-
26
22
implClientInitializeError {
27
23
pubfnis_authorization_required(&self) ->bool;
28
24
}
29
25
```
30
26
31
-
`DynamicTransportError`will inspect the standard `std::error::Error::source` chain. `ClientInitializeError`will delegate for its `TransportError` variant and return`false` for all other variants.
27
+
Internally, `DynamicTransportError`inspects the standard `std::error::Error::source` chain. `ClientInitializeError`delegates for its `TransportError` variant and returns`false` for all other variants. The transport-level helper remains crate-internal until another public use case requires it.
32
28
33
29
`AuthRequiredError` must participate in that source chain. It should implement `std::error::Error`, and `StreamableHttpError::AuthRequired` should expose it as its source. `StreamableHttpError::Auth(AuthError)` already exposes `AuthError` through `thiserror`.
34
30
@@ -51,7 +47,7 @@ impl ClientInitializeError {
51
47
52
48
| File | Role | Status |
53
49
| --- | --- | --- |
54
-
|`crates/rmcp/src/transport/streamable_http_client.rs`|Make the HTTP 401 detail error visible through the standard source chain | Complete |
50
+
|`crates/rmcp/src/transport/streamable_http_client.rs`|Verify the HTTP 401 detail error is visible through the standard source chain | Complete upstream|
**Description:**Derive or implement `std::error::Error`for `AuthRequiredError` with a concise display message, then mark the value inside `StreamableHttpError::AuthRequired` as its source.
79
+
**Description:**Confirm that `AuthRequiredError` implements `std::error::Error`and that `StreamableHttpError::AuthRequired` exposes it as its source. This prerequisite is already present on the latest `origin/main`.
84
80
85
81
**Acceptance criteria:**
86
82
87
83
-[x]`AuthRequiredError` remains constructible through `AuthRequiredError::new`.
88
84
-[x]`www_authenticate_header` remains available and unchanged.
89
85
-[x]`StreamableHttpError::source()` returns the contained `AuthRequiredError`.
90
-
-[x]Error display does not print credentials or the challenge header.
-[x] No existing enum variants or fields are removed or renamed.
92
88
93
89
### 3. Add transport-independent classification
94
90
95
91
**Files:**`crates/rmcp/src/transport.rs`
96
92
97
-
**Description:** Add `DynamicTransportError::is_authorization_required()`. Walk the inner error and its sources, recognizing `AuthError::AuthorizationRequired` when `auth` is enabled and `AuthRequiredError` when the streamable HTTP client is enabled.
93
+
**Description:** Add a crate-internal `DynamicTransportError::is_authorization_required()`. Walk the inner error and its sources, recognizing `AuthError::AuthorizationRequired` when `auth` is enabled and `AuthRequiredError` when the streamable HTTP client is enabled. Keep the transport-level classifier internal until another public use case requires it.
98
94
99
95
**Acceptance criteria:**
100
96
101
-
-[x]Callers do not need the transport type, backend error type, or a downcast.
97
+
-[x]Client callers do not need the transport type, backend error type, or a downcast.
102
98
-[x] Direct and multiply wrapped matching errors are recognized.
103
99
-[x] Feature-disabled builds compile; feature-specific checks are guarded locally.
104
100
-[x] Unknown custom transport errors return false.
105
-
-[x] The method is documented as a classification predicate, not an authorization action.
101
+
-[x] The helper name describes classification rather than an authorization action.
106
102
107
103
### 4. Add the initialization-error convenience API
0 commit comments