Data source caching and dependencyForwardingSceneIndex

Hello,

We are looking for some clarifications on the use of HdDependencyForwardingSceneIndex, as well as data source caching.

Suppose the following example : we have a scene index which creates some prims and sets up dependencies using HdDependenciesSchema/HdDependencySchema. Later down the chain, there is a scene index that caches prims and data sources. Then finally, we have the HdDependencyForwardingSceneIndex at the end.

Since the HdDependencyForwardingSceneIndex is at the end and the propagated dirty dependencies will only be sent from there, is there not a risk that when a dependency is dirtied and the render delegate (or any downstream scene index) queries the updated prim or data source, it actually ends up retrieving an old cached value from the intermediary caching scene index?

A similar but slightly different case without HdDependencyForwardingSceneIndex : suppose we have a scene index that creates some prims, and a downstream scene index that caches prims and data sources. Now suppose that we dirty the primvars/points data source. Could the caching scene index end up querying its cached primvars data source, and thus also getting the old points data source again?

It seems like the only way to handle data sources with values that can change based on certain conditions, is to create a custom parent data source that will return the correct/updated child data source, so that even if the parent data source is cached, it will still return the correct value when re-queried. Either that, or dirty the entire root data source whenever something changes so that the entire cache is rebuilt, which sounds inefficient. Is that correct, or are there other avenues?

Thanks!