fix: removeIED - prevent duplicate LNode's#147
Open
stee-re wants to merge 1 commit into
Open
Conversation
ec48b77 to
4ef2497
Compare
This was referenced May 27, 2026
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.
resolves #121
Summary
When multiple IEDs reference the same LNode, removing those IEDs sequentially can result in duplicate LNode
entries with iedName="None". This PR modifies the default behaviour for
removeIED()to delete all LNodes bound to that IED by default, but exposes a new optional flagpreserveLNodeswhich will instead, set the LNodes ideName="None". In cases where setting the iedName="None" would lead to a duplicate LNode, then it is removed instead.E.g.
Changes
tIED/removeIED.ts:removeBoundLNodes()- Default handling for LNodes - find any (public) matching LNodes and create a Remove edit for them.detachLNodeBindings()- if "preserveLNodes flag set, this function is called instead, to instead set the LNodes iedName to "None", taking care to avoid duplicates. Any LNodes encountered which would cause a duplicate, are removed instead.Helper functions
lNodeKey- creates a key for the LNode based on all the other attributes (except iedName) which combined, must be unique.removeLNode()&setLNodeToNone()- oneliner functions, there only to make the code more readable.getLNodeByIedName()used to find the bound LNodes (and the specification LNodes (set ot None))Other Changed files
index.ts: ExportedRemoveIedOptionstypetIED/removeIED.spec.ts: Added tests for LNode removal and opt-in LNode updating behaviourtIED/removeIED.testfile.ts: Added test fixture with duplicate LNode scenario.gitignore: Added IDE and build artifact patternsCode coverage 99.52%