Why is @Validate treated as a mutating rule?

Imagine I have a @Validate rule whose subject is of type ModelMap<SomeSourceSet>. I try to use map.values().each() to iterate over all the source sets, but doing so results in an error “Attempt to read a write only view of model of type…”. So I end up using .afterEach(), which is weird because I’m not attempting to configure the source sets, only validate them.

I use map.values().each() when ModelMap<...> is a rule input and that works fine.

Sounds like not intended behaviour to me. Not sure if this is something we have already on our radar to fix. Maybe @CedricChampeau or @lptr can help out here?

I think that the issue is more that each is assumed as a mutating operation. But I need to create a more complete example to check this.

Edit: It looks like a real bug, there’s a ticket in scope for this in our internal tracker.