v0.6.0
Release v0.6.0
Date: 2026-03-13
Previous release: v0.5.1
Summary
- ReadResult API: Field
Errorrenamed toMessage(human-readable only; not stable API). AddedSuccess()(same asOK()). DocumentedStatusas canonical outcome,Err()as convenience adapter, andCauseas optional/non-stable. - Package docs: Outcome models (Strict / Structured / Best-effort) and canonical read pattern (
errthenres.Err()thenres.Data). Stable sentinels:ErrNotConnected,ErrRequestExceedsPDU,PDURefMismatchError,ValidationError,ReadStatus;ErrProtocolFailuredocumented as advanced/diagnostic. - Connect reconnect: Dial and handshake the new connection first; existing session is replaced only after the new handshake succeeds. Failed reconnect no longer drops a healthy session.
- ValidationError everywhere: All caller-input validation now returns
*ValidationError:Connect(port, timeout, max PDU, rack/slot),UploadBlock,GetBlockInfo,Discover(rack/slot, jitter, maxAttempts),streamCIDR/expandCIDR(CIDR validation). Useerrors.As(err, &ValidationError{})to detect. - Handshake protocol errors: COTP/S7 decode and shape failures in
performCOTPConnectandperformS7SetupwrapErrProtocolFailure; setup PDU ref mismatch returnsPDURefMismatchError. - Request validation:
CompareReadRequest: timeout ≥ 0, each candidate rack/slot validated; zero candidates allowed.RackSlotProbeRequest: non-empty address, port 0..65535, rack 0..7, slot 0..31 (and min ≤ max). - GetBlockInfo: Documented contract: transport/protocol failure →
(nil, err); parse failure after transport success → partialBlockInfo(Type, Number) pluserr. - Context cancellation: README and transport docs note that cancellation is strongly effective only when the context has a deadline.
- Discover: README recommends conservative CIDR ranges (e.g.
/24or smaller) in OT environments. - UploadBlock: End-upload cleanup timeout reduced from 2s to 500ms. Documented: best-effort cleanup before return may add a short delay; cleanup errors not returned.
- WriteArea: Documented that the number of bytes written is
len(data);addr.Sizeis ignored. - UploadBlock tests: Empty payload error, protocol failure on chunk (no retry), cleanup failure does not change result, context deadline returns promptly.
- Method docs: Best-effort first sentence for
Identify,GetBlockInfo,ListAllBlocks,ReadDiagBuffer; use-case sentence forCompareRead.
Breaking changes
- ReadResult: Field
Errorrenamed toMessage. Callers that read or setresult.Errormust switch toresult.Message.