Skip to content

Guard release workflows and verify the output is off - #23

Merged
PEEKPerformer merged 29 commits into
stack/20-desktopfrom
stack/21-ci-docs-and-output-state
Nov 16, 2026
Merged

PEEKPerformer merged 29 commits into
stack/20-desktopfrom
stack/21-ci-docs-and-output-state

Conversation

@PEEKPerformer

@PEEKPerformer PEEKPerformer commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Workflows: a bare v* tag push can no longer publish a release (uploads go only to an existing release; desktop bundles only on desktop-v* tags); the desktop app is built with a read-only token; the backend build fails if libusb ships unlicensed; the frozen-backend smoke test runs a measurement. User pages: docs/api.md, docs/desktop.md, docs/gpib.md, rewritten outputs/settings/troubleshooting, the changelog's Unreleased section. Two behaviour fixes with their docs: a run that cannot confirm :OUTP OFF says so (run_ended.output_verified, a banner in the desktop) and the next connection turns a doubtful output off; the PySide6 window writes its log file at last (nothing ever called setup_logging).

Stack

Part 21 of 28. Targets stack/20-desktop; PR 22 targets this branch. Merge bottom-up with Rebase and merge. This PR's tree is phase0/reviewable-baseline at 1435635, where the stack was first cut; PRs 22 to 27 carry the branch from there to its head.

PRs 14–21 are the branch's history after f3fd7d9 reordered by topic. Every commit is unchanged in content; only the order differs, and only where the reorder needed no conflict resolution.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing behavior to change)
  • Documentation only
  • CI / build / packaging only

Hardware testing

  • Tested against real hardware
  • Tested against software-only path
  • Not applicable

The output-left-on case was observed on a 2400 when the USB cable was pulled mid-run on 2026-09-21 (the instrument's output stayed on); the fix itself is tested against the simulator.

Test suite

  • QT_QPA_PLATFORM=offscreen pytest tests/ -v passes locally — 3207 passed, 48 skipped, 26 xfailed at this PR's head; CI green on the branch head (tests 8/8, desktop)
  • Added new tests for new behavior, or explained why none are needed

How to verify:

QT_QPA_PLATFORM=offscreen pytest tests/ -v
cd desktop && npm ci && npm test && npx tsc --noEmit

Checklist

  • My changes follow the existing code style
  • I have updated README.md / version history if user-visible
  • I have read the CONTRIBUTING guidelines

Both build workflows attached their output with
softprops/action-gh-release, which creates and publishes a release
when the tag has none. Releases here are made by hand, and a
published release is what Zenodo archives, so a tag pushed on its own
would have published one without its notes. One v* tag also started
three jobs that would race to create it, and the desktop bundle, whose
version is 2.0.0-1, would have attached itself to the next v1.x
release of the PySide6 application.

All attaching now goes through `gh release upload --clobber`, which
fails when the release does not exist. The tag triggers stay, in
preference to `release: published`, so the order of work is
unchanged: push the tag, create the release, and the build that the
tag started uploads to it. A job that finds no release says to create
it with gh release create and to re-run the job.

The desktop workflow now builds for desktop-v* tags only, so a v* tag
never builds or receives a desktop bundle, and it refuses a tag that
is not desktop-v<the version in tauri.conf.json> before building.
The PySide6 .exe is built and attached on v* tags as before.
The build job held contents: write on every run, branch pushes and
pull requests included, and checkout left that token in .git/config
while pip, npm, cargo build scripts and tag-pinned third-party
actions ran. Only the step that attaches bundles to a release ever
needed to write.

The build job is now contents: read and checks out without persisting
credentials. Attaching moved to a job of its own that runs for
desktop-v* tags only, after both platforms have built: it has the
write token, checks nothing out, downloads the bundle artifacts and
uploads them to the existing release, and it refuses unless an .msi,
an .exe and a .dmg are all there, so a release never gets half of its
bundles. A failed attach can be re-run without rebuilding.

The two third-party actions and the one action the write job uses are
pinned to commits, with the tag or branch they were read from in a
trailing comment.
The screenshot job checks out main, regenerates the screenshots and
pushes a commit to main for every v* tag, whichever branch the tag
was cut from. A tag on a migration branch would have committed to
main on the strength of a release main does not contain.

The commit step now first asks git whether the tagged commit is an
ancestor of the main it checked out, and leaves main alone when it is
not. Tags on main behave as before.
The smoke test checked the handshake, /health and the WebSocket
upgrade, none of which starts a run. PyInstaller only warns about a
hidden import it cannot find, so a bundle without h5py, or without
anything else a run imports late, built and passed; the first sign
would have been a run failing on the lab PC.

The step now starts a simulated resistance run through the API, stops
it after three samples, waits for file_finalized and checks the CSV
for its footer, then switches the profile to HDF5 and does the same,
checking the file's signature. A run that reports an error fails the
step with the error in the message. The backend now works in a
temporary directory, so the data files land outside the checkout.
The spec staged libusb's COPYING only when the build machine happened
to have it, and said nothing when it did not. Its docstring also
described bundling that does not happen: on Linux find_library
answers with a soname, so the spec bundles nothing there, while
PyInstaller's usb hook bundles a libusb of its own accord on every
platform, the second copy in the macOS bundle included. A bundle
could carry the LGPL library without the licence text and nothing
would notice.

The licence is now attached after the analysis, to whatever libusb it
collected, from the spec or from the hook, and the build stops with a
message naming the libraries when no licence text can be found. The
docstring says what is bundled on each platform and by whom. The CI
step that checks the bundled libusb loads also checks that every
libusb in the bundle has libusb-COPYING beside it, and that the macOS
bundle has one at all.
The outputs page still described the v1.12 files. Since then file
names keep their source value and gain a -2 suffix instead of
overwriting, resistance runs record the voltage limit the instrument
reports, API runs record their client, and four-point runs carry a
spot block, a statistics footer and a map summary. Anyone parsing the
files needs each of those keys defined.

The example header and footer come from a simulated four-point run
made in a temporary directory.

Correct three statements the code contradicts: rows are flushed every
auto-save interval, not as they arrive; the four-point header does not
list the F84 inputs; the format table named files that were never
written.
The settings page predates the VISA backend choice, the GPIB interface,
the sample outline a spot is checked against, and the per-source bounds
on a sweep's compliance. Give each its default and bounds as the schema
has them, say what machine-local means for a config file shared between
PCs, and how the outline keys relate to the legacy shape and diameter
that still drive the rows.

State where each can be set today: the PySide6 dialog has no field for
the backend or the interface, and neither UI has fields for the outline.
The touch-safety threshold is bounded at 200 V by the schema although
the PySide6 spin box goes to 1100 V; say so.
The sidecar, its handshake, the routes, the event stream and the
prompts were described only in design documents, and those no longer
match the code: there is no /api/v1 prefix, prompts are answered at
/session/prompt, sequence numbers start at 1, run ids are run-N, and
the history ring holds 10 000 events across runs. Someone scripting a
measurement needs the interface as it is.

The route list comes from the app's OpenAPI document and each status
code from a call against the simulator. The Python example was run
against the simulator as it appears on the page.

Record one thing found while testing: SIGTERM ends the sidecar without
stopping the run, so the page warns against kill and names the three
ordered ways to stop it.
The branch brought failures the page did not know: an empty scan on a
machine whose VISA library has no GPIB driver, a start refused by the
instrument lock, a desktop app whose backend is gone, a hung NI
adapter, a four-point spot refused as off the sample, and timeouts
that take 17 s when 5 s was asked. Each gets its symptom as the
operator sees it, the cause, and what to do.

The timeout entry rests on the adapter expiry measurements in the
protocol notes and says what they are: timed under NI's driver, not
re-timed through the built-in one.

Correct the catch-all: it pointed at a log file under ~/.resistamet
that nothing writes, because no entry point turns file logging on.
The concepts page described one application. The branch splits it into
a settings schema, a Qt-free run layer, a localhost API and the clients
over them, and makes a four-point spot part of the run's record. A
reader needs both ideas before the API, outputs and desktop pages make
sense, so they get a section each: the layers with a text diagram, and
the spot as a run with the map as the runs that share a map id.

Correct the compliance entries on the way. They said detection rests
on the status word, which the ohms function was found not to set; the
99 % test against the limit the instrument reports is what flags
resistance rows.

The index and the README gain links to the new pages and a short note
that the PySide6 window is still the released front end.
The Tauri app had a developer README and status notes but nothing for
the person at the bench: what each view offers, how to run it, where
its data, config and logs end up, and what happens to the instrument
when the window is closed.

The page describes what is merged today and says so. The four-point
map is drawn but the app cannot yet give a spot a position, the
"don't ask again" answer is not saved by the backend, and there is no
cable null; each is stated where an operator would look for it. The
per-user directories of an installed build are given as Tauri's
convention and marked as not checked on an installed build.
The page was a day old and already wrong in six places. /session/start
now takes the exported RunRequest, so an unknown field or mode is a
422; overrides are type-checked strictly and may not carry the
touch-safety keys; a profile PATCH merges per key, validates, and
knows 403 and 404; prompt ids carry their run id and a choice the
prompt did not offer is refused.

The SIGTERM warning goes: the sidecar now handles SIGTERM, SIGINT and
Ctrl-Break through the ordered shutdown, which a SIGTERM in the middle
of a simulated run confirmed.
The machine-local settings moved out of config.json into
~/.resistamet/machine.json, because a slot keyed by hostname stops
matching when macOS renames the machine. The page still described the
slot. Say where the file is, what that means for a config shared
between PCs, and how an old slot is carried over.

Also follow three smaller changes: the PySide6 dialog now has the
backend and interface rows and scans through them, the desktop app has
the sample outline fields, and the touch-safety threshold is bounded
at 1100 V in the schema as in the dialog.
Resistance runs in Auto range no longer judge compliance against the
limit read back at configure time, because auto-ohms moves its limit
with the ohms range and a healthy megohm DUT was being flagged on
every row. The header key differs too: manual range writes
effective.voltage_compliance_V, Auto range writes
effective.voltage_compliance_V_at_configure. Describe both keys and
both detection rules, and say that the simulator does not model
auto-ohms.
Since the page was written the app learned to ask before closing the
window stops a run, to report a backend process that has died and
offer to restart it, to place the next spot on the map, and to keep
tab values per operator; and the installers build for desktop-v tags
only. Describe each, and give the dead-backend alert its own
troubleshooting entry, since Retry no longer covers that case.
Four committed changes touched what the pages say. The scan and
identify routes now accept only the three named VISA backends, the
stored value, or a Prologix interface name as per-request overrides,
and a library path can be stored only by the ui role. A strict resolve
checks the file, output and display sections too. The desktop shell
honours RESISTAMET_PYTHON, RESISTAMET_SIMULATE and the checkout in
debug builds only, and shows a SIMULATED badge. A config save now
merges under an OS lock, so two programs on one PC keep each other's
edits; across a sync service the last sync still wins, and the page
says so.
A voltage limit that cannot be read back now leaves the effective key
out of the header and logs a warning, where the page said the request
was written in its place. The desktop prompt lost its "don't ask
again" box, the sweep view fits each leg without its compliance
points, and a strict resolve warns when a forced timing value replaces
an override.
When the link to the instrument died mid-run, the cleanup's :OUTP OFF
raised and all that recorded it was a generic "Error during instrument
cleanup" warning. The source stayed on, driving the sample, until the
next session happened to address the instrument, and nothing on screen
told the operator so.

The cleanup now writes :OUTP OFF and reads :OUTP? back. When the write
raises or the read-back is not 0, it warns with its own code,
output_unverified, in words an operator can act on, and run_ended
carries output_verified: false. The handle is closed even when the
output-off failed, which the single try block used to skip. A run that
never opened its instrument reports true: no output was ever on.

The van der Pauw run has the same cleanup and gets the same change, and
the session's last-resort run_ended for a dead run reads the flag its
cleanup set. The events contract and the desktop's generated types are
regenerated for the new field.
A run that ended with output_verified false left the instrument in a
state the session then forgot. Nothing turned the output off until the
next run happened to reset the instrument, and an identify from the
settings dialog, which sends no *RST, left it on with no word said.

The session now remembers the address whose output is in doubt. At the
next connection back to it the output goes off before anything else,
and the log says so with code output_off_recovered:

- A run's first write after *IDN? is already *RST, which leaves the
  output off on this family before any configuration, so no second
  command is added; the run is told to recover and logs the line right
  after the reset. A connect that fails keeps the doubt.
- identify sends :OUTP OFF as the first command after *IDN?, reads
  :OUTP? back, and logs the recovery only when the instrument answers
  0; otherwise it warns output_unverified again. Its log line has no
  run_id, since no run is in progress.

A clean run neither sets the flag nor claims a recovery, and identify
on a clean session still writes nothing.
When a run ended without confirming its output off, the desktop showed
the warning as one line in the status log, where it scrolled away with
the rest. An operator looking at the workspace had no sign that the
source might still be driving their sample.

The session store now keeps an outputUnverified flag, set by the
output_unverified warning or by a run_ended with output_verified false.
Each measurement view shows it as a persistent danger notice beside the
unreachable-backend one, with a Dismiss button. It clears when the
operator dismisses it, when the backend logs output_off_recovered (from
the next run or from an identify, which carries no run id), or when a
run reconnects to the instrument, whose reset leaves the output off. A
run that ended normally never raises it.
The GPIB, desktop and API pages existed but the site's navigation did
not name them, so a built site could only reach them by URL.
The status still listed the whole punch list and the 4PP spot model as
open. It now says what closed, what was only checked against the
simulator, and what waits on a decision.
The README told a Prologix owner the app could not open the adapter's
interface. It can now, so say where the setting is and what the three
name forms look like, and say as plainly that a run still does not
connect through it: connect looks for the address in the resource
list, and pyvisa-py lists nothing behind a Prologix adapter.

The status page gains the setting under "GPIB on a Mac" and replaces
the "Not yet" bullet with the two things left open, including that
none of this has been tried on a real adapter.
Four commit references predated this morning's history rewrite and
named hashes that are no longer on the branch.
The desktop UI has now driven the 2400 through the clean-room driver
on a Mac, and the day found three driver defects, a Settings dialog
crash and an output-left-on case after a cable pull.
With a megohm part the instrument ranges up and enforces 21 V while
the read-back taken at configure says 2.1 V; the rule that compares
samples against that read-back would have flagged a healthy part on
every row. The bench confirms the replacement rule reads OK.
The CI-built app, opened from its dmg, ran a resistance run and a
sweep on the 2400 through the bundled libusb and the clean-room driver;
the frozen backend also ran three more modes headlessly.
8551 samples through the frozen backend and the clean-room driver,
none lost, no fault; and the lost-link output policy now landed.
logging_config.setup_logging has been in the package since v1 and nothing
called it, so ~/.resistamet/logs/ never received a file and only warnings
reached the terminal, through Python's last-resort handler. The PySide6
entry point now turns it on after the self-test branch: a rotating
resistamet_<date>.log under the home directory plus the terminal. A home
that cannot take the file (read-only, or a .resistamet that is a file)
falls back to the terminal alone with a warning rather than refusing to
start. The API backend keeps logging to stderr, which the desktop shell
already redirects to a file per launch.
@PEEKPerformer
PEEKPerformer force-pushed the stack/21-ci-docs-and-output-state branch from aa50244 to adb9a6e Compare November 16, 2026 18:33
@PEEKPerformer
PEEKPerformer merged commit 3aa0c92 into stack/20-desktop Nov 16, 2026
6 checks passed
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