| 554 | } |
| 555 | |
| 556 | fn prepare_review(f: &Fixture, source_intent: &str) -> String { |
| 557 | let opened: serde_json::Value = |
| 558 | serde_json::from_str(&f.run(&["review", "publish", "--source", source_intent, "--json"])) |
| 559 | .unwrap(); |
| 560 | let review = opened["review"]["intent"].as_str().unwrap(); |
| 561 | let review_path = f |
| 562 | .root() |
| 563 | .join(".vault") |
| 564 | .join(opened["review"]["path"].as_str().unwrap()); |
| 565 | let mut prepared = String::new(); |
| 566 | for line in fs::read_to_string(&review_path).unwrap().lines() { |
| 567 | let human = line.contains("-ac-approval ") |
| 568 | || line.contains("-task-approval ") |
| 569 | || line.contains("-ac-finding-") |
| 570 | || line.contains("-task-finding-"); |
| 571 | let line = if line.starts_with(":::acceptance-criterion") && !human { |
| 572 | line.replace( |
| 573 | "status=unmet", |
| 574 | "status=met verifiedBy=fixture evidence=assessed-retained-report", |
| 575 | ) |
| 576 | } else if line.starts_with("::review-card{") { |
| 577 | line.replace("outcome=pending", "outcome=met rationale=\"Inspected this exact criterion against recorded source\" evidence=\"retained greeting source and card\"") |
| 578 | } else if line.starts_with(":::task") && !human { |
| 579 | line.replace("status=open", "status=done") |
| 580 | } else { |
| 581 | line.to_string() |
| 582 | }; |
| 583 | prepared.push_str(&line); |
| 584 | prepared.push('\n'); |
| 585 | } |
| 586 | fs::write(review_path, prepared).unwrap(); |
| 587 | f.run(&["vault", "sync"]); |
| 588 | review.to_string() |
| 589 | } |
| 590 | |
| 591 | #[test] |
| 592 | fn human_only_review_approval_and_native_insertion_create_no_agent_session() { |