hil: harness follow-ups from #4594 (park refusal race, interrupted notice, runner stop)

Aperta
#4,601 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
github-actions, python
Ambito
testing

Direzione di ricerca

Start in test/hil/hil_test.py at _should_park/_park_refusal and their callers _sysview_capture/_board_battery, then _abort_report/_already_aborted in helper/hil_report.py, _BoardProcess.ended/_stop_boards, _died_row, and _retain in helper/farm_profile.py; line numbers are offset by a few dozen. Reproduce each with the in-process stubs the report describes before editing, and note item 5 asks for an interrupt-policy decision rather than a patch. Done means one refusal string drives both decision and message, termination is matched from the recorded signal, lingering-but-finished rows survive, and test_hil_flash.OpenocdEsp stops leaving /tmp/tinyusb-hil-locks fixtures behind.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

follow-up Prio 📌

These come from the audit record refresh for #4542, which reviewed #4594 (490eb4ec9..17301f1a6). Claude and Codex each checked the other's findings, and each item below was reproduced in-process with stubs. Nothing was run on a rig. The audit's own harness commits do not touch any of these paths. Line numbers are at 17301f1a6 plus the audit commits, so they are a few dozen lines off in hil_test.py.

Defects

  1. SystemView capture can skip the park checks (test/hil/hil_test.py _should_park / _park_refusal, used in _sysview_capture and _board_battery):
    • The two functions re-read the openocd_esp pending record separately.
    • pending_refusal() clears entries that have ended. So when an older run's record clears between the two calls, the reason comes back empty. The park then reports not parked: with no cause.
    • In _sysview_capture, that empty reason falls past the elif/else that holds the park-image and remaining-time checks, so the capture runs without them.
    • Fix: compute one refusal string ('' means park) and use it for both the decision and the message.
  2. An interrupted run's notice gets overwritten (hil_test.py _abort_report with helper/hil_report.py _already_aborted):
    • The banner reads **HIL run interrupted by SIGTERM.**, but _already_aborted() matches only the **HIL run ab prefix.
    • So an accumulating no-boards re-run replaces both the caveat and the termination with no-boards.
    • Fix: match on the recorded termination instead of the caveat text.
  3. A finished row is lost when its process outlives the stop grace (hil_test.py _BoardProcess.ended / _stop_boards):
    • b.result is filled at pipe EOF, but a board only counts as ended once its sentinel fires.
    • A board that has written its row and then lingers (an atexit handler or a non-daemon thread) goes to _left_running. Its row is dropped and _abort_report lists it as never reported.
    • Fix: keep the row, and also report that the process survived.
  4. A real-time signal aborts the whole run (hil_test.py _died_row): signal.Signals(-exitcode) raises ValueError for SIGRTMIN+n, which escapes run_boards. Fix: fall back to signal {n}.
  5. A second SIGINT can skip stopping the boards (hil_test.py run_boards finally):
    • The window is short: before _stop_boards()'s _interrupts_ignored() takes effect.
    • In that window, a second SIGINT escapes without stopping the boards or registering survivors.
    • Moving the context manager alone does not close every entry window, so the parent's interrupt policy needs a decision.
  6. An agentrc identity error can hide the reset's own failure (helper/farm_profile.py _retain):
    • _retain runs in reset's finally, and its _engine() reload can raise when agentrc's source identity changes mid-reset.
    • That error replaces the reset's own exception and loses its .operation.
    • Fix: keep both failures, without suppressing the identity error.
  7. Minor:
    • _frame_result turns an unpickle failure into a generic "died (exit code 0)" row; put the decode error in the cell.
    • .github/workflows/pr_comment.yml:311-315 still says the code-size comment reports a failed agentrc fetch, but a missing agentrc now fails the freshness check and posts nothing, which is intended. Drop the stale comment and the redundant continue-on-error.

Cleanups

  • An explicit agentrc engine API for unresolved evidence (ctx.retain_unproven or similar), so farm_profile._retain stops appending rows to the engine-private ctx.ledger. This needs an agentrc change.
  • .claude/skills/hil-contract/SKILL.md:215: keep tinyusb's obligations (which entry points refuse, when to stop the board, what the cell shows) and link agentrc's hil Flashers and Recovery sections for the pending record's mechanics.

Test isolation (pre-existing)

test_hil_flash.OpenocdEsp writes a fake pending record (usj-30_ED_A0_E0_C9_02.openocd-esp-pending.json, token t0k) into the real /tmp/tinyusb-hil-locks, so the next hil-test run fails two OpenocdEsp tests. This was observed on master 490eb4ec9: a clean run leaves the file behind, and the next run fails.

Lingua principale
C
Stelle
7.3k
Fork
1.6k
Merge medio
1g 19h
PR unite (30g)
67

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hathach/tinyusb

Tutte le issue di hathach/tinyusb

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.