feat: complete Epic 1 production foundation
This commit is contained in:
1 parent
767428436d
commit
182bde8ac0
298 files changed
+35711
-5291
No files matched your search
@@ -10,7 +10,7 @@ pub struct ResponseCacheScope {
|
||||
pub agent_key: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct RuntimeRequestContext {
|
||||
pub request_id: RequestId,
|
||||
pub trace_context: TraceContext,
|
||||
@@ -20,6 +20,23 @@ pub struct RuntimeRequestContext {
|
||||
pub approval_granted: bool,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for RuntimeRequestContext {
|
||||
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
formatter
|
||||
.debug_struct("RuntimeRequestContext")
|
||||
.field("request_id", &self.request_id)
|
||||
.field("trace_context", &self.trace_context)
|
||||
.field("response_cache_scope", &self.response_cache_scope)
|
||||
.field("metering_context", &self.metering_context)
|
||||
.field(
|
||||
"confirmation_token",
|
||||
&self.confirmation_token.as_ref().map(|_| "[REDACTED]"),
|
||||
)
|
||||
.field("approval_granted", &self.approval_granted)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct MeteringContext {
|
||||
pub workspace_id: WorkspaceId,
|
||||
@@ -142,12 +159,13 @@ impl From<&ResponseCacheScope> for crank_core::ResponseCacheScope {
|
||||
|
||||
impl From<&RuntimeRequestContext> for crank_core::RuntimeRequestContext {
|
||||
fn from(value: &RuntimeRequestContext) -> Self {
|
||||
Self {
|
||||
request_id: value.request_id.clone(),
|
||||
trace_context: value.trace_context.clone(),
|
||||
response_cache_scope: value.response_cache_scope.as_ref().map(Into::into),
|
||||
metering_context: value.metering_context.as_ref().map(Into::into),
|
||||
}
|
||||
let mut context = crank_core::RuntimeRequestContext::new(
|
||||
value.request_id.clone(),
|
||||
value.trace_context.clone(),
|
||||
);
|
||||
context.response_cache_scope = value.response_cache_scope.as_ref().map(Into::into);
|
||||
context.metering_context = value.metering_context.as_ref().map(Into::into);
|
||||
context
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +236,7 @@ mod tests {
|
||||
RuntimeRequestContext::from_request_id("req_123").with_confirmation_token("ct_123");
|
||||
|
||||
assert_eq!(context.confirmation_token(), Some("ct_123"));
|
||||
assert!(!format!("{context:?}").contains("ct_123"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user