same stuff?
Build and Publish / BuildAndDeployAmd64 (push) Failing after 4s
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s

This commit is contained in:
2026-07-03 23:11:25 +02:00
parent 8bb0a7a786
commit dddb5c699a
4 changed files with 47 additions and 45 deletions
+15 -7
View File
@@ -19,16 +19,15 @@ two-file version, the grouping is real.
| `mutation_set_recovery_contact.go` (+ tests) | Recovery | — | `state.Recovery`, `state.UpdatedAt` |
| `mutation_subscription_added.go` | Subscription | `state.Items` | `state.Subscriptions`, `state.UpdatedAt` |
| `mutation_upsert_subscriptiondetails.go` | Subscription details | `state.Subscriptions` | `state.Subscriptions`, `state.UpdatedAt` |
| `mutation_remove_line_item_marking.go` | Markings | `state.Items[idx].Markings` | `state.Items[idx].Markings`, `state.UpdatedAt` |
| `mutation_line_item_marking.go` | Markings apply | `state.Items[idx].Markings` | `state.Items[idx].Markings`, `state.UpdatedAt` |
| `mutation_markings.go` (`mutation_line_item_marking.go` and `mutation_remove_line_item_marking.go` merged) | Markings apply/remove | `state.Items[idx].Markings` | `state.Items[idx].Markings`, `state.UpdatedAt` |
## Delete-test quick check
For any proposed grouping (e.g. merge all `marking*` mutations into one
file), ask: does deleting the merged file concentrate complexity, or just
move lines? For markings — yes, the shared logic (cascade to pricing) makes
the merge worthwhile. For `voucher` vs `custom_fields` — no, those read
different state and have different error contracts; keep separate.
For any proposed grouping, ask: does deleting the merged file concentrate
complexity, or just move lines? For markings — yes, the shared logic
(cascade to pricing) makes the merge worthwhile, and the merge is now done
(see below). For `voucher` vs `custom_fields` — no, those read different
state and have different error contracts; keep separate.
### What is already merged
@@ -60,6 +59,15 @@ If a future merge lands, follow the same pattern: read the actual source
to verify the row's claimed state surface, and prune label-noise before
compressing two rows into one.
`pkg/cart/mutation_markings.go` (added 2025-07) — LineItemMarking and
RemoveLineItemMarking both touch `state.Items[idx].Markings` and share
the same item-lookup loop (find by ID, mutate `Marking` field). Merge
passed the delete-test: the shared write surface and identical error
contract ("item with ID %d not found") make the grouping real. No test
files existed for either mutation, so the test surface is unchanged.
Verified: `go build ./pkg/cart/...` and `go test -count=1 ./pkg/cart/...`
clean.
### NOT to merge next
`mutation_change_quantity.go` looks like an obvious candidate for the next
-20
View File
@@ -1,20 +0,0 @@
package cart
import (
"fmt"
messages "git.k6n.net/mats/go-cart-actor/proto/cart"
)
func LineItemMarking(grain *CartGrain, req *messages.LineItemMarking) error {
for i, item := range grain.Items {
if item.Id == req.Id {
grain.Items[i].Marking = &Marking{
Type: req.Type,
Text: req.Marking,
}
return nil
}
}
return fmt.Errorf("item with ID %d not found", req.Id)
}
+32
View File
@@ -0,0 +1,32 @@
package cart
import (
"fmt"
messages "git.k6n.net/mats/go-cart-actor/proto/cart"
)
// LineItemMarking sets a marking on the line item with the given ID.
func LineItemMarking(grain *CartGrain, req *messages.LineItemMarking) error {
for i, item := range grain.Items {
if item.Id == req.Id {
grain.Items[i].Marking = &Marking{
Type: req.Type,
Text: req.Marking,
}
return nil
}
}
return fmt.Errorf("item with ID %d not found", req.Id)
}
// RemoveLineItemMarking clears the marking on the line item with the given ID.
func RemoveLineItemMarking(grain *CartGrain, req *messages.RemoveLineItemMarking) error {
for i, item := range grain.Items {
if item.Id == req.Id {
grain.Items[i].Marking = nil
return nil
}
}
return fmt.Errorf("item with ID %d not found", req.Id)
}
@@ -1,18 +0,0 @@
package cart
import (
"fmt"
messages "git.k6n.net/mats/go-cart-actor/proto/cart"
)
func RemoveLineItemMarking(grain *CartGrain, req *messages.RemoveLineItemMarking) error {
for i, item := range grain.Items {
if item.Id == req.Id {
grain.Items[i].Marking = nil
return nil
}
}
return fmt.Errorf("item with ID %d not found", req.Id)
}