Auto-push can overwrite the PLC recipe before reconciliation reads it

Open
#181 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp

Research direction

Begin with the manual test that follows plc-write-atomic, then inspect Plc/PlcLifecycleManager.cs, Recipes/RecipeSession.cs, and Sync/PlcSyncExecutor.cs at the referenced lines. Use the plc-push-gate slice in Docs/plans/roadmaps/20260807-plc-sync-reconciliation-roadmap.md as context. Done means a queued snapshot waits through reconciliation, is flushed or dropped after the outcome, and the gate opens on every outcome including exceptions.

Written by the indexing model from the issue text.

Description

bug

A recipe edit made while the PLC connection is being established can push the local recipe to the
PLC before the sync reconciliation reads it. The recipes then match, no conflict is detected, and the
PLC recipe is gone without the operator being asked.

EnableSync sets sync enabled (Plc/PlcLifecycleManager.cs:129) before it connects (:130). From
that moment every recipe mutation notifies the sync service
(Recipes/RecipeSession.cs:625-631), which schedules a write after a 1000 ms debounce
(Sync/PlcSyncExecutor.cs:23,31-51). The reconciliation reads the PLC recipe at
PlcLifecycleManager.cs:338, after the connect completes. Whichever lands first wins.

The window is narrow - it needs an edit during the connect - so this is filed as a known race, not a
reported failure. Confirm it happens in the field before implementing.

Scope: hold the debounced auto-push until the reconciliation has reached an outcome. A snapshot
queued while the gate is closed is flushed afterwards, and dropped if the operator resolves the
conflict by loading the PLC recipe. The gate covers the reconciliation window only; it is not a
general write lock.

Risk: a gate that fails to open strands the sync silently, so it needs an open-on-every-outcome
guarantee including the exception paths.

Roadmap: Docs/plans/roadmaps/20260807-plc-sync-reconciliation-roadmap.md - slice plc-push-gate.
Decide after the manual test that follows plc-write-atomic.

Dominant language
C#
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Semiteq/SemiStep

All issues in Semiteq/SemiStep

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.