We had an issue that caused a new AggregateFeature created when calling Feature::refresh_aggregates would be created but have a type of Feature instead of AggregateFeature. We need a test that ensures this does not happen in the future. See de34b3e#diff-53338a6893cd7e098383199d46a20a3cR38.