Lint the commits being pushed and scope overlay failures per sensor

The pre-push gate linted only the dirty tree, so the commits about to be pushed went
unchecked; and every failed overlay projection was sticky, which cost a finger result its
overlay over one bad frame while box results were retried nowhere. gate.ps1 now takes
-LintBase (default origin/main, exit 2 on an unknown ref), the projector declares whether
its own failures are permanent, and serve_stored_view decides before it sets the view.
Verified with gate.ps1 (PASS: 569 studio + 485 shared tests, 632 ui_check checks) and the
two round-2 red samples kept in scratch.
This commit is contained in:
ykcheungab
2026-10-18 21:17:03 +08:00
parent 0998009ec3
commit c37efd7a44
9 changed files with 648 additions and 260 deletions
+58
View File
@@ -772,3 +772,61 @@ def test_a_bare_video_with_a_declined_prompt_promises_no_pass(
)
assert t(RAW_NOTE_KEY) not in window.arrow_panel.note_label.text()
assert plan_image(captured[-1]).note_key == "panels.replay_analysis_failed"
def test_adopting_a_box_result_never_flashes_the_overlay_refusal(
window, stored_recording, monkeypatch
):
"""R3: pick the drawable view once, draw once, and never show the refusal on the way.
The box result has no stored unroll map and its stitch rebuild fails on this footage,
so the overlay base cannot be built. The pre-rework order — set the overlay view,
render, discover the failure, switch, render again — put
``panels.arrow_capture_unavailable`` on screen while adopting the result, and drew the
same frame twice. The decision is now made before the view is set, so the panel is set
once and rendered once, and the refusal is still what the operator gets when they ask
for the overlay themselves.
"""
from orisys_app_shared.i18n import t
controller = window.replay_ctl
refusal = t("panels.arrow_capture_unavailable")
seen: list[str] = []
renders: list[int] = []
inside = {"serve": False}
original_render = controller.render_frame
def render_spy():
if inside["serve"]:
renders.append(1)
original_render()
seen.append(window.arrow_panel.image_label.text())
else:
original_render()
original_serve = controller.serve_stored_view
def serve_spy():
inside["serve"] = True
try:
return original_serve()
finally:
inside["serve"] = False
monkeypatch.setattr(controller, "render_frame", render_spy)
monkeypatch.setattr(controller, "serve_stored_view", serve_spy)
_open(window, stored_recording, monkeypatch)
assert inside["serve"] is False, "adoption never reached the view it serves"
assert len(renders) == 1, f"adoption rendered the frame {len(renders)} times, not once"
assert refusal not in seen, "the overlay refusal was shown while adopting the result"
assert controller._image_panel.view_mode() == ARROW_PURE, (
"a result whose overlay cannot be drawn was adopted on the overlay view"
)
# The overlay is still on offer, and choosing it still says why it cannot be drawn.
controller._image_panel.set_view_mode(ARROW_STITCHED)
controller.render_frame()
assert window.arrow_panel.image_label.text() == refusal