Skip to content

Phase 4D-D1: add safe dynamic DataSet lifecycle - #31

Merged
masarray merged 5 commits into
mainfrom
agent/phase-4d-d1-dynamic-dataset
Aug 10, 2026
Merged

masarray merged 5 commits into
mainfrom
agent/phase-4d-d1-dynamic-dataset

Conversation

@masarray

@masarray masarray commented Aug 10, 2026 •

Copy link
Copy Markdown
Owner

Scope

Port ARIEC61850 dynamic DataSet support into the C++ stack without touching the parallel Smart Control work.

MMS service parity

  • DefineNamedVariableList service [11] request/response encode + decode
  • DeleteNamedVariableList service [13] request/response encode + decode
  • domain-specific IEC 61850 DataSet references and ordered named-variable members
  • C# oracle vectors for successful Define/Delete responses
  • symmetric codec surface so the same wire implementation can later serve the MMS server path

Operational runtime

  • create dynamic DataSet over an existing live MmsAssociationRuntime
  • optional default-on GetNamedVariableListAttributes verification after creation
  • exact member count/order verification because report value mapping is index-sensitive
  • default operational limit of 64 members, configurable up to the bounded codec limit
  • track DataSets created by this runtime
  • refuse deletion of an unowned DataSet unless caller explicitly requests an override
  • best-effort rollback if post-create verification fails
  • never perform network cleanup from a destructor

Isolation

No control/** files or Smart Control sequencing are modified. This PR is intentionally independent of the stacked control work.

Validation

Dedicated CTest coverage includes ARIEC C# golden wire vectors, request round trips, malformed/unsafe request rejection, and association-before-mutation guards.

Final head CI is green on Linux GCC, Linux Clang, and Windows MSVC. Security/Evidence is also green with Clang ASan+UBSan and the full libFuzzer corpus smoke.

Acceptance boundary

Physical IED mutation interoperability is not claimed by hosted CI. DYNAMIC_DATASET_PROFILE.md records the lab acceptance sequence required before calling this live-proven.

@masarray
masarray marked this pull request as ready for review August 10, 2026 14:44

@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: 584632fc07

ℹ️ 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".

Comment on lines +490 to +492
const auto normalized = normalize_reference(data_set_reference);
const auto owned = owned_data_sets_.contains(normalized);
if (!owned && policy != MmsDynamicDataSetDeletePolicy::explicit_override) {

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 Reset ownership when the association changes

If the referenced MmsAssociationRuntime is disconnected and connected again, owned_data_sets_ retains names created during the previous association. In particular, reconnecting the same runtime to another endpoint with a same-named static or foreign DataSet makes this check treat it as owned, so the default owned_only path can delete an unrelated DataSet without requiring explicit_override. Scope ownership to an association epoch/endpoint and invalidate it whenever the association changes.

Useful? React with 👍 / 👎.

Comment on lines +425 to +428
const auto encoded = MmsNamedVariableListCodec::encode_define_request_p_data(
request, association_.negotiated().presentation_context_id);
const auto exchange = association_.exchange_confirmed(
encoded, invoke_id, stop_token);

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 Enforce the negotiated MMS PDU size before sending

When maximum_members is raised or members contain long valid identifiers, this encoder can produce a request up to the codec's 1 MiB limit and send it without comparing its MMS PDU length to association_.negotiated().maximum_mms_pdu_size, which commonly defaults to 65,000 bytes and may be lower. Such API-valid creates violate the negotiated association limit and can be rejected or fault the connection; reject or cap the request locally using the negotiated limit before calling exchange_confirmed.

Useful? React with 👍 / 👎.

@masarray
masarray merged commit ab1fa69 into main Aug 10, 2026
10 checks passed
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.

1 participant