feat(review): walkthrough/risk_verdict/test_coverage schema
This commit is contained in:
@@ -905,6 +905,26 @@ def synthesize(
|
||||
return deduped[:per_pr_cap]
|
||||
|
||||
|
||||
def _synthesize_summary_fields(
|
||||
findings: list[dict],
|
||||
diff: str,
|
||||
changed_paths: list[str] | None = None,
|
||||
) -> tuple[list[str], str, str]:
|
||||
"""Synthesize review-level meta from the merged findings + diff.
|
||||
|
||||
Returns (walkthrough, risk_verdict, test_coverage) — the three new
|
||||
top-level fields in the pragent review JSON shape
|
||||
(`ai_review.parse_review_output` extracts them as the 5th, 6th, and
|
||||
7th tuple elements, defaulting to `[]` / `""` when missing).
|
||||
|
||||
STUB for Task 7. The real implementation arrives in Task 8; for now
|
||||
every return is empty so the synthesized JSON shape stays parseable
|
||||
and downstream tests that default the new fields to `[]` / `""`
|
||||
continue to pass.
|
||||
"""
|
||||
return [], "", ""
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Per-lens subprocess + parallel fan-out
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -1304,10 +1324,25 @@ def run_lenses_review(
|
||||
{k: v for k, v in f.items() if not k.startswith("_")}
|
||||
for f in merged
|
||||
]
|
||||
# Synthesize the review-level meta (walkthrough / risk_verdict /
|
||||
# test_coverage) from the merged findings + diff. Real implementation
|
||||
# arrives in Task 8; the stub keeps the synthesized JSON shape stable
|
||||
# so ai_review.parse_review_output can extract the three new fields
|
||||
# (it defaults them to [] / "" when missing — backward compatible).
|
||||
walkthrough, risk_verdict, test_coverage = _synthesize_summary_fields(
|
||||
merged, diff, changed_paths=changed_paths,
|
||||
)
|
||||
synthesized_payload = {
|
||||
"summary": summary,
|
||||
"walkthrough": walkthrough,
|
||||
"risk_verdict": risk_verdict,
|
||||
"test_coverage": test_coverage,
|
||||
"findings": clean_findings,
|
||||
}
|
||||
text = (
|
||||
f"{summary}\n\n"
|
||||
f"## Findings (multi-lens)\n\n"
|
||||
f"```json\n{json.dumps({'summary': summary, 'findings': clean_findings}, indent=2)}\n```\n"
|
||||
f"```json\n{json.dumps(synthesized_payload, indent=2)}\n```\n"
|
||||
)
|
||||
if merged_usage is not None:
|
||||
merged_usage["duration_s"] = round(time.monotonic() - t0, 1)
|
||||
|
||||
Reference in New Issue
Block a user