Skip to content

feat(stage-a-a1): apply camera state through generic host sessions - #11

Draft
muthmann wants to merge 11 commits into
ci/prebuilt-plugin-bundlesfrom
agent/stage-a1-camera-configuration
Draft

feat(stage-a-a1): apply camera state through generic host sessions#11
muthmann wants to merge 11 commits into
ci/prebuilt-plugin-bundlesfrom
agent/stage-a1-camera-configuration

Conversation

@muthmann

@muthmann muthmann commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Dependency

Depends on muthmann/augur-rs#44. That PR supplies a generic complete camera-configuration transaction, profile store, generation-bound sensor readback, rollback, and restore. AugurRS remains a standalone recorder and profile editor with no plugins installed.

This is a stacked PR against ci/prebuilt-plugin-bundles, the exact parent of this branch, so the committed diff contains only the current A1 work.

Architecture

A1 embeds into generic host capabilities. The host has no A1 IDs, field whitelist, workflow metadata interpretation, or scientific policy.

  • A1 selects a named host profile, an immutable inline snapshot, or the current complete configuration.
  • For diff_on/diff_off, A1 clones the last host-confirmed complete snapshot and changes only those protocol fields.
  • The host validates the complete configuration through the active camera backend, applies it, and returns only after a fresh generation-bound readback.
  • A1 uses that confirmed reply as the authority. It does not inspect the previous UI state or wait for another user Apply action.
  • A named profile may enable Sensor reading in the same atomic apply.
  • A1 owns only its scientific gates: the confirmed snapshot must enable sensor telemetry and disable STC/Trail.
  • Recording starts only after the drive retargets and camera confirmation have both completed. Success, Stop, and abort restore the pre-run complete configuration.

What changed

  • let A1 protocols select a named host camera profile or immutable inline snapshot
  • add canonical per-point diff_on and diff_off fields for TOML and CSV
  • apply initial and per-point changes through the generic complete-snapshot command
  • remove the stale pre-apply dependency on the UI/context Sensor reading state
  • leave sensor-specific bias limits with the active camera backend instead of duplicating IMX636 ranges in A1
  • fail closed on rejected/missing readback or a confirmed scientifically incompatible snapshot
  • retry restore up to three times and never report an unconfirmed restore as successful
  • store requested values, confirmed offsets, absolute codes, readback age, immutable snapshot, and profile provenance
  • retain backward compatibility for protocols without camera fields
  • centralize the firmware-qualified 0.01–2000 Hz drive range
  • separate the 2 kHz output limit from A1's 16-photodiode-samples-per-cycle measurement gate

Naming

The canonical camera/backend fields are diff_on and diff_off. No ambiguous bias_on or bias_off aliases are introduced.

Validation

  • A1: 126 tests passed
  • A1 clippy with -D warnings: passed
  • all applicable plugin workspace tests: passed
  • AugurRS standalone GUI and CLI checks without default features: passed
  • AugurRS PR #44 CI and Packaging: passed
  • plugin bundle CI: Linux, macOS arm64, and Windows passed; macOS x86_64 is queued for a runner

The firmware-qualified output ceiling remains 2 kHz. At 20 kSa/s, A1's measurement limit is 1.25 kHz; at 500 kSa/s it is 31.25 kHz, while output remains limited to 2 kHz. Final EVK4 readback timing and analog photodiode bandwidth/ENOB remain bench-verification items.

@muthmann muthmann changed the title feat(stage-a-a1): apply confirmed camera profiles and bias points feat(stage-a-a1): apply camera state through generic host sessions Aug 12, 2026
The contract gains the A2 step-latency acquisition configuration and its
`PrepareA2` command, so the modulation owner can put the firmware into
mode A2 without A2 reaching past it.

The photodiode side gains an explicit detector placement. Until now the
rejected-port complement was the only geometry the estimator knew, and it
is the one geometry in which a DC dark level cancels. A direct sample of
the camera or emission path does not cancel it, so those placements carry
a captured lamp-off dark reference and refuse `a` until one exists. The
splitter fraction travels as provenance only: a constant fraction cancels
out of a log contrast and must not be used to rescale it.
The modulation owner is the only crate that speaks to the command port,
so putting the board into A2 mode belongs here rather than in A2 itself.

The shipped A1 laboratory protocols are parsed as fixtures and checked
against the coupled calibrated-drive limits, so a protocol that asks for
a `ū`/`a` pair the drive cannot reach is caught here instead of at the
bench.
The detector could only be read in the PBS rejected port, where a DC dark
level cancels out of the complement. A direct sample of the camera or
emission path has no complement to cancel against, so those placements
need a real lamp-off reference and refuse `a` until one is captured.

The dark value is activated by an explicit button, not by the numeric
field alone: a settings replay from the UI mirror would otherwise be able
to overwrite a captured reference with a stale draft.

Placement is the scientific geometry and is kept separate from the
RAW/EXCITATION chart mode, which is only a display choice.

The shipped A1 laboratory protocols are parsed as fixtures and checked
against the production ring at the bench sample rate, so a sub-hertz rung
that could not retain two whole cycles is caught here.
A1 copied the host's camera snapshot, readback, ROI, mask and bias codes
into its own sidecar. The copies were not independent measurements and
could disagree with the host TOML sitting next to the same RAW, so the
v2 sidecar cross-references that file instead of duplicating it and keeps
only the conditions that actually move during a run.

What the sidecar could not say before, it now says. `[protocol]` names
the schedule that produced the point — name, author version, source file,
SHA-256 and row identity — and the source is archived once per content
hash into the measurement folder, because a path on the operator's disk
is not durable provenance. `[depth]` separates the commanded, measured
and analysed `a` instead of overlapping names for the three.

`[photodiode]` records the detector geometry. The complement model is
only correct in the rejected port; applying it to a direct camera or
emission-path sample is a scientific error, so the placement travels with
every point rather than being assumed.

The eight laboratory protocols now in use ship as fixtures.

Refs ADR 039.
A2 measures how long the fluorescence chain takes to answer a step. It
owns no hardware: the Teensy belongs to the modulation owner and the
detector to the photodiode owner, so A2 drives both over the service
plane and never opens a port itself.

The protocol file is the aggregate root. Optical configuration, the
qualified hardware gates, controller settings and the ordered recording
rows are validated together before anything happens, because a bring-up
file that is half filled in is useful to read and must not be runnable —
an explicit TBD gate refuses preflight rather than silently defaulting.

Dark rows and stepped rows are separate acquisition types: a dark row
forces the modulation safe and carries no trigger-count gate, so a
missing trigger cannot be reported as a dark measurement.

The plugin records acquisition provenance and live integrity evidence
only. Censored first-event fits stay offline, where the model can be
chosen with the data in hand.

Refs ADR 038.
A4 walks a protocol of diff_on/diff_off pairs at one fixed optical
condition and records a RAW file at each, with enough provenance to read
an event rate against a threshold setting months later.

Every point is confirmed against the sensor's own bias readback before it
records. A point whose absolute codes disagree with the row, or whose
confirming reading is missing or older than the change, is skipped: a
threshold file that is wrong about which codes were live on the die is
wrong in a way nobody can detect afterwards.

Refusals and flags are split on purpose. The event filters being off, the
codes being confirmed and the file being whole are gates, because without
them the number means nothing. Temperature drift, illumination drift and
event rate are flags that mark a point and keep it — whether a 2 °C drift
invalidated a threshold is a judgement to make later with the file in
hand, and a runner that discarded the point would have thrown away the
evidence for making it. A limit whose quantity could not be measured is
flagged rather than passed.

The survey runs on the host's generic camera-configuration session: it
opens by having the host confirm the configuration the bench is on, and
builds every point by cloning that snapshot and setting exactly two
fields, so fo, hpf, refr, the ROI, the mask and the trigger are carried
forward unchanged. A test asserts that equality field by field.

Refs ADR 035, augur-rs ADR 037.
@muthmann
muthmann force-pushed the agent/stage-a1-camera-configuration branch from e490051 to 1b663e9 Compare August 13, 2026 15:35
The bench time a survey still needs was announced once, in the transient
message, and the first point's own message overwrote it a second later.
An operator who looked away had no way to get it back.

It belongs on the protocol's own status line, where it stays: the points
still to run, settling included, counting the point in flight whole.
`total_seconds` becomes `remaining_seconds(0)`, and one shared formatter
gives both the opening message and the status line the same units.
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