Skip to content

Reimplement CoaXPress write guard locally (drop rogue addPreWriteListener)#1431

Open
ruck314 wants to merge 1 commit into
pre-releasefrom
local-cxp-addPreWriteListener
Open

Reimplement CoaXPress write guard locally (drop rogue addPreWriteListener)#1431
ruck314 wants to merge 1 commit into
pre-releasefrom
local-cxp-addPreWriteListener

Conversation

@ruck314
Copy link
Copy Markdown
Contributor

@ruck314 ruck314 commented Jun 3, 2026

Context

rogue is removing addPreWriteListener() / pr.WriteBlockedError in the next tag cycle (rogue#1248 reverts rogue#1229). The CoaXPress Phantom write guard (#1417) depends on that API, so it would break (AttributeError at device construction) on the upcoming rogue.

This PR reimplements the guard locally inside python/surf/protocols/coaxpress/ so it works on both current and future rogue, with no behavior change versus addPreWriteListener + rogue v6.13.0.

What changed

  • New _WriteGuard.py: a local WriteBlockedError plus WriteGuardMixin, which restores the addPreWriteListener(cb, stateVars=...) API by overriding Device.writeBlocks() — the funnel through which interactive RemoteVariable.set(write=True) routes (self._parent.writeBlocks(..., variable=self)).
  • Bootstrap, PhantomS641, PhantomS991 now inherit WriteGuardMixin; the _write_guard(path, value, state) bodies and addPreWriteListener(...) calls are unchanged. PhantomS711 inherits via PhantomS641.
  • Removed rogue.Version.minVersion('6.13.0') (it gated the now-removed feature) and the orphaned import rogue.
  • pr.WriteBlockedError → local WriteBlockedError.

Behavior parity (matches addPreWriteListener + rogue v6.13.0)

Write path Behavior
Interactive var.set(), non-whitelisted, acquiring Blocked (variable is not None)
AcquisitionStart/AcquisitionStop (posted) Allowed (post bypasses writeBlocks)
IsAcquiring (LocalVariable) Allowed (bypasses writeBlocks)
Bulk writeAll / setYaml, acquiring Not guarded
Not acquiring All allowed

@ruck314 ruck314 force-pushed the local-cxp-addPreWriteListener branch from 942a7ab to 82be716 Compare June 3, 2026 16:29
…ener)

rogue is removing addPreWriteListener()/pr.WriteBlockedError (PR #1248
reverts PR #1229), which the CoaXPress write guard depended on. Reimplement
the guard locally so the drivers work on both current and future rogue.

- Add _WriteGuard.py: local WriteBlockedError plus WriteGuardMixin, which
  restores the addPreWriteListener API by overriding Device.writeBlocks (the
  funnel for interactive RemoteVariable.set writes).
- Bootstrap, PhantomS641, PhantomS991 inherit the mixin; the _write_guard
  bodies and addPreWriteListener calls are unchanged. PhantomS711 inherits
  via PhantomS641.
- Drop rogue.Version.minVersion('6.13.0') and the now-unused import rogue.

Behavior matches addPreWriteListener + rogue v6.13.0: only single interactive
writes are guarded; bulk writeAll/setYaml and posted acquisition commands pass.
@ruck314 ruck314 force-pushed the local-cxp-addPreWriteListener branch from 82be716 to 58fba0e Compare June 3, 2026 16:33
@ruck314 ruck314 requested a review from scompa18 June 3, 2026 16:34
@ruck314 ruck314 marked this pull request as ready for review June 3, 2026 16:34
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