(scenario, tracedecay_bin, env)
| 284 | |
| 285 | |
| 286 | def 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 | |
| 316 | def provider_env_passthrough(env): |
no test coverage detected