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

Function build_fixture

eval/run_real_model.py:286–313  ·  view source on GitHub ↗
(scenario, tracedecay_bin, env)

Source from the content-addressed store, hash-verified

284
285
286def build_fixture(scenario, tracedecay_bin, env):
287 fixture = Path(tempfile.mkdtemp(prefix=f"tracedecay-eval-{scenario['id']}-"))
288 (fixture / "src").mkdir()
289 (fixture / "src/lib.rs").write_text("pub fn eval_fixture_marker() {}\n")
290 for name, contents in scenario["setup"].get("files", {}).items():
291 (fixture / name).write_text(contents)
292 run([tracedecay_bin, "init"], cwd=fixture, env=env, timeout=300)
293 for fact in scenario["setup"].get("facts", []):
294 args = json.dumps(
295 {"action": "add", "content": fact["content"], "category": fact["category"]}
296 )
297 run(
298 [tracedecay_bin, "tool", "fact_store", "--args", args],
299 cwd=fixture,
300 env=env,
301 timeout=120,
302 )
303 db_path = resolve_store_db_path(tracedecay_bin, fixture, env)
304 db = sqlite3.connect(db_path)
305 with db:
306 for fact in scenario["setup"].get("facts", []):
307 db.execute(
308 "UPDATE memory_facts SET trust_score = ?, retrieval_count = ?, source = ? "
309 "WHERE content = ?",
310 (fact["trust"], fact["retrieval_count"], fact["source"], fact["content"]),
311 )
312 db.close()
313 return fixture, db_path
314
315
316def provider_env_passthrough(env):

Callers 1

mainFunction · 0.70

Calls 4

resolve_store_db_pathFunction · 0.85
runFunction · 0.70
connectMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected