1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Typed error returned by the request-cache memoization boundary
//! (AP2.1-7, AGENTS.md §18).
//!
//! [`RequestCacheError`] is the only failure type the
//! [`crate::request_cache::RequestCache`] API returns. Variants exist only
//! for failures that can actually happen; the `Resolver` variant is a typed
//! carrier (an opaque `Arc<str>` the caller supplies), never a raw `String`
//! error. See the [`crate::request_cache`] module docs for the concurrency /
//! failure / cancellation semantics.
use Arc;
/// The maximum serialized key size, in bytes. A key larger than this is
/// rejected with [`RequestCacheError::OversizedKey`] rather than stored.
/// Bounds the memory an attacker-controlled key can consume in the cache
/// (AGENTS.md §29: no unlimited attacker-controlled work).
pub const MAX_KEY_BYTES: usize = 64 * 1024;
/// The typed error returned by the memoization boundary.
///
/// Variants are added only for failures that can actually happen. The
/// `Resolver` variant carries the resolver's own failure reason as an
/// opaque, caller-supplied string (a typed carrier, not a raw `String`
/// error — §18). The caller converts their resolver's error to
/// [`RequestCacheError`] at the boundary and is responsible for redacting
/// any secret before constructing it.