code: private void verifyScopeChangesHaveBeenRecorded(String passName, Node root) {
      final String passNameMsg = passName.isEmpty() ? "" : passName + ": ";
  
      // Gather all the scope nodes that existed when the snapshot was taken.
      final Set<Node> snapshotScopeNodes = new HashSet<>();
      NodeUtil.visitPreOrder(
          clonesByCurrent.get(root),
          new Visitor() {
            @Override
            public void visit(Node oldNode) {
              if (NodeUtil.isChangeScopeRoot(oldNode)) {
                snapshotScopeNodes.add(oldNode);
              }
            }
          });
  
      NodeUtil.visitPreOrder(
          root,
          new Visitor() {
            @Override
            public void visit(Node n) {
              if (n.isRoot()) {
                verifyRoot(n);
              } else if (NodeUtil.isChangeScopeRoot(n)) {
                Node clone = clonesByCurrent.get(n);
                // Remove any scope nodes that still exist.
                snapshotScopeNodes.remove(clone);
                verifyNode(passNameMsg, n);
                if (clone == null) {
                  verifyNewNode(passNameMsg, n);
                } else {
                  verifyNodeChange(passNameMsg, n, clone);
                }
              }
            }
          });
  
      // Only actually deleted snapshot scope nodes should remain.
      verifyDeletedScopeNodes(passNameMsg, snapshotScopeNodes);
    }
docs: Checks that the scope roots marked as changed have indeed changed