feat: harden community production foundation through story 1.5

This commit is contained in:
bsodfather committed 2026-08-14 00:21:59 +03:00
1 parent c30461cc92
commit f6fc2e5c9b
161 files changed
+16758 -2515

No files matched your search

@@ -43,6 +43,26 @@ impl PostgresRegistry {
&self,
request: CreateInvocationLogRequest<'_>,
) -> Result<(), RegistryError> {
let request_id =
request
.log
.request_id
.as_deref()
.ok_or(RegistryError::InvalidCorrelationIdentity {
field: "request_id",
})?;
crank_core::RequestId::parse(request_id).map_err(|_| {
RegistryError::InvalidCorrelationIdentity {
field: "request_id",
}
})?;
let trace_id = request
.log
.trace_id
.as_deref()
.ok_or(RegistryError::InvalidCorrelationIdentity { field: "trace_id" })?;
crank_core::TraceId::parse(trace_id)
.map_err(|_| RegistryError::InvalidCorrelationIdentity { field: "trace_id" })?;
let request_preview = crank_core::sanitize_invocation_preview(&request.log.request_preview);
let response_preview =
crank_core::sanitize_invocation_preview(&request.log.response_preview);
@@ -58,6 +78,7 @@ impl PostgresRegistry {
tool_name,
message,
request_id,
trace_id,
status_code,
duration_ms,
error_kind,
@@ -65,7 +86,7 @@ impl PostgresRegistry {
response_preview_json,
created_at
) values (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16::timestamptz
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17::timestamptz
)",
)
.bind(request.log.id.as_str())
@@ -78,6 +99,7 @@ impl PostgresRegistry {
.bind(&request.log.tool_name)
.bind(&request.log.message)
.bind(&request.log.request_id)
.bind(&request.log.trace_id)
.bind(request.log.status_code.map(i32::from))
.bind(i64::try_from(request.log.duration_ms).map_err(|_| {
RegistryError::InvalidNumericValue {
@@ -111,6 +133,7 @@ impl PostgresRegistry {
l.tool_name,
l.message,
l.request_id,
l.trace_id,
l.status_code,
l.duration_ms,
l.error_kind,
@@ -183,6 +206,7 @@ impl PostgresRegistry {
l.tool_name,
l.message,
l.request_id,
l.trace_id,
l.status_code,
l.duration_ms,
l.error_kind,