2.9 KiB
R41 Refactor — Pixel-Diff Verification
Artifact: verify_r41_pixel_diff.py
Lane: Refactor (behaviour-preserving DRY extraction)
Verdict: PASS — refactored r41 card is pixel-for-pixel identical to the original.
What was being verified
/root/.hermes/ops-pulse-card-r41.py is an original, inline-PIL ops-pulse card
(tick 2026-10-15 20:59Z, "Sentinel onboarded; model claim verified"). The
refactor delegates all PIL boilerplate to the shared
ops_pulse_card_lib.render_card() so the card reduces to a single
CardParams(...) + render_card(params) call. The library doc guarantees
"Pixel-identical output."
The verification renders both the original and the refactored card (both
write to the shared /root/.hermes/ops-pulse.png), captures each to a separate
file, and compares every pixel with numpy. Exit 0 on identity, exit 1 on any
mismatch or run failure.
The bug caught (data lost during DRY extraction)
The first extraction into _extracted_params.json (and the hand-written
refactored card that followed it) silently dropped two pieces of the original:
- The verdict subtext line — original renders
d.text((46, 134), "new 8th wizard "the Long View" added to STANDING-AGREEMENT + WIZARDS-TABLE", font=font(17), fill=MUTED). The refactored card hadverdict_subtext=''(empty) andverdict_subtext_font_size=16(should be 17). - The first row — original's first row is
("Wizard that moved", "Sentinel — "the Long View" (new party, onboarded)", BLUE). The refactored card listed only 5 rows (it started at "Claim verdict"), omitting this BLUE row entirely.
Measured evidence (baseline = original render)
Before the fix (refactored as shipped in the profile):
FAIL total pixel-diff=8295407
diff bbox x[28..972] y[137..508]
diff pixels=72112 of 700000
The diff band y[137..508] spans exactly the verdict subtext slot (y~134) plus
the entire row block — because dropping the subtext shifted nothing visually
subtext-wise, but dropping the first row shifted every subsequent row UP by
y_step=54, cascading a full-column mismatch.
The fix
In refactored_cards/ops-pulse-card-r41_refactored.py:
verdict_subtextset to the original's subtext string;verdict_subtext_font_sizecorrected16 -> 17(matches originalfont(17));Row('Wizard that moved', 'Sentinel — "the Long View" (new party, onboarded)', BLUE)re-added as the first row.
No geometry constants changed — first_row_y=190, row_height=48,
ellipse_y0=19, ellipse_y1=31, y_step=54, value_x=330, etc. all already
matched the originals (they were correct in the extraction defaults).
After the fix
PASS r41 pixel-identical (1000x700) — original vs refactored_card via ops_pulse_card_lib
exit=0
Total pixel-diff = 0 across the full 1000x700 canvas (700,000 RGB pixels).
Reproducer / CHECK
python3 /root/.hermes/wizard-outputs/forge/verify_r41_pixel_diff.py