Skip to content

Keep the test report on the panel until it is explicitly cleared - #38

Open
the-real-orca wants to merge 2 commits into
SensorsIot:mainfrom
the-real-orca:feat/test-clear
Open

the-real-orca wants to merge 2 commits into
SensorsIot:mainfrom
the-real-orca:feat/test-clear

Conversation

@the-real-orca

Copy link
Copy Markdown

Keep the test report on the panel until it is explicitly cleared

Base: SensorsIot/Embedded-AI-Harness main (b7bc87e) · Head: feat/test-clear
Diff: 6 files, +177 / −11 · extends FR-019
Commits: the feature (+163 / −7) and one cosmetic follow-up that aligns the activity log panel with the rest of the page (+14 / −4) — separable, drop it if you'd rather not carry it.


Why

POST /api/test/update {"end": true} discards the session outright. The operator turns to the panel after a suite exits and finds "No test session active" — the pass/fail list is gone, with no way to get it back. The report is most useful exactly when the run is over.

What changed

The session now survives its own end and is discarded on request instead.

  • end marks rather than deletes — sets ended: true and ended_at; the session also gains started_at. Any later update re-opens it.
  • DELETE /api/test/progress clears the report. Refused with 400 while a session is still running, so a live run cannot be wiped by a stray click.
  • UI — a Clear button at the bottom left of the Test Progress panel, enabled only once the session has ended, plus a banner saying the report is being held. Heading and button follow the shape every other panel on the page already uses: centred h2 above the box, actions bottom left, and one shared rule for the button so it cannot drift from the log's Clear.
  • Driver — test_progress() and test_clear().
  • FSD — FR-019 gains the endpoint, the persistence rule and the session-state field table.
  • Test — test_test_report_survives_its_own_end in TestApiSurface (104 → 105). It skips if a session is in progress rather than clobbering it.
  • bench_reset() still nulls the session unconditionally, which stays correct: that is the start of a run, where discarding is the point.

Contract change

test_end() on a bench with no session now returns 400 {"ok": false, "error": "no active session"} instead of {"ok": true}. The only caller in the suite, _end_test_session, already wraps it in try/except, so nothing breaks.

Verification

ruff check clean · py_compile OK · 105 tests collected · pytest/host 22 passed · all touched files LF.

Verified on hardware, 2026-09-09. Bench esp32-workbench: Raspberry Pi 3 Model B Rev 1.2, Debian 13 trixie, Python 3.13.5, this branch installed from a fresh SD image via pi/install.sh.

the-real-orca and others added 2 commits September 8, 2026 14:57
`end` discarded the session, so the panel showed "No test session active"
the moment a suite exited. The pass/fail list the operator had been
watching was gone with no way back, and the report is most useful exactly
when the run is over.

`end` now marks the session `ended` and records `ended_at`; a later update
re-opens it. DELETE /api/test/progress discards it, refused with 400 while
a session is still running, so a live run cannot be wiped by a stray
click. The panel gains a Clear button, enabled only once the session has
ended. bench_reset() still nulls the session outright, which stays right:
that is the start of a run.

Driver: test_progress() and test_clear(). FSD: FR-019 gains the endpoint,
the persistence rule and the session-state field table. New test
test_test_report_survives_its_own_end, which skips rather than clobbers
when a session is in progress.

test_end() on a bench with no session now answers 400 instead of ok:true.
The only caller in the suite already wraps it, but it is a contract change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Of the four panels on the page the log was the only one whose heading sat
*inside* the box, in grey 1.1em instead of the cyan centred h2 the signal
generator, the SDR console and the test panel all use. Nothing needed it
that way — it was simply never aligned.

The heading moves out of the box, which needs a box to move out of: the
styling goes to a new .log-box and .log-section keeps only the flex column,
so the chain section -> box -> entries is intact and the log still takes
whatever height is left on the page. The h2 override shrinks to the one
declaration that is about layout rather than looks.

Cosmetic only. No endpoint, no behaviour, no FSD clause touched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant