fix(maintenance): list each prompt the Pair repair kept (#550)

The job counted its protected prompts but listed none, so Protected 2 opened
an empty group. The apply now returns one row per kept prompt with the
review's reasons, in its order ("Prompt 7: kept, pairs disagree on category:
Adult, asian"), and the job keeps them all for the report.
This commit is contained in:
Vito Sansevero
2026-10-31 17:27:00 -07:00
parent d4508c9997
commit 0504e67fd3
6 changed files with 132 additions and 4 deletions
+13 -1
View File
@@ -697,7 +697,19 @@ class MaintenanceRoutesMixin:
rows,
complete=plan.operation in COMPLETE_RECORD,
)
job.record_counted("protected", payload["protected"])
if "kept" in result:
# #550: each kept record with its reason, like the changed ones.
kept = [
{
"path": "",
"detail": f"Prompt {item['prompt_id']}: kept, "
+ "; ".join(item["reasons"]),
}
for item in result["kept"]
]
job.record_counted("protected", len(kept), kept, complete=True)
else:
job.record_counted("protected", payload["protected"])
line = _changed_line(
plan.operation, result["changed"], result.get("marks", 0), result
)