Skip to content

fix(plc): read PLC recipes back with the real step count (#196) - #197

Merged
mrcsin merged 1 commit into
masterfrom
plc-recipe-read-step-count
Nov 18, 2026
Merged

mrcsin merged 1 commit into
masterfrom
plc-recipe-read-step-count

Conversation

@mrcsin

@mrcsin mrcsin commented Nov 18, 2026

Copy link
Copy Markdown
Member

Closes #196

Problem

The read took the size of the integer array as the number of steps. A recipe whose steps carry integer values besides the action id failed to read back. Reconciliation then treated the PLC recipe as unreadable and pushed the local recipe over it, so the operator was never asked about a real conflict (one cause behind #158).

What changed

  • The read takes the step count from the managing area's recipe_lines, the value the PLC uses as its line count.
  • A header that disagrees with the arrays (negative, larger incl. int.MaxValue, or smaller than the data) fails with one typed RecipeLengthMismatchError instead of a crash or a silently truncated recipe; localized en/ru.
  • Verification after a write also checks recipe_lines.
  • Tests: a storing test transport proves write and read-back through the real executor and codec.
  • Docs: docs/readme.md 7.6, docs/architecture/error-reporting.md, the Sync flow bug #158 roadmap.

Verification

  • dotnet build SemiStep.slnx: 0 warnings, 0 errors.
  • dotnet test SemiStep/SemiStep.Tests/SemiStep.Tests.csproj: 1444 passed, 0 failed; --filter "FullyQualifiedName~PlcTransactionExecutor": 24 passed. The defect tests failed on the pre-fix code.
  • Two review rounds (seven reviewers, then an independent final pass): 18 findings fixed, final pass clean. Open: RecipeCoordinator.LoadRecipeFromPlcAsync has no caller, so the error reaches only the logs until the Sync flow bug #158 read-failure slice.
  • No PLC or emulator test yet; operator delegated shipping on test evidence.
Per-task commits before collapse
cb0143f9 docs(plans): record exec branch and verify steps
246a5fae fix(plc): address review findings (#196)
6e0e7b44 docs(plc): record the read step count fix (#196)
9a010a20 docs(plans): verify read step count acceptance
600a59b0 fix(plc): verify recipe_lines after a write (#196)
815274fd fix(plc): read step count from recipe_lines (#196)
3fb77153 docs(plans): add PLC recipe read step count plan

🤖 Generated with Claude Code

The read took the size of the integer array as the number of steps.
A recipe whose steps carry integer values besides the action id ran
out of values mid-recipe and failed to read. Reconciliation on
connect then treated the PLC recipe as unreadable and pushed the
local recipe over it, so the operator was never asked about a real
conflict (one cause behind #158).

The read now takes the step count from the managing area's
recipe_lines, the value the PLC uses as its line count. A header that
disagrees with the arrays (negative, larger or smaller than the data)
fails with one typed RecipeLengthMismatchError instead of a crash or a
silently truncated recipe, localized for the message panel.
Verification after a write also checks recipe_lines. A test transport
that stores writes proves the write and read-back round trip through
the real executor and codec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrcsin
mrcsin marked this pull request as ready for review November 18, 2026 13:38
@mrcsin
mrcsin merged commit 9d70349 into master Nov 18, 2026
1 check passed
@mrcsin
mrcsin deleted the plc-recipe-read-step-count branch November 18, 2026 13:43
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.

PLC recipe read-back uses the int-array size as the step count

1 participant