Setup:
Create NamespaceOne
Create NamespaceTwo
Create Topic NamespaceOne.SomeTopic with the following
text:
SomeProperty: 1
Create Topic NamespaceTwo.SomeOtherTopic with the
following text:
SomeProperty: 1
Now on another page (it doesn't matter where, say
NamespaceOne.HomePage add this text)
GetTopicsPropertyBroken:{aTopic|
aTopic.Namespace.AllTopicsWith("SomeProperty")
}
GetTopicsPropertyWorking:{aTopic|
aTopic.Namespace.Topics.Select{ e |
e.HasProperty("SomeProperty") }
}
----
Broken:
@@GetTopicsPropertyBroken(federation.GetTopicInfo("NamespaceOne.HomePage"))@@
@@GetTopicsPropertyBroken(federation.GetTopicInfo("NamespaceTwo.HomePage"))@@
Working:
@@GetTopicsPropertyWorking(federation.GetTopicInfo("NamespaceOne.HomePage"))@@
@@GetTopicsPropertyWorking(federation.GetTopicInfo("NamespaceTwo.HomePage"))@@
Expected Result: the Broken: section should return
SomeTopic and SomeOther Topic, as the Working: section does
Observed Result: the Broken section returns SomeTopic
twice, while the Working: section returns the expected
value.
The bug seems to be that ContentBase.AllTopicsWith()
caches the value for SomeProperty without respecting
the namespace. Then, when the second call happens on a
different namespace, the cached value is returned.
You can verify this by reversing the order in Broken:
to this
@@GetTopicsPropertyBroken(federation.GetTopicInfo("NamespaceTwo.HomePage"))@@
@@GetTopicsPropertyBroken(federation.GetTopicInfo("NamespaceOne.HomePage"))@@
and now SomeOtherTopic is returned twice.
Logged In: YES
user_id=879696
Just for the record, I'm working on rewriting the caching
logic in a big way right now. It'll be a while before it's
done, so someone else may want to address this bug in the
interim, but my planned implementation will cache
per-namespace, and therefore shouldn't have this problem.