Skip to content

fix(opctreemanager): resolve an empty OPC group (#137) - #145

Merged
mrcsin merged 1 commit into
masterfrom
opctreemanager-empty-group-resolution
Sep 22, 2026
Merged

mrcsin merged 1 commit into
masterfrom
opctreemanager-empty-group-resolution

Conversation

@mrcsin

@mrcsin mrcsin commented Sep 22, 2026

Copy link
Copy Markdown
Member

Summary

FindGroup picked the target group by OpcUaScadaItem.IsGroup, which is derived (Items != null && Items.Count > 0). A folder whose children are all disabled in the OPC server GUI holds nothing, so the group was reported as not found and the rebuild refused to run. The predicate is now !IsNode || IsGroup: a folder is a container whether or not it currently holds children, and only an empty leaf pin is rejected.

Type of change

  • fix — bug fix

Linked issues

Closes #137

Changes touching FB code

  • XML pin IDs match the const int *PinId constants in the FB class
  • New runtime-only fields carry [NonSerialized]
  • [ComVisible(true)] + [Guid] untouched on existing FBs
  • Read Docs/architecture/masterscada-fb-primer.md and Docs/architecture/architecture.md
  • Checked Docs/known_issues/ — the root cause is written up as 15-derived-properties-as-identity.md

Tree-modifying FBs only

  • Mutations are queued in UpdateData and executed from a System.Windows.Forms.Timer polling IProjectHlp.InRuntime
  • Results written to the file log
  • No BeginInvoke self-reposting

Testing

  • dotnet build NtoLib.sln — 0 errors, 0 warnings
  • dotnet test NtoLib.sln — 373 passed
  • dotnet format NtoLib.sln --verify-no-changes — exit 0
  • Manual host smoke: MBE group resolved at ServerInterfaces.MBE, 23 nodes constructed

Also in this PR

  • a failed group lookup dumps the ScadaRootNode shape into the failure message, bounded to 3 levels, 20 children per node and 200 lines, so the message reaches the deferred pass where the Failed pin cannot
  • TreeSnapshotWriter refuses to write a snapshot that holds zero nodes
  • PlanBuilder refuses a plan that would restore nothing

FindGroup picked the target by OpcUaScadaItem.IsGroup, a derived property
(Items != null && Items.Count > 0). A folder whose children are all disabled in
the OPC server GUI holds nothing, so the group was reported as not found and the
rebuild refused to run.

The predicate is now !IsNode || IsGroup: a folder is a container whether or not
it currently holds children, and only an empty leaf pin is rejected. Around it:

- a failed lookup dumps the ScadaRootNode shape into the failure message,
  bounded to 3 levels, 20 children per node and 200 lines
- TreeSnapshotWriter refuses to write a snapshot that holds zero nodes
- PlanBuilder refuses a plan that would restore nothing
@mrcsin
mrcsin merged commit a35fd18 into master Sep 22, 2026
1 check passed
@mrcsin
mrcsin deleted the opctreemanager-empty-group-resolution branch September 22, 2026 15:42
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.

OpcTreeManager: пустая целевая группа не находится из-за отбора по IsGroup

1 participant