upravy skillu
This commit is contained in:
@@ -604,8 +604,18 @@ def _is_stale(finding: Finding, stats: dict[str, Any]) -> bool:
|
||||
return bool(window_from) and finding.last_seen < window_from
|
||||
|
||||
|
||||
def _report_order(finding: Finding) -> tuple[bool, bool, int]:
|
||||
"""Open first, then regressions, then severity — see render_report for why regressions win."""
|
||||
return finding.status != STATUS_OPEN, finding.regression_of is None, SEVERITIES.index(finding.severity) * -1
|
||||
|
||||
|
||||
def render_report(merged: list[Finding], stats: dict[str, Any], previous_rate: float | None, when: datetime) -> str:
|
||||
"""The dated results/ report — the human-readable record behind the Telegram one-liner."""
|
||||
"""The dated results/ report — the human-readable record behind the Telegram one-liner.
|
||||
|
||||
Regressions come before severity: the model re-guesses `severity` every run and it drifts on
|
||||
the same pattern, while `regression_of` is a fact from the audit — a fix that already failed
|
||||
once belongs at the top whatever today's guess says.
|
||||
"""
|
||||
lines = [
|
||||
f"# Self-reflection {when:%Y-%m-%d}",
|
||||
"",
|
||||
@@ -621,7 +631,7 @@ def render_report(merged: list[Finding], stats: dict[str, Any], previous_rate: f
|
||||
lines.append("Nothing to report.")
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
for finding in sorted(merged, key=lambda f: (f.status != STATUS_OPEN, SEVERITIES.index(f.severity) * -1)):
|
||||
for finding in sorted(merged, key=_report_order):
|
||||
flag = " — REGRESSION" if finding.regression_of else ""
|
||||
if _is_stale(finding, stats):
|
||||
flag += " — STALE"
|
||||
|
||||
Reference in New Issue
Block a user