Skip to content

feat(ui): show sync waits in the link slot - #248

Merged
mrcsin merged 1 commit into
masterfrom
link-slot-states
Nov 30, 2026
Merged

mrcsin merged 1 commit into
masterfrom
link-slot-states

Conversation

@mrcsin

@mrcsin mrcsin commented Nov 30, 2026

Copy link
Copy Markdown
Member

Problem

The status bar link slot showed green "ПЛК: подключено" while the PLC did not hold the screen recipe: during a write pause after a reconnect, while a conflict dialog was open or waiting, while the recipe had warnings so it was not written, and while a write was parked until a run ended. A failed or blocked state looked like a healthy link.

What changed

  • New link slot kinds from the designer's spec (docs/plans/20261130-recipe-replace-save-exit-safety-ui.md, section 1):
    • "ПЛК: сравнение рецептов…" while a write pause holds and the link is up;
    • "ПЛК: конфликт рецептов" while a conflict is open or waiting;
    • "ПЛК: рецепт не записан" when the recipe has warnings or a write is parked until run end, with the cause in the tooltip.
  • The resolve order follows the spec; "подключение…" shows only until the link is up. A normal write in its 1 s debounce or in flight stays green.
  • Core exposes the state: PlcSessionSnapshot.IsWritePaused and NotWrittenCause from PlcSyncCoordinator, IsConflictOpen from PlcComparisonState. The warnings cause follows the latest notified recipe, so a write that finishes after the recipe gained warnings does not turn the slot green. Each snapshot is built from the final state of its transition.
  • docs/readme.md lists the new states.

This is Task 4 of docs/plans/20261130-recipe-replace-save-exit-safety.md.

Verification

  • Build 0 warnings; full suite 2300 passed, 0 failed, in three consecutive runs; dotnet format --verify-no-changes clean.
  • Tests: one per kind, each resolve-order conflict, green during the debounce, warnings and a parked write, warnings notified during a held write and during the precheck, slot width with the longest texts.
  • Live against the PLC emulator: a loop without its end shows "ПЛК: рецепт не записан" with "Причина: в рецепте есть предупреждения."; behind an open conflict dialog the slot reads "ПЛК: конфликт рецептов"; a normal edit stays "подключено". All texts fit the slot.
  • Code review and an independent review; their findings are fixed in this PR.

🤖 Generated with Claude Code

With sync on and the link up, the link slot showed the green "PLC:
connected" in three states where the PLC did not follow the screen. The
write pause held while the reconnect comparison ran. A conflict dialog
was open or waiting. Or nothing was written, because the recipe had
warnings or a write waited for the PLC run to end (plan rows D2, A1,
A14). The toggle in Enabling also kept "connecting" after the link was
up, so a comparison inside the enable never showed.

PlcSyncCoordinator now puts the write pause and a not-written cause
(Warnings, RunActive) into PlcSessionSnapshot, builds every snapshot
from the state after the change, and emits one whenever either value
changes. Warnings follows the latest notified recipe, not the status: a
write that started before an invalid edit still ends Synced. A normal
write in its debounce or in flight has no cause, and neither has a
recipe whose warnings were just fixed, so the slot does not flash grey
after an edit. PlcComparisonState owns a conflict-open flag, true while
a conflict offer is current, and PlcLifecycleManager exposes it.
PlcLinkViewModel starts from the current snapshot and resolves both in
the order of the UI design: Disconnecting, SyncOff, Connecting (link not
up yet), NoLink, Conflict (red dot), Comparing (hollow grey dot),
SyncError, NotWritten (filled grey dot), Connected. The tooltip adds
what the write waits for, or the cause of NotWritten. The SyncError
latch is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrcsin
mrcsin marked this pull request as ready for review November 30, 2026 17:06
@mrcsin
mrcsin merged commit c31fdd6 into master Nov 30, 2026
1 check passed
@mrcsin
mrcsin deleted the link-slot-states branch November 30, 2026 17:12
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