Skip to content

feat(IEC-10x): M2 physical point identity, GI isolation and lossless spontaneous SOE facts - #41

Merged
masarray merged 2 commits into
masterfrom
feat/iec10x-m2-physical-identity-spontaneous-soe-20261029
Oct 28, 2026
Merged

masarray merged 2 commits into
masterfrom
feat/iec10x-m2-physical-identity-spontaneous-soe-20261029

Conversation

@masarray

Copy link
Copy Markdown
Owner

Field problem and baseline

Starts from merged M1 668836385f8a4f4af59776518ed851178c1c9c57. Fixes two forensic correctness gaps: Values previously keyed only by IOA (mixing CA/Link A/B), and Active IEC-101/104 SOE discarded first/repeated spontaneous digital evidence without a detected state change.

Delivered (17 files, one CI-triggering PR)

  • New pure Master identity model: Iec10xObservationIdentity.ValueKey(protocol, physical channel, CA, IOA); distinct known/unknown CA; no inferred alias; original physical provenance optional on evidence.
  • Active IEC-101/104 + redundant IEC-101 A/B + passive propagate physical source/reference through an evidence event. Passive retains journal stream ID + original byte offset + ASDU object index. No re-decoding, additional COM TX or FCB/polling changes.
  • Values no longer overwrite same IOA from another link/CA. Strict profile mapping prevents wrong-CA values stealing names. GI expected/completeness uses CA+IOA profile keys independently of actual physical source (cross-CA replies cannot fill a configured station).
  • Event Log records valid digital spontaneous/return-information COT 3, 11, 12 as observation facts even on first sight or repeated states. Distinguishes first observation/repeat/state change; cyclic/GI unchanged snapshots still excluded.
  • ValueRow / RelayEventRow retain reference and physical source. Compact address prefix shows Link A/B without a new wide column. Inspector exposes session-local reference.
  • Public synthetic regression tests cover distinct protocol/source/CA/IOA, spontaneous-vs-snapshot, outbound command filtering, and passive raw offsets/object index.
  • Updated event policy and M2 engineering notes, including verification limitations.

Non-goals / not yet claimed

This is a substantial M2 source identity + SOE checkpoint, not full M2 transaction correlation / durable .ariec record graph, complete report parity, or physical FAT. No claim of real SICAM/ETERA testing or IEC-Test total parity. Multi-SV stream belongs to ARStack61850, not ARIEC60870.

Merge gates

Release build, 19 protocol smoke, xUnit, WPF GUI smoke/Windows package, CodeQL, dependency review, repository hygiene on one exact head; merge only when green. No CI loops or blanket master overwrite.

Comment on lines +47 to +53
foreach (var direction in new[] { FrameDirection.MasterToSlave, FrameDirection.Unknown }) {
var e = new Iec103MasterEvidenceEvent {
Direction = direction, ProtocolMode = Iec60870ProtocolMode.Iec101,
TypeId = 31, InformationObjectAddress = 1, CauseOfTransmission = 3
};
Assert.False(Iec10xObservationIdentity.IsReceivedDigitalEvent(e));
}
@masarray
masarray marked this pull request as ready for review October 28, 2026 20:21
@masarray
masarray merged commit aa9f009 into master Oct 28, 2026
5 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T20:24:02.443657Z e2960f0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2960f0f80

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{
if (protocol is not (Iec60870ProtocolMode.Iec101 or Iec60870ProtocolMode.Iec104))
throw new ArgumentOutOfRangeException(nameof(protocol));
if (ioa is < 0 or > 0xFFFFFF) throw new ArgumentOutOfRangeException(nameof(ioa));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle out-of-range decoded IOAs without throwing on the UI thread

A received SQ=1 ASDU with a three-byte base IOA of 0xFFFFFF and two objects causes Iec10xAsduDecoder.DecodeObjects to produce 0x1000000 for the second object. That observation reaches UpdateValueAndEventViews → BuildValueKey, where this new validation throws. The dispatcher timer calls FlushUiQueues without an exception boundary, so malformed relay traffic can now terminate the desktop application instead of remaining inspectable evidence. Reject or diagnose the invalid address before constructing the value key, without allowing the exception to escape into WPF.

AGENTS.md reference: AGENTS.md:L255-L257

Useful? React with 👍 / 👎.

Comment on lines +843 to +845
var observed = BuildGiKey(item.CommonAddressNumber, item.InformationObjectAddress.Value);
if (_giExpectedValueKeys.Contains(observed))
_giReceivedValueKeys.Add(observed);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Credit GI coverage only to compatible expected profile points

With a profile containing an exact CA=105/IOA=77/Type=31 point and a wildcard-CA IOA=77/Type=1 point, a Type=1 observation from CA=105 resolves to the wildcard point, but this code credits the exact CA=105 key instead. Thus the Type=31 point is reported as received despite never being observed, while the compatible wildcard point remains missing. The caller's ioaPoint is not null check only establishes that some profile entry matches; it does not validate the expected entry selected here. Mark coverage using the compatible profile entry or entries rather than selecting an expected key solely by the observed CA and IOA.

Useful? React with 👍 / 👎.

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.

2 participants