MCPcopy Create free account
hub / github.com/AIScientists-Dev/Flowtrace / validate_trace_id

Function validate_trace_id

crates/flowtrace-core/src/validate.rs:109–117  ·  view source on GitHub ↗

Slug-shape check for a candidate trace id. Same rule used by `validate` for `Trace.id`, exposed standalone so callers (e.g. `trace init`) can reject bad ids without constructing a full `Trace`.

(id: &str)

Source from the content-addressed store, hash-verified

107/// for `Trace.id`, exposed standalone so callers (e.g. `trace init`) can
108/// reject bad ids without constructing a full `Trace`.
109pub fn validate_trace_id(id: &str) -> Result<()> {
110 if !trace_id_re().is_match(id) {
111 return Err(TraceError::Validation(format!(
112 "id `{}` must be a slug: start with a letter, then [a-z0-9-], 1–63 chars total",
113 id
114 )));
115 }
116 Ok(())
117}
118
119pub fn validate(r: &Trace) -> Result<()> {
120 validate_trace_id(&r.id)?;

Callers 2

cmd_initFunction · 0.85
validateFunction · 0.85

Calls 1

trace_id_reFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…