MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / post_rewrite_event_capture_token

Function post_rewrite_event_capture_token

atomic-core/src/operation/mod.rs:698–709  ·  view source on GitHub ↗

The operation capture token carried by post-rewrite event bytes (review E2), or `None` when the bytes carry no capture token. Bare Git ` ` wire pairs never carry a token. The durable JSON evidence record the hook journals during a prepared operation's capture context carries the minted token in its `capture_token` field. Anchoring compares this token against the operation's minted conte

(bytes: &[u8])

Source from the content-addressed store, hash-verified

696/// compares this token against the operation's minted context, so only a
697/// capture produced within the prepared operation can bind to it.
698pub fn post_rewrite_event_capture_token(bytes: &[u8]) -> Option<String> {
699 let record: serde_json::Value = serde_json::from_slice(bytes).ok()?;
700 if record.get("record_type").and_then(|v| v.as_str()) != Some("post-rewrite") {
701 return None;
702 }
703 let token = record.get("capture_token")?.as_str()?;
704 if token.is_empty() {
705 None
706 } else {
707 Some(token.to_string())
708 }
709}
710
711/// Whether a Git-ref effect lease value equals the parsed OID (an all-zero
712/// OID matches the absent lease, matching Git's zero-OID ref conventions).

Calls 4

getMethod · 0.65
okMethod · 0.45
as_strMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected