Sample
tracing 0.1.41: tracing::Event
Verified sample for cargo tracing 0.1.41: tracing::Event. The contract ran on rust 1 · linux alpine/x64 · docker and passed: Event::metadata returns the…
sha256:43d4efa09a16fa94a055db3ea123dd22dd5a84776bb8d86eabf15495b447a3d8
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux x64 cargo
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| rust 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · cargo@1rust:1-alpine@sha256:a10e64dd139b… |
2026-11-02 |
Case
HOW- Goal
- verify tracing::Event in pkg:cargo/tracing@0.1.41
- Packages
- Symbols
-
- tracing::Event
- Created
- 2026-11-02T14:55:45Z
Contract
- Event::metadata returns the event Metadata including its Level and target
- Event::fields iterates over defined field descriptors and Event::record visits field values via tracing::field::Visit
- Event::is_contextual, Event::is_root, and Event::parent distinguish contextual events, explicit root events (parent: None), and events with an explicit parent span Id
Files
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- src/main.rs
- test/contract.rs
Source
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "once_cell"
version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "pin-project-lite"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "proc-macro2"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
dependencies = [
"proc-macro2",
]
[[package]]
name = "sample-tracing-event"
version = "0.1.0"
dependencies = [
"tracing",
]
[[package]]
name = "syn"
version = "2.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tracing"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
dependencies = [
"once_cell",
]
[[package]]
name = "unicode-ident"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
[package]
name = "sample-tracing-event"
version = "0.1.0"
edition = "2021"
[dependencies]
tracing = "=0.1.41"
[[test]]
name = "contract"
path = "test/contract.rs"
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify tracing::Event in pkg:cargo/tracing@0.1.41
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/tracing@0.1.41
Demonstrate these symbols/APIs:
- tracing::Event
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:f9c3d7640a68a18bdda3f68b8dfc97d271c36cf2916468523ec5621ccb8da44c","contract":["Event::metadata returns the event Metadata including its Level and target","Event::fields iterates over defined field descriptors and Event::record visits field values via tracing::field::Visit","Event::is_contextual, Event::is_root, and Event::parent distinguish contextual events, explicit root events (parent: None), and events with an explicit parent span Id"],"goal":"verify tracing::Event in pkg:cargo/tracing@0.1.41","kind":"HOW","packages":["pkg:cargo/tracing@0.1.41"],"schemaVersion":1,"symbols":["tracing::Event"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/tracing@0.1.41"],"schemaVersion":1,"subject":"pkg:cargo/tracing@0.1.41","symbols":["tracing::Event"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify tracing::Event in pkg:cargo/tracing@0.1.41",
"kind": "HOW",
"packages": [
"pkg:cargo/tracing@0.1.41"
],
"symbols": [
"tracing::Event"
]
}
use std::sync::{Arc, Mutex};
use tracing::field::{Field, Visit};
use tracing::span::{Attributes, Id, Record};
use tracing::{Event, Level, Metadata, Subscriber};
#[derive(Default)]
struct FieldRecorder {
fields: Vec<(String, String)>,
}
impl Visit for FieldRecorder {
fn record_debug(&mut self, field: &Field, value: &dyn std::fmt::Debug) {
self.fields
.push((field.name().to_string(), format!("{:?}", value)));
}
fn record_str(&mut self, field: &Field, value: &str) {
self.fields
.push((field.name().to_string(), value.to_string()));
}
fn record_i64(&mut self, field: &Field, value: i64) {
self.fields
.push((field.name().to_string(), value.to_string()));
}
}
#[derive(Clone, Default)]
pub struct CapturedEvent {
pub level: Option<Level>,
pub target: String,
pub is_root: bool,
pub is_contextual: bool,
pub parent_id: Option<u64>,
pub field_names: Vec<String>,
pub recorded_fields: Vec<(String, String)>,
}
struct EventCapSubscriber {
events: Arc<Mutex<Vec<CapturedEvent>>>,
}
impl Subscriber for EventCapSubscriber {
fn enabled(&self, _metadata: &Metadata<'_>) -> bool {
true
}
fn new_span(&self, _span: &Attributes<'_>) -> Id {
Id::from_u64(42)
}
fn record(&self, _span: &Id, _values: &Record<'_>) {}
fn record_follows_from(&self, _span: &Id, _follows: &Id) {}
fn event(&self, event: &Event<'_>) {
let mut recorder = FieldRecorder::default();
event.record(&mut recorder);
let field_names = event.fields().map(|f| f.name().to_string()).collect();
let captured = CapturedEvent {
level: Some(*event.metadata().level()),
target: event.metadata().target().to_string(),
is_root: event.is_root(),
is_contextual: event.is_contextual(),
parent_id: event.parent().map(|id| id.into_u64()),
field_names,
recorded_fields: recorder.fields,
};
self.events.lock().unwrap().push(captured);
}
fn enter(&self, _span: &Id) {}
fn exit(&self, _span: &Id) {}
}
pub fn verify_tracing_event() -> Vec<CapturedEvent> {
let events = Arc::new(Mutex::new(Vec::new()));
let subscriber = EventCapSubscriber {
events: Arc::clone(&events),
};
tracing::subscriber::with_default(subscriber, || {
tracing::info!(target: "custom_target", count = 3_i64, label = "contextual_check", "contextual event");
tracing::info!(parent: None, code = 7_i64, "root event");
let explicit_id = Id::from_u64(99);
tracing::warn!(parent: &explicit_id, "explicit parent event");
});
let captured = events.lock().unwrap().clone();
assert_eq!(captured.len(), 3);
// 1. Contextual event
assert_eq!(captured[0].level, Some(Level::INFO));
assert_eq!(captured[0].target, "custom_target");
assert!(captured[0].is_contextual);
assert!(!captured[0].is_root);
assert_eq!(captured[0].parent_id, None);
assert!(captured[0].field_names.contains(&"count".to_string()));
assert!(captured[0].field_names.contains(&"label".to_string()));
assert!(captured[0]
.recorded_fields
.contains(&("count".to_string(), "3".to_string())));
assert!(captured[0]
.recorded_fields
.contains(&("label".to_string(), "contextual_check".to_string())));
// 2. Root event
assert_eq!(captured[1].level, Some(Level::INFO));
assert!(captured[1].is_root);
assert!(!captured[1].is_contextual);
assert_eq!(captured[1].parent_id, None);
assert!(captured[1]
.recorded_fields
.contains(&("code".to_string(), "7".to_string())));
// 3. Explicit parent event
assert_eq!(captured[2].level, Some(Level::WARN));
assert!(!captured[2].is_root);
assert!(!captured[2].is_contextual);
assert_eq!(captured[2].parent_id, Some(99));
captured
}
fn main() {
let captured = sample_tracing_event::verify_tracing_event();
println!("Verified {} tracing::Event instances", captured.len());
}
#[test]
fn contract_tracing_event() {
let captured = sample_tracing_event::verify_tracing_event();
assert_eq!(captured.len(), 3);
}
Origin Seeder
anonymous