This is correct. trimv2 resulted in
    service: a: {}
but that creates an open list, rather than a closed list.
The result here,
    service: a: ports: [_, _]
is correct. You can observe the difference by adding
    x: service.a.ports & [_,_,_]
which *should* cause an error.
-- in.cue --
service: [string]: {
	ports: [{a: 1}, {a: 1}, ...{ extra: 3 }]
}
service: a: {
	ports: [{a: 1}, {a: 1,}]
}
-- out/trim-v3 --
== in.cue
service: [string]: {
	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
}
service: a: {
	ports: [_, _]
}
-- diff/-out/trim-v3<==>+out/trim --
diff old new
--- old
+++ new
@@ -2,4 +2,6 @@
 service: [string]: {
 	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
 }
-service: a: {}
+service: a: {
+	ports: [_, _]
+}
-- out/trim-v3-noshare --
== in.cue
service: [string]: {
	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
}
service: a: {
	ports: [_, _]
}
-- diff/-out/trim-v3-noshare<==>+out/trim --
diff old new
--- old
+++ new
@@ -2,4 +2,6 @@
 service: [string]: {
 	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
 }
-service: a: {}
+service: a: {
+	ports: [_, _]
+}
-- out/trim --
== in.cue
service: [string]: {
	ports: [{a: 1}, {a: 1}, ...{extra: 3}]
}
service: a: {}
