Repository navigation
fix(plc): read PLC recipes back with the real step count (#196) - #197
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
recipe_lines, the value the PLC uses as its line count.int.MaxValue, or smaller than the data) fails with one typedRecipeLengthMismatchErrorinstead of a crash or a silently truncated recipe; localized en/ru.recipe_lines.docs/readme.md7.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.RecipeCoordinator.LoadRecipeFromPlcAsynchas no caller, so the error reaches only the logs until the Sync flow bug #158 read-failure slice.Per-task commits before collapse
🤖 Generated with Claude Code