[YANGTOOLS-1475] Make BuildGlobalContext execution order predictable Created: 17/Jan/23  Updated: 09/Jan/24

Status: Confirmed
Project: yangtools
Component/s: parser
Affects Version/s: None
Fix Version/s: 14.0.0

Type: Improvement Priority: High
Reporter: Robert Varga Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to YANGTOOLS-1474 Fail to process augmentation with emp... Resolved

 Description   

BuildGlobalContext.sources is a HashSet, which is directly populated from user's interaction with BuildAction.

This unfortunately means the order in which sources are processed is not predictable, and further the lifecycle is not explicit – when we execute build(), we really do not want to allow any sources to be added, ever.

The way this should work is that BuildAction uses a ImmutableSet.Builder, which retains insertion order, and we push the sources down when we do build().

The second part is that all of the UT infra must be updated to randomize the order in which it calls Builder.addSource(), unless explicitly requested to retain order – that way we get fuzzing in UT, while YANGTOOLS-1474 tests will request an explicit order (and thus will not have to be repeated).


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