MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / args_hash

Function args_hash

src/context/read_cache.rs:41–46  ·  view source on GitHub ↗

Computes a stable hash of the per-call arguments that affect output. Used as the `args_hash` cache-key component so two calls with different `lines` or `limit` values map to distinct rows.

(args: &serde_json::Value)

Source from the content-addressed store, hash-verified

39/// as the `args_hash` cache-key component so two calls with different `lines`
40/// or `limit` values map to distinct rows.
41pub fn args_hash(args: &serde_json::Value) -> String {
42 let canonical = canonicalize(args);
43 let mut hasher = Sha256::new();
44 hasher.update(canonical.as_bytes());
45 hex::encode(hasher.finalize())
46}
47
48/// Sorts JSON object keys recursively so two semantically-equal arg objects
49/// hash identically regardless of key insertion order.

Callers 1

handle_readFunction · 0.85

Calls 1

canonicalizeFunction · 0.85

Tested by

no test coverage detected