Cross-check the capture-watch preflight against the live camera selection - #705
Merged
Conversation
…he live camera selection On 2026-08-20 an operator's camera switch at 2-BM left the configured full_file_name PV (hardcoded to one camera's prefix) reading the idle camera's stale filename readback. That value is exactly what RunWitnessRecorder vaults into run_capture_path as the Run's capture path, which is personal data. The live risk is currently zero because run_witness_recording_enabled is off at 2-BM, which is exactly why now is the right time to close the gap before it is turned on. The preflight gains one more report line, camera_prefix_check, only when a code declares both full_file_name and a new optional camera_selected role in capture_watch_pvs: it reuses the readings already taken by the existing sweep (no second control_port.read()), and never reports a clean match on anything it cannot actually confirm, an unreadable camera_selected PV, an empty capture_camera_select_prefixes table, or a reading the table does not resolve are each their own distinct bad verdict. The reading-to-prefix mapping is a deployment-declared table (Settings.capture_camera_select_prefixes), mirroring capture_status_phases, because CORA does not know, and must not guess, whether the live CameraSelected PV resolves to a bare index or an ENUM label; camera-index-to-prefix itself is confirmed via deployments/2-bm/beamline.yaml (DET-11, operator-verified 2026-06-19), but the wire format of CameraSelected's own reading is not yet confirmed against the live IOC and is left for beamline staff to verify when they configure the new role. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> The camera tests configure a REAL camera-prefixed PV name for full_file_name, not a placeholder: with a placeholder the match case cannot pass and, worse, the mismatch case passes for the wrong reason, since a prefix absent from the table mismatches whatever camera is selected. Match and mismatch now differ only in the camera reading.
DATA-8 asks whether dropped frames are rare-and-alarming or routine, and its two existing data points are both files that closed cleanly: one early smoke test with a near-total shortfall, one production scan with none. The 2026-08-20 scan is the first of a different shape. The disk filled mid-acquisition, the saved-frame counter fell behind the collected-frame counter, and the file it left behind cannot be counted at all: it opens, but reading the frame-index dataset raises an HDF5 address-overflow error. That matters for the answer the row is gathering evidence toward. A shortfall check modelled only on "fewer frames than commanded" cannot express this outcome, because there is no readable count to compare against. An unreadable file has to be its own result, not a zero. Only the DATA-8 row changes here. The storage-tier account on operations.md and the HOST-2 row are deliberately untouched: both were already corrected on main (#684, #696), and their current text, that the write target is an operator-settable PV re-measured to /local1 on 2026-08-19 with older scans still on /local2, is better sourced than anything this incident adds. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent commits, both prompted by the 2026-08-20 disk-full incident at APS 2-BM.
1. Camera-prefix cross-check in the capture-watch preflight.
capture_watch_pvs'sfull_file_namerole is a hardcoded PV string carrying one camera's prefix, and nothing makes it follow2bm:MCTOptics:CameraSelect. During the incident the operator switched from camera 2 to camera 1, which would leave that role reading the idle camera's stale filename readback. That value is exactly whatRunWitnessRecordervaults intorun_capture_pathas the Run's capture path, and it is personal data.The preflight gains one report line,
camera_prefix_check, emitted only when a code declares bothfull_file_nameand a new optionalcamera_selectedrole. It reuses readings the existing sweep already took (no secondcontrol_port.read()) and never reports a clean match on anything it cannot confirm: an unreadable PV, an empty mapping table, and an unrecognized reading are each their own distinct bad verdict.The reading-to-prefix mapping is a deployment-declared table (
Settings.capture_camera_select_prefixes), not hardcoded. CORA does not know whether the liveCameraSelectedresolves to a bare index or an ENUM label, and must not guess. The camera-index-to-prefix fact itself is confirmed bydeployments/2-bm/beamline.yaml(DET-11, operator-verified 2026-06-19); the wire format of the readback is left for beamline staff to confirm when they configure the role.Live risk today is zero because
run_witness_recording_enabledis off at 2-BM. That is precisely why this lands before it is turned on.2. DATA-8 gains a third data point.
The row asks whether dropped frames are rare-and-alarming or routine. Its two existing data points are both files that closed cleanly. The 2026-08-20 scan is a different shape: the disk filled mid-acquisition, the saved-frame counter fell behind the collected-frame counter, and the file it left cannot be counted at all. It opens, but reading the frame-index dataset raises an HDF5 address-overflow error with end-of-allocation at 2048 bytes.
That matters for the answer the row is gathering evidence toward. A shortfall check modelled only on "fewer frames than commanded" cannot express this outcome, because there is no readable count to compare against.
Deliberately not touched: the storage-tier account in
operations.mdand theHOST-2row. Both were already corrected on main (#684, #696), and their current text, that the write target is an operator-settable PV re-measured to/local1on 2026-08-19 with older scans still on/local2, is better sourced than anything this incident adds. An operator recollection that both tiers are in concurrent use is worth confirming with the beamline before it is written down as fact.Testing. 1,011 tests pass (preflight unit tests plus the full deployments tier, including the open-questions alignment guard). The camera tests were rewritten during review: all five originally configured a placeholder PV whose prefix matched nothing in the table, which made the match case fail and, worse, made the mismatch case pass regardless of which camera was selected. They now configure a real camera-prefixed PV so match and mismatch differ only in the camera reading.