Slice 11: test-vs-real provenance on a witnessed Run - #664
Merged
Conversation
Two sentences in capture_watch_preflight.py's module docstring overclaimed what the preflight command actually catches: it cannot reach NumAngles at all (read from the HDF5 file, never a PV), and Measurement.kind cannot distinguish a genuine scalar from a 1-element array, since _kind_for only flags an array at element_count > 1. Docstring only; no behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reads the optional testing role (2-BM's TomoScan:Testing, DBR_ENUM) alongside status/abort/images_saved/images_collected and carries the witnessed genesis's tri-state reading onto RunStarted, answering whether the substrate was bypassing its own beam preconditions for this capture. Tri-state throughout (asserted / clear / unresolved): an unresolved reading is never coerced to "real", and a clear reading is a positive claim of a real acquisition, never mere absence. Deliberately NOT Manifest.is_simulated: that field answers whether the recorded numbers were synthetic, an orthogonal question from whether the facility had beam. The new field ships to the exported record (keep:number), unlike SafetyEnvelopeVerdict's live-PSS/interlock bools, because it is a receipt-facing scientific-provenance claim the issue itself asked to be visible, not a security-perimeter reading. RunWitnessRecorder retains the latest testing-role reading per capture code with its own dual-clock observed_at, independent of any one capture (unlike progress, this is never evicted at promote/truncate/ outcome), and stamps it onto the next genesis via record_witnessed_run's now-optional capture_precondition_bypass_snapshot. Code capability only: ships nothing to a live record until a deployment declares the testing role in its own capture_watch_pvs and run_witness_recording_enabled is turned on. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The manual commit-splitting step for the F2 docstring fix (isolating it from the slice-11 diff by reconstructing an intermediate file) copied the pre-slice-11 version of capture_watch_preflight.py back into place for that commit, then never restored the full slice-11 version before the second commit. The ROLE_TESTING import and its _decode_verdict branch were silently dropped from what got committed and pushed, caught by CI (fast shard 1) failing three preflight tests that assert the testing role actually decodes, rather than by local review. Confirmed via diff that this was the ONLY file affected (the other 19 files went through the safer patch-apply recovery path after the earlier pre-commit timeout). Full test-noio rerun clean (47817 passed) before pushing this fix. Co-Authored-By: Claude Sonnet 5 <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.
Summary
Answers cora#657 (Francesco De Carlo). Reads 2-BM's
2bmb:TomoScan:Testingrole (a DBR_ENUM, same record type as
AbortScan) and carries a tri-statereading onto the witnessed genesis: whether tomoscan was bypassing its own
beam preconditions when the capture began.
Manifest.is_simulated: that field answers whether therecorded numbers were synthetic; this answers whether the facility had
beam. The two disagree at 2-BM right now (real detector/motors/file,
no beam, during the commissioning shutdown).
True(bypassed),False(a positive claim of areal acquisition),
None(unresolved/absent) — never collapsed.RunWitnessRecorderretains the latesttestingreading percapture code with its own
observed_at, independent of any one capture(never evicted, unlike progress), and stamps both onto the next genesis.
binary_code()from_capture_observer.py— no second decoder.keep:number), unlikeSafetyEnvelopeVerdict'sredacted live-PSS/interlock bools: this is a receipt-facing provenance
claim the issue itself asked to be visible, not a security-perimeter
reading. Documented explicitly in
gen_record_dispositions.pyso a futuremaintainer doesn't "fix" it to match the wrong precedent.
deployment declares the
testingrole in its ownCAPTURE_WATCH_PVSand
RUN_WITNESS_RECORDING_ENABLEDis turned on.Rides along: a small, independent correction to
capture_watch_preflight.py'smodule docstring, which overclaimed that all three prior wire-shape defects
"would have shown up in one run" of the preflight command (
NumAnglesisread from the HDF5 file, never a PV, so no CA preflight can reach it) and
that
kindalone flags array-vs-scalar (a one-element array reports asScalar, indistinguishable from a real scalar). Docstring only, no behaviorchange; separate commit.
Test plan
make test-noio(unit + architecture + contract): 47817 passed, 630 skippedmake test-db(integration + e2e): 1196 passed, 1 skippedmake lint(ruff check + format --check): cleanmake typecheck(pyright): cleandomain vocabulary to
beam_preconditions_bypassed/CapturePreconditionBypassObservation/CapturePreconditionBypassSnapshotto stay substrate-neutral, keeping only the config-facing role key (
testing)mirroring the PV name
code-reviewgate review at high effort: fixed a docstringcorrectness bug, documented the disposition-policy decision, and
closed four test-coverage gaps it surfaced (unresolved-with-timestamp
round-trip, decoded-with-no-timestamp round-trip, a non-tautological
shadow-mode noop test, per-capture-code isolation, and Hypothesis
fuzzing of the new field through the decider)
capture_watch_preflight.pyagainst the live 2-BM host(arcturus unreachable, per the design memo)
🤖 Generated with Claude Code