[MDSAL-420] LazyDataObjectModification reports incorrect results Created: 28/Jan/19  Updated: 28/Jan/19  Resolved: 28/Jan/19

Status: Resolved
Project: mdsal
Component/s: Binding runtime
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: High
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates YANGTOOLS-938 InMemoryDataStore delete/write cycle ... Resolved

 Description   

When an InMemoryDataTree node appears/disappears, we report the appropriate APPEARED/DISAPPEARED event, which is sufficient for most users.

Unfortunately, this breaks if the user attempts to drill into the modification, such as binding lookup of a container within a choice statement.



 Comments   
Comment by Robert Varga [ 28/Jan/19 ]

Unfortunately the API contracts around here are fuzzy and untested, hence we are between a rock and a hard place. For direct users of DataTreeCandidateNode the current behavior makes sense. They know the node has appeared and if they choose to drill down, they will find the cause of the node's appearance, and this will be consistent with getChildNodes().

We could simply flip the reporting to the WRITE/DELETE codepath, but that would end up being inconsistent with getChildNodes() as well as create further problems with the type of descendant nodes – for example if we have two nested non-presence containers, they both should be reported as APPEARED when a leaf in the inner container is introduced. Changing the logic would pretend the inner container was actually written, which is the wrong outcome.

Comment by Robert Varga [ 28/Jan/19 ]

Hence it is up to Binding to deal with this difference and project a correct interpretation of the results. It certainly has all the tools required for the job.

Comment by Robert Varga [ 28/Jan/19 ]

This has been observed when LazyDataObjectModification.getModifiedChild() is asked to cross an BindingStructuralType.INVISIBLE_CONTAINER node disappearing. Current code assumes 1:1 correspondence with DOM model, which is wrong.

Since we are not reporting INVISIBLE_CONTAINERs, only their content, and we have a simplified ModificationType, which can only express WRITE/DELETE/SUBTREE_MODIFIED, we must treat a disappeared INVISIBLE_CONTAINER as a DELETE operation of all its children – i.e. not rely on DOM to provide correct answers here.

Comment by Robert Varga [ 28/Jan/19 ]

This is a side-effect of YANGTOOLS-938 and should be fixed there. With it applied, empty writes and deletes end up being DELETE modification types, hence making this a non-issue.

Generated at Wed Feb 07 20:09:46 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.