| 170 | |
| 171 | |
| 172 | def summary(result, meta): |
| 173 | g = result["graph"] |
| 174 | whole = sum(1 for v in result["suites"].values() if v == "ALL") |
| 175 | tests = sum(len(v) for v in result["suites"].values() if v != "ALL") |
| 176 | lines = ["### Test-impact shadow (report-only, never gates)", "", |
| 177 | "| | |", "|---|---|", |
| 178 | f"| selector | {result['selector']['tier']} (full: {'yes' if result['selector']['full'] else 'no'}) |", |
| 179 | f"| prediction | **{result['mode']}**: {result['selected_suites']} of {result['universe']} " |
| 180 | f"suites ({whole} whole, {tests} tests in the rest) |"] |
| 181 | if g.get("consulted"): |
| 182 | lines.append(f"| graph | {g.get('impacted_shown')} of {g.get('impacted_total')} impacted rows at " |
| 183 | f"depth {result['depth']}, {g.get('test_rows')} test rows" |
| 184 | f"{', saturated' if g.get('saturated') else ''} |") |
| 185 | for key in sorted(meta): |
| 186 | lines.append(f"| {key} | {meta[key]} |") |
| 187 | if result["reasons"]: |
| 188 | lines += ["", "Reasons: " + "; ".join(result["reasons"][:12])] |
| 189 | if result["mode"] == "graph" and result["suites"]: |
| 190 | lines += ["", "Suites: " + ", ".join(result["suites"])[:1500]] |
| 191 | return "\n".join(lines) + "\n" |
| 192 | |
| 193 | |
| 194 | def main(): |