I temporarily decided to make any history snapshot up to date in its form with "retroactive upcasting" technique. This means that any snapshot is always compliant with the current schema. This will allow us to throw away any upcaster which should be there only for a time limited to allow a massive retroactive resnapshot. We may argue that this can be not enought considering that if some structure used in the aggregate and involved in some events may evolve as well and if they are argument for any existing stored event, they will break the old event. The initial suggested policy was to mantain any existing event using an old version of a type and and then add a new event case using the new type. However this has the drawback of forcing the need of keeping old objects and related upcasters anyway. A uniform way to handle this is start thinking of a upcaster also for the events. That means that there may be an event like Foo of Bar and if Bar evolves to a new type, we should be able to upcast the old event Foo of Bar to a newer one using the new version of Bar.
Recap: think of a policy to do a massive upcast of old events if they use a type that has been evolved/changed using the fact that that object has to implement an Upcast. If this strategy succeeds then it means any upcaster can be dismissed after massive upcaste applied to old snapshots (which is already there) and events (which is the stuff I want to implement now with this task).
Note: if any aggregate upcast that implies also the upcast of an objec of type X that is involved in any event, then the error implied by the presence of those events will be evident as in the console you will clearly see that some events cannot be read and processed.
I temporarily decided to make any history snapshot up to date in its form with "retroactive upcasting" technique. This means that any snapshot is always compliant with the current schema. This will allow us to throw away any upcaster which should be there only for a time limited to allow a massive retroactive resnapshot. We may argue that this can be not enought considering that if some structure used in the aggregate and involved in some events may evolve as well and if they are argument for any existing stored event, they will break the old event. The initial suggested policy was to mantain any existing event using an old version of a type and and then add a new event case using the new type. However this has the drawback of forcing the need of keeping old objects and related upcasters anyway. A uniform way to handle this is start thinking of a upcaster also for the events. That means that there may be an event like
Foo of Barand if Bar evolves to a new type, we should be able to upcast the old eventFoo of Barto a newer one using the new version of Bar.Recap: think of a policy to do a massive upcast of old events if they use a type that has been evolved/changed using the fact that that object has to implement an Upcast. If this strategy succeeds then it means any upcaster can be dismissed after massive upcaste applied to old snapshots (which is already there) and events (which is the stuff I want to implement now with this task).
Note: if any aggregate upcast that implies also the upcast of an objec of type X that is involved in any event, then the error implied by the presence of those events will be evident as in the console you will clearly see that some events cannot be read and processed.