@Override
    public Model onRemove(ModelTransformer transformer, Collection<Shape> shapes, Model model) {
        Map<ShapeId, ServiceShape.Builder> updatedServices = new HashMap<>();

        model.shapes(ServiceShape.class).forEach(service -> {
            for (Shape shape : shapes) {
                if (service.getRename().containsKey(shape.getId())) {
                    updatedServices
                            .computeIfAbsent(service.getId(), id -> service.toBuilder())
                            .removeRename(shape);
                }
            }
        });

        if (updatedServices.isEmpty()) {
            return model;
        }

        Set<Shape> shapesToReplace = updatedServices.values()
                .stream()
                .map(ServiceShape.Builder::build)
                .collect(Collectors.toSet());
        return transformer.replaceShapes(model, shapesToReplace);
    }
Removes "rename" entries from service shapes when a shape is removed.
smithy-model/src/main/java/software/amazon/smithy/model/transform/plugins/CleanServiceRenames.java