Skip to content

--cartesian is parsed and never read: sweeps silently produce the wrong run count #674

Closed

Description

@scttfrdmn

Found by TestLaunchFlagsAreWired, the class gate added with #667.

--cartesian ("Generate cartesian product of parameter lists") is bound to the cartesian global in cmd/launch_flags.go:333 and nothing reads it.

The underlying capability exists — pkg/params/expandGrid (parser.go:147) returns the cartesian product of named value lists — but it is only reachable through the grid: key in a params file. The flag that advertises it on the command line does nothing.

Why it matters more than the other two unwired flags

--vpc (#673) and --use-reservation (#675) silently do nothing. This one silently produces the wrong number of runs. A user who writes

spawn launch --param a=1,2,3 --param b=x,y --cartesian

expects 6 instances and gets whatever the non-cartesian path produces (zip/paired or an error), with no warning. For a sweep that is a wrong-results bug, and it bills real money either way — a wrongly-expanded sweep is wasted spend plus a hole in the result set that is easy to miss.

Fix

Wire cartesian into sweep parameter expansion so --param lists are crossed via the existing expandGrid, and reject --cartesian with a single --param list (nothing to cross) rather than silently no-op'ing. Worth a test asserting the run COUNT for a 3x2 case, since that is the observable.

Listed in knownUnwiredFlags so the gate stays green until this is fixed.

Activity

  1. added
    bug
    on Oct 4, 2026
  2. scttfrdmn commented on Oct 5, 2026

    @scttfrdmn
    ContributorAuthor

    Correcting my own framing before closing this.

    I wrote that --cartesian "silently produces the wrong run count". That is wrong. With a param file the run count comes from params:/grid:, and the flag is simply inert — there is no alternate interpretation for it to produce. I over-stated the consequence, and the "costliest of the three" ranking I gave it in the triage order was wrong for the same reason.

    What is actually true is narrower and still worth fixing: the flag advertises a capability, does nothing, and says nothing.

    And it should not be implemented

    Looking at what it would cross:

    • The cartesian product already exists as the param file's grid: key (pkg/params.expandGrid), which takes named value lists and yields one param set per combination.
    • The input the flag implies — a repeatable --param lr=0.1,0.2 — does not exist. There is no such flag.
    • --params is inline JSON and currently returns inline --params not yet implemented, use --param-file for now — which fails closed with a clear message, so that one is honest.
    • params: in a file is already a list of complete sets, so there are no lists to cross.

    So implementing --cartesian would mean adding a second way to do something grid: already does, for an input format that doesn't exist. Deprecated toward grid: instead:

    $ spawn launch x --cartesian ...
    Flag --cartesian has been deprecated, it never did anything; use the param file's grid: key for a cartesian product
    

    Same treatment for #675 (--use-reservation → --reservation-id), which is the same shape: inert, superseded, and now warning rather than silent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions