Repository navigation
feat(l10n): localize PLC connection-lost fault - #164
Merged
Merged
Conversation
The panel had localizing seams for a Result's errors (ReportFailure) and
warnings (ReportWarnings), plus the snapshot-validity channel
(RefreshReasons), but none for a single transient IError. The PLC fault
channel carries a typed IError end to end, yet OnPlcFault flattened it to
.Message into the raw ReportError(string) sink -- so the fault rendered raw
English, and the one fault it carries was an untyped Error anyway.
Build the error-side twin of slice 5a's warning seam and prove it on the
connection-lost fault:
- ReportFailure(this MessagePanelViewModel, IError) -- a localizing overload
mirroring ReportFailure(IResultBase): ReportError(ReasonLocalizer.Localize
(error)). IError is not IResultBase, so the overload is unambiguous.
- ConnectionLostError (typed) replaces PlcSyncCoordinator's
new Error("PLC connection lost").
- OnPlcFault routes through the seam, keeping the English
LogWarning("PLC fault: {Message}", ...) (log-English invariant).
English is behavior-preserving: ConnectionLostError's base message equals
today's string and the resx en value equals it byte-for-byte. Under ru the
PLC fault now reads Russian. The seam localizes any IError -- an untyped
inner still falls through to .Message -- so nothing else regresses.
This is the small mechanism cut of the PLC slice; the bulk error typing +
un-laundering (6b) and the #120 cancellation plumbing (6c) follow.
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
The panel had localizing seams for a Result's errors (
ReportFailure(IResultBase)) and warnings (ReportWarnings, slice 5a), plus the snapshot-validity channel (RefreshReasons) — but none for a single transientIError. The PLC fault channel carries a typedIErrorend to end (PlcSyncCoordinator.EmitFault→Faults→RecipeCoordinator.OnPlcFault), yetOnPlcFaultflattened it to.Messageinto the rawReportError(string)sink — so the fault rendered raw English regardless of culture, and the one fault it carries was an untypednew Error("PLC connection lost")anyway.What changed
The error-side twin of slice 5a's warning seam, proven on the connection-lost fault:
ReportFailure(this MessagePanelViewModel, IError error)— a localizing overload mirroringReportFailure(IResultBase):panel.ReportError(ReasonLocalizer.Localize(error)).IErroris notIResultBase, so the overload is unambiguous (all existing callers pass Results). The panel now has all four seams:ReportFailure(IResultBase),ReportFailure(IError),ReportWarnings,RefreshReasons.ConnectionLostError(typed) replacesPlcSyncCoordinator'snew Error("PLC connection lost").OnPlcFaultroutes through the seam, keeping the English_logger.LogWarning("PLC fault: {Message}", ...)(log-English invariant).Behavior-preserving for English:
ConnectionLostError's base message equals today's string and the resxenvalue equals it byte-for-byte. Underruthe PLC fault now reads Russian. The seam localizes anyIError— an untyped inner still falls through to.Message, so nothing else regresses.Scope: this is the small mechanism cut of the PLC slice. The bulk error typing + un-laundering
PlcSyncExecutor(6b) and the #120 cancellation plumbing (6c) follow.Verification
dotnet build SemiStep.slnx— 0 warnings.dotnet test SemiStep/SemiStep.Tests/SemiStep.Tests.csproj— 1643 passed, 0 failed.ResultReportingExtensionsTestsdrivesReportFailure(new ConnectionLostError())underru(Russian in the operation slot, Error severity) + the untyped-fallthrough (.Message).PlcSyncCoordinatorTestspinsBeOfType<ConnectionLostError>()at the emit source;PlcFault_RoutesToMessagePanelOperationChannel(en-scoped) keeps the routing/severity contract.ReasonLocalizerTestspins the ru render + enLocalize == .Message; the coverage test forces the case.Per-task commits before collapse
🤖 Generated with Claude Code