Skip to content

fix(sell): keep multi-currency --accept whole (disable cli/v3 comma split)#665

Open
bussyjd wants to merge 1 commit into
mainfrom
fix/accept-slice-comma-split
Open

fix(sell): keep multi-currency --accept whole (disable cli/v3 comma split)#665
bussyjd wants to merge 1 commit into
mainfrom
fix/accept-slice-comma-split

Conversation

@bussyjd

@bussyjd bussyjd commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #664. Multi-currency --accept offers could not be created from the CLI — every attempt failed with network is required even when network= was present.

--accept is a cli.StringSliceFlag, and cli/v3 splits slice-flag values on , by default. One --accept is meant to be a single comma-separated key=value list (token=X,network=Y,price=Z), and parseAcceptKV already splits on , itself — so cli/v3 shredded each option into fragments first:

--accept token=USDC,network=base,price=0.03  →  ["token=USDC", "network=base", "price=0.03"]

buildAcceptPayments then read the first fragment (token=USDC) as a whole option with no network → network is required. The grouping is lost in the split, so it must be prevented up front.

Fix

Set DisableSliceFlagSeparator: true on the three commands that carry --accept (sell http, sell agent, sell update). Each --accept now arrives whole; parseAcceptKV keeps doing the intra-option , split.

The repeatable --register-skills / --register-domains / --register-metadata flags on those commands are unaffected in practice: each value is a single token or key=value pair, and nothing in the repo passes them comma-joined (verified with a repo-wide grep). Repeating the flag still works exactly as before.

Test

accept_test.go's existing tests call parseAcceptOption / buildAcceptPayments directly and bypass cli/v3 argv parsing, which is why they never caught this. Added TestSellAccept_CommaSeparatorDisabled:

  • Structural guard — asserts all three commands keep DisableSliceFlagSeparator: true.
  • Behavioral — drives real cli/v3 argv parsing: with the separator disabled the two --accept options arrive whole and build two payments; the negative control (default separator) shreds them into 6 fragments and fails to build, proving the field is load-bearing.
go test ./cmd/obol/   # ok
go vet  ./cmd/obol/   # clean

Manual verification

obol sell http ... --accept token=USDC,network=base,price=0.03 --accept token=OBOL,network=ethereum,price=0.0001 now produces a ServiceOffer with both spec.payments[] entries directly — no kubectl patch workaround.

…plit)

cli/v3 StringSliceFlag splits each value on "," by default. Since one
--accept is a comma-separated key=value list (token=X,network=Y,price=Z)
and parseAcceptKV already splits on "," itself, cli/v3 shredded each
option into fragments before parsing, so the first fragment had no
network and every multi-currency offer failed with "network is required".
Multi-currency offers were unreachable from the CLI; the only workaround
was a single-currency offer plus a manual kubectl patch of spec.payments[].

Set DisableSliceFlagSeparator: true on the commands that carry --accept
(sell http, sell agent, sell update) so each --accept arrives whole;
parseAcceptKV keeps doing the intra-option "," split. The repeatable
--register-skills/-domains/-metadata flags are unaffected in practice
(each value is a single token or key=value; nothing passes them
comma-joined).

Add a regression test that drives real cli/v3 argv parsing (the existing
accept_test.go tests called parseAcceptOption/buildAcceptPayments directly
and bypassed cli/v3, so they never caught this), with a negative control
proving the field is load-bearing.

Fixes #664

Claude-Session: https://claude.ai/code/session_01AtSvU6TbF54ywnqJ2dGHAp
@bussyjd bussyjd requested a review from OisinKyne June 24, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sell --accept: cli/v3 comma-splits the value → "network is required" (multi-currency offers unreachable from CLI)

1 participant