From fea2807754be7374ed32f850263e05d3d32295a3 Mon Sep 17 00:00:00 2001 From: Albrecht Degering Date: Wed, 22 Jul 2026 03:20:28 +0200 Subject: [PATCH] feat(core): define atomic poll option ordering --- src/govoplan_core/core/poll.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/govoplan_core/core/poll.py b/src/govoplan_core/core/poll.py index 4721d3f..0364b46 100644 --- a/src/govoplan_core/core/poll.py +++ b/src/govoplan_core/core/poll.py @@ -73,6 +73,18 @@ class PollOptionUpdateCommand: metadata: Mapping[str, object] = field(default_factory=dict) +@dataclass(frozen=True, slots=True) +class PollOptionOrderCommand: + """Complete active option order supplied by an owning module. + + Providers must reject partial, duplicate, or unknown option collections. + An exact repeat is an idempotent no-op. Reordering changes positions only; + option identities and their existing answers remain valid. + """ + + option_ids: tuple[str, ...] + + @dataclass(frozen=True, slots=True) class PollInvitationCommand: respondent_id: str | None = None @@ -183,6 +195,18 @@ class PollSchedulingProvider(Protocol): ... + def reorder_options( + self, + session: object, + *, + tenant_id: str, + poll_id: str, + command: PollOptionOrderCommand, + ) -> PollRef: + """Atomically replace the complete active option order.""" + + ... + def open_poll(self, session: object, *, tenant_id: str, poll_id: str) -> PollRef: ...