---
type: Web Page
title: "Wave membership"
description: "One active planning claim per order revision, including the same order received twice under two numbers."
resource: "https://racksort.com/decisions/wave"
---

# Wave membership

One active planning claim per order revision, including the same order received twice under two numbers.

Request with `"decision": "wave"` and one of these operations: `claim`.

## Clauses applied

- `reserve.upstream`: Upstream changes do not overwrite claimed scope.
- `wave.one`: Each order revision has at most one active planning/released membership.
- `wave.reuse`: The planner first atomically claims each order revision into one active WaveOrders membership and Orders.ActiveWave; repeated schedule runs reuse it.

## Evidence questions

### `same_order@1`
These two orders are both open in the warehouse. Are they the same customer order received twice?

| Answer | Meaning |
| --- | --- |
| `true` | One is a resend, re-import or copy of the other: the same purchase received twice. |
| `false` | They are separate purchases, even with identical lines, such as a replacement shipment, a reorder or a customer's deliberate split. |

## Examples

### The same PO received twice
```
{
  "decision": "wave",
  "proposal": {
    "operation": "claim",
    "wave": "WV-0418"
  },
  "order": {
    "id": "SO-88231",
    "revision": 0,
    "source_record_id": "edi-850-552190",
    "customer": "Brightline Home",
    "customer_po": "PO-4471",
    "ship_to": "Brightline Home DC 3, 1200 Commerce Pkwy, Joliet IL",
    "received_at": "2026-10-02T09:14:00-05:00",
    "lines": [
      {
        "sku": "LMP-ARC-BRS",
        "qty": "24"
      }
    ],
    "notes": "Resent by EDI provider after 997 timeout"
  },
  "open_orders": [
    {
      "id": "SO-88207",
      "source_record_id": "edi-850-552188",
      "customer": "Brightline Home",
      "customer_po": "4471",
      "ship_to": "Brightline Home DC 3, 1200 Commerce Parkway, Joliet, IL",
      "received_at": "2026-10-02T08:51:00-05:00",
      "lines": [
        {
          "sku": "LMP-ARC-BRS",
          "qty": "24"
        }
      ],
      "active_wave": "WV-0417"
    }
  ]
}
```
Response from the rules with no model loaded, so every question abstains.
```
{
  "verdict": "review",
  "next": {
    "action": "confirm_not_duplicate",
    "text": "Order SO-88231 may be a second copy of SO-88207, which is already in an active wave, and the comparison is not certain or was not made.",
    "role": "Warehouse Manager"
  },
  "questions": [
    {
      "ask": "open_orders/0",
      "question": "same_order@1",
      "status": "model_unavailable",
      "evidence": [
        "/order",
        "/open_orders/0"
      ]
    }
  ]
}
```
[Run this example in the console](https://racksort.com/console?example=wave-duplicate-order.json)[Download the request](https://racksort.com/examples/wave-duplicate-order.json)

## Call it from your code
Each snippet sends the first example above to the hosted API with the key in `RACKSORT_API_KEY` and prints the verdict and the next step. [Create an account](https://racksort.com/signup), then [create a key](https://racksort.com/account). The [quickstart](https://racksort.com/docs/quickstart) walks through the first request.
### curl
```
export RACKSORT_API_KEY="paste-your-key-here"
curl https://racksort.com/api/v1/decide \
  -H "Authorization: Bearer $RACKSORT_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'EOF'
{
  "decision": "wave",
  "proposal": {
    "operation": "claim",
    "wave": "WV-0418"
  },
  "order": {
    "id": "SO-88231",
    "revision": 0,
    "source_record_id": "edi-850-552190",
    "customer": "Brightline Home",
    "customer_po": "PO-4471",
    "ship_to": "Brightline Home DC 3, 1200 Commerce Pkwy, Joliet IL",
    "received_at": "2026-10-02T09:14:00-05:00",
    "lines": [
      {
        "sku": "LMP-ARC-BRS",
        "qty": "24"
      }
    ],
    "notes": "Resent by EDI provider after 997 timeout"
  },
  "open_orders": [
    {
      "id": "SO-88207",
      "source_record_id": "edi-850-552188",
      "customer": "Brightline Home",
      "customer_po": "4471",
      "ship_to": "Brightline Home DC 3, 1200 Commerce Parkway, Joliet, IL",
      "received_at": "2026-10-02T08:51:00-05:00",
      "lines": [
        {
          "sku": "LMP-ARC-BRS",
          "qty": "24"
        }
      ],
      "active_wave": "WV-0417"
    }
  ]
}
EOF
```
### Python
Python 3.8 or newer, standard library only. Keep the `User-Agent` header: requests with Python's default one are refused. With `requests` or `httpx` it is not needed.
```
import json
import os
import urllib.error
import urllib.request

request = {
    "decision": "wave",
    "proposal": {
        "operation": "claim",
        "wave": "WV-0418",
    },
    "order": {
        "id": "SO-88231",
        "revision": 0,
        "source_record_id": "edi-850-552190",
        "customer": "Brightline Home",
        "customer_po": "PO-4471",
        "ship_to": "Brightline Home DC 3, 1200 Commerce Pkwy, Joliet IL",
        "received_at": "2026-10-02T09:14:00-05:00",
        "lines": [
            {
                "sku": "LMP-ARC-BRS",
                "qty": "24",
            },
        ],
        "notes": "Resent by EDI provider after 997 timeout",
    },
    "open_orders": [
        {
            "id": "SO-88207",
            "source_record_id": "edi-850-552188",
            "customer": "Brightline Home",
            "customer_po": "4471",
            "ship_to": "Brightline Home DC 3, 1200 Commerce Parkway, Joliet, IL",
            "received_at": "2026-10-02T08:51:00-05:00",
            "lines": [
                {
                    "sku": "LMP-ARC-BRS",
                    "qty": "24",
                },
            ],
            "active_wave": "WV-0417",
        },
    ],
}

call = urllib.request.Request(
    "https://racksort.com/api/v1/decide",
    data=json.dumps(request).encode(),
    headers={
        "Authorization": f"Bearer {os.environ['RACKSORT_API_KEY']}",
        "Content-Type": "application/json",
        # Cloudflare refuses Python's default User-Agent, so name the client.
        "User-Agent": "racksort-example/1.0",
    },
)
try:
    with urllib.request.urlopen(call, timeout=30) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise SystemExit(json.load(error)["error"]["message"])
print(result["verdict"], "-", result["next"]["text"])
```
### TypeScript
Node.js 18 or newer. Save it as `decide.mts` and run `npx tsx decide.mts`.
```
type Verdict = "allow" | "replay" | "reject" | "review" | "reconcile";
interface Decision {
  verdict: Verdict;
  state?: string;
  next: { action: string; text: string; role?: string };
}

const request = {
  "decision": "wave",
  "proposal": {
    "operation": "claim",
    "wave": "WV-0418"
  },
  "order": {
    "id": "SO-88231",
    "revision": 0,
    "source_record_id": "edi-850-552190",
    "customer": "Brightline Home",
    "customer_po": "PO-4471",
    "ship_to": "Brightline Home DC 3, 1200 Commerce Pkwy, Joliet IL",
    "received_at": "2026-10-02T09:14:00-05:00",
    "lines": [
      {
        "sku": "LMP-ARC-BRS",
        "qty": "24"
      }
    ],
    "notes": "Resent by EDI provider after 997 timeout"
  },
  "open_orders": [
    {
      "id": "SO-88207",
      "source_record_id": "edi-850-552188",
      "customer": "Brightline Home",
      "customer_po": "4471",
      "ship_to": "Brightline Home DC 3, 1200 Commerce Parkway, Joliet, IL",
      "received_at": "2026-10-02T08:51:00-05:00",
      "lines": [
        {
          "sku": "LMP-ARC-BRS",
          "qty": "24"
        }
      ],
      "active_wave": "WV-0417"
    }
  ]
};

const response = await fetch("https://racksort.com/api/v1/decide", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RACKSORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(request),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
const result = body as Decision;
console.log(result.verdict, "-", result.next.text);
```
## Request schema

```
{
  "type": "object",
  "required": [
    "decision",
    "proposal",
    "order"
  ],
  "additionalProperties": false,
  "properties": {
    "decision": {
      "const": "wave"
    },
    "proposal": {
      "type": "object",
      "required": [
        "operation",
        "wave"
      ],
      "additionalProperties": false,
      "properties": {
        "operation": {
          "type": "string",
          "enum": [
            "claim"
          ]
        },
        "wave": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      }
    },
    "order": {
      "type": "object",
      "required": [
        "id",
        "revision"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "revision": {
          "type": "integer",
          "minimum": 0
        },
        "source_record_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "customer": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "customer_po": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "ship_to": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4000
        },
        "received_at": {
          "type": "string",
          "format": "date-time"
        },
        "lines": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "sku",
              "qty"
            ],
            "additionalProperties": false,
            "properties": {
              "sku": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "qty": {
                "type": "string",
                "format": "decimal"
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4000
              }
            }
          },
          "maxItems": 200
        },
        "notes": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4000
        }
      }
    },
    "memberships": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "order",
          "revision",
          "wave",
          "status"
        ],
        "additionalProperties": false,
        "properties": {
          "order": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "wave": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "Planning",
              "Released",
              "Closed",
              "Cancelled"
            ]
          }
        }
      },
      "maxItems": 500
    },
    "open_orders": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "active_wave"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "source_record_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "customer": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "customer_po": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "ship_to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "sku",
                "qty"
              ],
              "additionalProperties": false,
              "properties": {
                "sku": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "qty": {
                  "type": "string",
                  "format": "decimal"
                },
                "description": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 4000
                }
              }
            },
            "maxItems": 200
          },
          "notes": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "active_wave": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        }
      },
      "maxItems": 200
    }
  }
}
```
