feat: harden community production foundation through story 1.5

This commit is contained in:
2026-08-14 00:21:59 +03:00
parent c30461cc92
commit f6fc2e5c9b
161 changed files with 16758 additions and 2515 deletions
@@ -132,11 +132,11 @@ fn correlation_fields_are_distinct_and_only_present_when_recorded() {
tracing::info!(
name: "admin.request.completed",
request_id = "req-123",
trace_id = "trace-456"
trace_id = "0af7651916cd43dd8448eb211c80319c"
);
});
assert_eq!(present[0]["request_id"], "req-123");
assert_eq!(present[0]["trace_id"], "trace-456");
assert_eq!(present[0]["trace_id"], "0af7651916cd43dd8448eb211c80319c");
assert!(present[0]["fields"].get("request_id").is_none());
assert!(present[0]["fields"].get("trace_id").is_none());
@@ -148,7 +148,7 @@ fn correlation_fields_are_distinct_and_only_present_when_recorded() {
}
#[test]
fn correlation_fields_preserve_scalar_display_values_before_field_limits() {
fn correlation_fields_accept_valid_strings_and_reject_non_string_values() {
let limits = RedactionLimits {
max_object_fields: 1,
..RedactionLimits::default()
@@ -164,7 +164,7 @@ fn correlation_fields_preserve_scalar_display_values_before_field_limits() {
});
assert_eq!(events[0]["request_id"], "123");
assert_eq!(events[0]["trace_id"], "true");
assert!(events[0].get("trace_id").is_none());
}
#[test]
@@ -321,7 +321,7 @@ fn subscriber_rejects_limits_that_cannot_hold_an_event() {
}
#[test]
fn minimum_event_budget_handles_maximum_identity_labels() {
fn event_budget_rejects_maximum_identity_labels_when_correlation_cannot_fit() {
let writer = SharedWriter::default();
let config = ObservabilityConfig::new(
ServiceIdentity::try_new("s".repeat(64), "v".repeat(64), "e".repeat(64))
@@ -332,20 +332,7 @@ fn minimum_event_budget_handles_maximum_identity_labels() {
..RedactionLimits::default()
},
);
let subscriber =
build_subscriber(config, writer.clone()).expect("minimum valid budget must be usable");
tracing::subscriber::with_default(subscriber, || {
tracing::info!(
name: "event-name-that-is-intentionally-longer-than-the-fallback-limit",
description = %"x".repeat(4096),
);
});
let output = writer.output();
assert!(output.len() <= 512);
assert_eq!(output.lines().count(), 1);
serde_json::from_str::<Value>(output.trim_end()).expect("bounded line must remain valid JSON");
assert!(build_subscriber(config, writer).is_err());
}
#[test]