Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Groom the inventory operations plan for implementation

Łukasz Adamczyk85940e0d2f6e
diff --git a/docs/plans/6.0-inventory-operations.md b/docs/plans/6.0-inventory-operations.md
index 665f09ef6f..2393378a8c 100644
--- a/docs/plans/6.0-inventory-operations.md
+++ b/docs/plans/6.0-inventory-operations.md
@@ -1,10 +1,10 @@
# Inventory Operations (Transfers + Purchase Orders + Lots + Variant History)
-**Status:** Draft
+**Status:** In Progress — the 6.0 half (transfers, purchase orders, suppliers, history screens) implemented 2026-09-07; lot capture stays 6.1
**Target:** Spree 6.0 (transfers, purchase orders, history) / 6.1 (simple lot capture). **Tier split 2026-09-07:** the lot LIBRARY — received-lot inventory, quantities, expiry, FIFO/FEFO auto-allocation — moved to Enterprise (`ee/docs/plans/inventory-lots.md`); OSS keeps the traceability capture below.
**Depends on:** Typed Stock Movements (6.0-typed-stock-movements.md), Fulfillment & Delivery (6.0-fulfillment-and-delivery.md), Stock Reservations (6.0-stock-reservations.md)
**Author:** Damian + Claude
-**Last updated:** 2026-08-30
+**Last updated:** 2026-09-07 (grooming: open questions 1-3 settled, implementation decisions recorded below)
> **Naming note (2026-07-14):** the procurement-source model this plan introduces is **`Spree::Supplier`** (`spree_suppliers`, prefix `sup_`, `/api/v3/admin/suppliers`). An earlier draft called it `Spree::Seller`, which collided with the marketplace seller model of `6.0-multi-vendor-marketplace.md` — `Spree::Seller` is reserved for marketplace sellers (see `decisions.md` 2026-07-14). "Supplier" also matches Shopify's purchase-order vocabulary.
@@ -59,7 +59,7 @@ Once `6.0-typed-stock-movements.md` lands, every change to `count_on_hand` carri
### Transfers
-- **`Spree::StockTransfer` gets a `status` column** with values `draft | ready_to_ship | in_transit | partially_received | received | cancelled`. State machine via `state_machines-activerecord`, column name `status` per `6.0-normalize-state-to-status.md`.
+- **`Spree::StockTransfer` gets a `status` column** with values `draft | ready_to_ship | in_transit | partially_received | received | canceled`, declared with `Spree::HasStatus` and moved by workflows (see the 2026-09-07 decisions below). No state machine.
- **Two-phase stock movement**, mirroring Shopify. Source's `count_on_hand` decrements on `mark_in_transit`. Destination's `count_on_hand` increments on `receive` (potentially partial). Between those two events, the units are in flight — physically gone from the source, not yet at the destination.
- **First-class line items.** New table `spree_stock_transfer_items` with `(stock_transfer_id, variant_id, quantity_shipped, quantity_received, condition)`. Replaces today's "implicit line item via stock_movement.stock_item.variant".
- **Partial receive is the default model.** The receive screen edits `quantity_received` per item. If `SUM(quantity_received) < SUM(quantity_shipped)`, status becomes `partially_received`; when equal, `received`. A `discrepancy_reason` column on the line item captures "damaged in transit / lost / undercount" for the gap.
@@ -70,7 +70,7 @@ Once `6.0-typed-stock-movements.md` lands, every change to `count_on_hand` carri
- **New model `Spree::PurchaseOrder`**, not an STI subclass of `StockTransfer`. The two share a UX rhythm (line items → receive flow) but their domains are distinct (supplier vs warehouse, unit cost vs no cost, AP vs internal logistics). STI would force one table to carry both vocabularies. Better to have parallel models with a shared `Receivable` concern that owns the line-items + receive-flow + status machine.
- **`Spree::Supplier` is the supplier identity.** Minimal: `name`, `contact_name`, `email`, `phone`, `address`, `notes`, `metadata`. Stores manage their own supplier list — suppliers are not shared across stores in 6.0.
-- **Status machine**: `draft | ordered | partially_received | received | cancelled`. No `in_transit` — a PO doesn't track in-flight stock from the supplier; the merchant only knows about it when units land. (Future enhancement: optional `shipped` state if the supplier provides tracking, but not in 6.0.)
+- **Statuses**: `draft | ordered | partially_received | received | canceled`. No `in_transit` — a PO doesn't track in-flight stock from the supplier; the merchant only knows about it when units land. (Future enhancement: optional `shipped` state if the supplier provides tracking, but not in 6.0.)
- **`PurchaseOrderItem` has `unit_cost` (Money) and `quantity_ordered` / `quantity_received`.** Currency comes from the PO's `currency` column (defaults to the store's). Receiving units writes typed `received` stock movements with `purchase_order_id`.
- **PO does not affect `count_on_hand` until receive.** Ordered units are visible to the merchant as "on order" (computed: `SUM(quantity_ordered - quantity_received)` per variant), but never count toward availability.
@@ -96,7 +96,70 @@ Once `6.0-typed-stock-movements.md` lands, every change to `count_on_hand` carri
surface regardless of tier.
- Store API: nothing — lots are back-office data.
-### Typed Stock Movements wiring### Typed Stock Movements wiring
+### Implementation decisions (2026-09-07)
+
+Settled interactively before implementation; they replace the parts of this
+plan written against 5.x idioms that 6.0 has since retired.
+
+- **No state machines — `Spree::HasStatus` plus workflows.** `state_machines-activerecord` is not a
+ dependency of 6.0 (`6.0-normalize-state-to-status.md`, `6.0-service-workflows.md` decision 11), so
+ the `state_machine :status do … end` blocks below are read as intent, not as code. Both models
+ `include Spree::HasStatus` and declare `has_status …, default: :draft`; every transition is a
+ workflow in `app/workflows/spree/stock_transfers/` and `app/workflows/spree/purchase_orders/`,
+ registered on `Spree::Dependencies` as `stock_transfer_*_workflow` /
+ `purchase_order_*_workflow`. This is what makes a receive able to carry the quantities the
+ warehouse counted and a cancellation able to carry the merchant's restock-or-write-off choice —
+ arguments a transition callback could not take. The guards the state machine expressed
+ (`from: :in_transit`) become the workflows' own status checks.
+- **The one-shot `StockTransfer.transfer` / `.receive` class methods are removed outright.** 6.0 is
+ the breaking window (`decisions.md` 2026-08-30 left the choice to this grooming), and a
+ deprecation shim would keep a second write path into `count_on_hand` alive for a release —
+ precisely the thing typed movements exist to prevent. `Spree::StockTransfers::Create` +
+ `MarkInTransit` + `Receive` replace them, and the admin `POST /stock_transfers` now persists a
+ draft instead of moving stock. The unused `type` STI column and the dead `persist: false`
+ movement path go with them.
+- **Legacy source-less transfers are soft-deleted after migration, with a purge task for a later
+ release.** `spree:upgrade:migrate_external_receives_to_purchase_orders` mints the `PO-…`, points
+ the existing movements at it and stamps the `T-…` transfer `deleted_at`, so the old number stays
+ findable for historical reporting without the same receive appearing twice in the admin.
+ `spree:upgrade:purge_migrated_external_receives` removes them when a merchant is ready.
+- **Suppliers and purchase orders are one new permission-catalog resource, `:purchasing`.**
+ `read_purchasing` / `write_purchasing`, registered in
+ `PermissionConfiguration#register_default_resources` alongside `:stock`. The plan's earlier
+ `read_inventory` / `write_inventory` would have put "Stock" and "Inventory" side by side on the
+ roles screen with nothing to tell a merchant which is which. Transfers stay under `stock`, whose
+ subject list gains `Spree::StockTransferItem`.
+- **`spree_stock_transfers` gains its own `store_id`.** Today the table has none, `Spree::Store` has
+ no `stock_transfers` association, and so `Spree::Base.for_store` falls through to `self` — the
+ admin transfers endpoint is not store-scoped at all. The column, `Spree::SingleStoreResource` and
+ a `Store#stock_transfers` association close that, and make transfers obey the same tenancy rule as
+ purchase orders rather than a second one derived from `destination_location`. `#number_store`
+ keeps working and now simply reads `store`.
+- **`source_location_id` stays nullable in the database**, with presence enforced on the model. A
+ `change_column_null … false` would fail on any install still holding external-receive rows, and
+ data transformations belong in rake tasks (CLAUDE.md), so the upgrade task is what empties the
+ column of nulls.
+- **Money is a `decimal(10, 2)` column, not `_cents` + `monetize`.** Spree has no money-rails
+ dependency; `PurchaseOrderItem#unit_cost` follows `Spree::Variant#cost_price`, and the currency
+ comes from the purchase order rather than being repeated per line.
+- **A supplier's address is inline columns**, mirroring `Spree::StockLocation` — the closest
+ precedent for a non-customer entity with a postal address, and the shape a flat v3 payload and a
+ flat dashboard form both want. No `belongs_to :address`.
+- **Suppliers are per store** (`spree_suppliers.store_id`, `Spree::SingleStoreResource`, unique on
+ `(store_id, name)`), settling open question 2. Promoting them to installation-wide later means
+ adding a join table, backfilling one row per existing supplier and keeping `store_id` as the
+ owner — worth knowing, not worth building against.
+- **A receive stamps what the units cost onto the movement.** `spree_stock_movements.unit_cost`
+ (nullable `decimal(10, 2)`) records the price each unit actually landed at, so the rolling
+ average-cost feature of open question 3 has a ledger to read instead of a reconstruction to
+ attempt — including across two partial receives at different prices. `StockLocation#restock` and
+ `#move` take an optional `unit_cost:`; transfers and returns leave it null, because moving stock a
+ merchant already owns is not a purchase.
+- **Status transitions are `PATCH` member routes**, matching `orders/:id/cancel`,
+ `returns/:id/receive` and every other transition already in the Admin API. The plan's claim that
+ these are POSTs describes no existing endpoint.
+
+### Typed Stock Movements wiring
These additions live in `6.0-typed-stock-movements.md`; this plan only consumes them.
@@ -362,7 +425,7 @@ POST /purchase_orders/:id/receive # body: { items: [{ id, qua
POST /purchase_orders/:id/cancel
```
-State-transition endpoints are explicit POSTs (not PATCHes that mutate `status`). This matches the existing pattern for `orders/:id/cancel` etc.
+Each status change is its own member action rather than a `PATCH` that mass-assigns `status`, because each one is a workflow with its own arguments. The verb is `PATCH`, matching `orders/:id/cancel`, `returns/:id/receive` and every other transition already in the Admin API.
`GET /stock_movements` (the audit feed introduced by `6.0-typed-stock-movements.md`) gains support for `q[purchase_order_id_eq]` automatically once the FK is in the ransackable list.
@@ -552,14 +615,16 @@ All other existing transfers (with a real source location) become `status: 'rece
### Phase 3: Model & service code
- New models: `Supplier`, `PurchaseOrder`, `PurchaseOrderItem`, `StockTransferItem`.
-- `StockTransfer` gains a state machine + line items; the old atomic `transfer`/`receive` class methods are removed.
+- `StockTransfer` gains a declared status + line items; the old atomic `transfer`/`receive` class methods are removed.
- New services under `Spree::Inventory::`:
- `Spree::Inventory::SubmitTransfer` (draft → ready_to_ship → in_transit, writes `shipped` movements)
- `Spree::Inventory::ReceiveTransfer` (params: `{ items: [{ id, quantity_received, discrepancy_reason }] }`, writes `received` movements for deltas)
- `Spree::Inventory::CancelTransfer`
- Parallel `Spree::Inventory::SubmitPurchaseOrder` / `Spree::Inventory::ReceivePurchaseOrder` / `Spree::Inventory::CancelPurchaseOrder`
- Each service returns a `ServiceModule::Result` (success/error) — same pattern as existing checkout services.
-- CanCanCan: `Supplier` and `PurchaseOrder` map to a new permission set `Spree::PermissionSets::PurchaseOrderManagement` and `Spree::PermissionSets::PurchaseOrderDisplay`. Stock transfers stay under the existing `StockManagement` / `StockDisplay` sets.
+- Permissions: `Supplier`, `PurchaseOrder` and `PurchaseOrderItem` register as the `:purchasing`
+ catalog resource (`read_purchasing` / `write_purchasing`); `Spree::StockTransferItem` joins the
+ existing `:stock` resource's subject list.
### Phase 4: Admin API + serializers
@@ -587,7 +652,15 @@ All other existing transfers (with a real source location) become `status: 'rece
## Constraints on Current Work
-- **Don't extend the old `StockTransfer.transfer` API.** It is going away. New code should write to `StockTransferItem` and use the state machine.
+- **Don't call `StockTransfer.transfer` or `.receive`.** Both are gone. Moving stock between
+ warehouses is `Spree::StockTransfers::Create` → `MarkInTransit` → `Receive`; receiving from a
+ supplier is a `Spree::PurchaseOrder`.
+- **Don't transition a transfer or a purchase order by writing `status`.** `update(status: …)`
+ passes the inclusion validation and writes no stock movement, which silently desynchronizes the
+ ledger from the shelf. Call the workflow.
+- **Don't reach `Spree::StockTransfer` unscoped.** It carries `store_id` now, so
+ `current_store.stock_transfers` is the lookup — including for the incidental resolution of a
+ `source_location_id` or a `variant_id` out of a payload.
- **Don't add receive flows to `StockTransfer` without `source_location_id`.** Supplier receives move to `PurchaseOrder`. If a 5.5 feature needs to record a supplier receive, scope it minimally and flag it for migration.
- **Don't create a separate "Stock Movements" admin SPA page.** Movement history is always inline on variant + stock location.
- **Don't fold cost data onto `StockTransfer`.** Transfers don't have a unit cost — they move existing inventory between owned locations. Cost lives on `PurchaseOrderItem.unit_cost`.
@@ -595,17 +668,22 @@ All other existing transfers (with a real source location) become `status: 'rece
## Open Questions
-1. **Historical "external receive" transfers — keep or hard-delete after migration?** Soft-keeping preserves audit history at the cost of a confusing dual-source-of-truth (movements visible from both the migrated PO and the legacy transfer). Hard-deleting cleans the model but loses the original `T-xxx` number for historical reporting. Lean toward soft-delete with a release-note + a rake task to purge after one release.
-2. **Suppliers shared across stores?** Today the plan scopes them per-store. Some merchants run multiple storefronts off one supplier base. Could promote to a `Spree::Supplier` with a M2M to stores in a follow-up. Defer.
-3. **Average / weighted-average cost on Variant?** A PO's `unit_cost` enables margin reporting. The natural extension is `Variant.average_cost` (rolling avg of received unit costs) for COGS. Likely worth a separate plan — call it out, don't scope it here.
-4. **Pickup transfers (ship-to-store).** `6.0-fulfillment-and-delivery.md` mentions `pickup_stock_policy: 'any'` as enabling ship-to-store. The natural implementation is auto-creating a `StockTransfer` when a pickup order's items aren't local at the chosen pickup location. Mechanism is straightforward; UX (does the customer see "ready in 3 days" instead of "ready in 2 hours"?) needs a separate decision. Defer.
+1. ~~Historical "external receive" transfers — keep or hard-delete after migration?~~ **Settled
+ 2026-09-07: soft-delete plus a purge task** — see Implementation decisions.
+2. ~~Suppliers shared across stores?~~ **Settled 2026-09-07: per store.** Promotion path recorded
+ in Implementation decisions if a multi-storefront merchant ever asks.
+3. ~~Average / weighted-average cost on Variant?~~ **Partly settled 2026-09-07.** The feature itself
+ is still a separate plan — `Variant#average_cost`, and what returns, write-offs and
+ foreign-currency receives do to it, are not scoped here. What this plan now ships is the ledger
+ it will read: every `received` movement carries the `unit_cost` the units landed at.
+4. **Pickup transfers (ship-to-store).** `6.0-fulfillment-and-delivery.md` mentions `pickup_stock_policy: 'any'` as enabling ship-to-store. The natural implementation is auto-creating a `StockTransfer` when a pickup order's items aren't local at the chosen pickup location. Reviewed 2026-09-07 and deliberately left open: the mechanism is straightforward, but it hangs on a storefront promise ("ready in 3 days" instead of "ready in 2 hours") that belongs to the fulfillment plan, and nothing in the 6.0 transfer lifecycle either enables or forbids it. Unblocked by: a decision on what the pickup date range says when stock has to travel.
5. **Server-side enforcement of `lot_tracked`** — should the fulfill workflow refuse (not just prompt) when a flagged variant ships without lot rows? Advisory in v1 (dashboard requires, server accepts); revisit if merchants report gaps. The library-tier questions (expired lots, flag flips over existing stock) moved to the Enterprise plan.
## References
- Current StockTransfer model: `spree/core/app/models/spree/stock_transfer.rb`
- Current StockTransfer admin controller: `spree/api/app/controllers/spree/api/v3/admin/stock_transfers_controller.rb`
-- Cheap-win route promotion: `packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx` (already top-level after the prep PR)
+- Admin SPA routes: `packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/`, `…/products/purchase-orders/` and `…/settings/suppliers.tsx`
- Depends on: `docs/plans/6.0-typed-stock-movements.md` (movement primitives)
- Depends on: `docs/plans/6.0-fulfillment-and-delivery.md` (Fulfillment writes `shipped`/`allocated`/`released` movements that show up alongside transfer/PO movements in the variant history)
- Related: `docs/plans/6.0-stock-reservations.md` (reservations are checkout-time holds, orthogonal to operational receives)
diff --git a/docs/plans/decisions.md b/docs/plans/decisions.md
index 0c4ae36bc8..86d16313a3 100644
--- a/docs/plans/decisions.md
+++ b/docs/plans/decisions.md
@@ -1,3 +1,87 @@
+## 2026-09-07: Inventory operations grooming — transfers get a status and workflows, supplier receives become purchase orders, and a receive records what the units cost
+
+**Context:** `6.0-inventory-operations.md` was written before three things
+landed that its own code samples assume away: `state_machines-activerecord`
+left the dependency list, permission sets became a registered catalog of
+grant keys, and the `public_metadata`/`private_metadata` pair became one
+`metadata` column. `decisions.md` 2026-08-30 also left one call explicitly to
+this grooming — whether removing the one-shot `StockTransfer.transfer` API
+uses the 6.0 breaking window or ships behind a deprecation bridge. Grooming it
+for implementation surfaced a tenancy hole as well: `spree_stock_transfers`
+has no `store_id`, `Spree::Store` has no `stock_transfers` association, and so
+`Spree::Base.for_store` falls through to `self` — the admin transfers endpoint
+has never been store-scoped.
+
+**Decision:** Seven rulings, all inside the plan's existing design.
+
+**Statuses are declared, transitions are workflows.** `Spree::StockTransfer`
+(`draft | ready_to_ship | in_transit | partially_received | received |
+canceled`) and `Spree::PurchaseOrder` (`draft | ordered | partially_received |
+received | canceled`) both `include Spree::HasStatus`; every move between
+statuses is a workflow under `Spree::StockTransfers::` /
+`Spree::PurchaseOrders::`, registered on `Spree::Dependencies`. This is not
+merely conformance with `6.0-normalize-state-to-status.md`: a receive has to
+carry the quantities the warehouse actually counted and a cancellation has to
+carry the merchant's restock-or-write-off choice, and a transition callback
+takes no arguments. The guards a state machine expressed as `from:` become
+each workflow's own status check.
+
+**The one-shot `StockTransfer.transfer` / `.receive` methods are removed
+outright.** A shim would keep a second write path into `count_on_hand` alive
+through 6.0, which is the exact thing typed movements exist to prevent. The
+admin `POST /stock_transfers` now persists a draft rather than moving stock.
+
+**`spree_stock_transfers` gains its own `store_id`**, closing the scoping hole
+above and giving transfers the same tenancy rule as purchase orders instead of
+a second one derived from `destination_location`. `source_location_id` stays
+nullable in the database with presence enforced on the model — a
+`change_column_null` would fail on any install still holding external-receive
+rows, and emptying that column is the upgrade task's job.
+
+**Legacy source-less transfers are soft-deleted, not dropped.**
+`spree:upgrade:migrate_external_receives_to_purchase_orders` mints the `PO-…`,
+points the existing movements at it and stamps the `T-…` transfer
+`deleted_at`, so the old number stays findable without the same receive
+appearing twice in the admin;
+`spree:upgrade:purge_migrated_external_receives` removes them later.
+
+**Suppliers and purchase orders are one new catalog resource, `:purchasing`**
+(`read_purchasing` / `write_purchasing`), registered beside `:stock` in
+`PermissionConfiguration#register_default_resources`. The plan's earlier
+`read_inventory` / `write_inventory` would have put "Stock" and "Inventory"
+side by side on the roles screen with nothing to tell a merchant which covers
+what. `Spree::StockTransferItem` joins the existing `:stock` subject list.
+
+**Suppliers are per store** — `store_id`, `Spree::SingleStoreResource`, unique
+on `(store_id, name)`. Promoting them to installation-wide later means a join
+table and a one-row-per-supplier backfill; nothing is built against that.
+
+**A receive records what the units cost.**
+`spree_stock_movements.unit_cost` (nullable `decimal(10, 2)`) carries the price
+each unit landed at, so the rolling average-cost feature the plan defers has a
+ledger to read rather than a reconstruction to attempt — including across two
+partial receives at different prices. Transfers and returns leave it null:
+moving stock a merchant already owns is not a purchase. Money is a
+`decimal(10, 2)` column throughout, following `Spree::Variant#cost_price` —
+Spree has no money-rails dependency, so the plan's `_cents` + `monetize` shape
+does not exist.
+
+**Consequences:** `StockTransfer.transfer` and `.receive` are gone at 6.0 and
+need an upgrade note. Never write `status` on a transfer or a purchase order
+directly — it passes the inclusion validation, writes no movement, and
+desynchronizes the ledger from the shelf; call the workflow. Never reach
+`Spree::StockTransfer` unscoped now that it carries `store_id`. Status columns
+ship with no database default (the creating workflow sets them; `has_status`
+supplies the attribute default), and both new metadata-carrying tables have
+one `metadata` column. `StockLocation#restock` and `#move` take an optional
+`unit_cost:`. Statuses spell `canceled` with one `l`, matching the other 87
+occurrences in core. Status transitions are `PATCH` member routes, matching
+`orders/:id/cancel` and `returns/:id/receive` — the plan's claim that they are
+POSTs described no existing endpoint. Lot tracking stays 6.1 and the 6.0 half
+builds no lot rows, so open questions 5 and 6 keep their reasons; open
+question 4 (ship-to-store transfers) stays open pending the fulfillment plan's
+call on what a pickup date range promises when stock has to travel.
+
## 2026-09-07: Deposits are not a shipping concern — how a buyer pays gets its own plan
**Context:** `6.0-b2b-wholesale-shipping.md` originally specified deposits as part of wholesale freight: a delivery method would carry a `deposit_percentage`, checkout would collect it, and the order would complete part-paid. Building it raised two questions that had to be answered before it could ship. Is a shipping method the right thing to hang a payment arrangement on? And does merchant-configurable deposit collection belong in open source at all? Researching the second answered the first.
@@ -6,6 +90,14 @@
**Consequences:** No delivery method carries a `deposit_percentage`, and freight must not become a second place payment arrangements are configured. One piece is deliberately kept so the payment-terms plan starts from a hook rather than from patching: `Purchase#amount_due_at_checkout`, answering the full total through `Spree::Purchases::AmountDueAtCheckout` (registered in `Spree::Dependencies`), read by the four decisions that gate on money arriving — checkout requirements, both completion guards, and dispatch. Without it, an arrangement collecting part of the total up front has to patch those four independently. It ships with a spec proving the open-source answer is the total, and a spec registering a half-up-front replacement and proving checkout, completion and dispatch all follow it. What a new payment or gateway session *defaults* to, and the capture loop, still read `total`: those are amounts rather than decisions. Partial payments are untouched — they predate this work. A related fix rides along because it holds independently: dispatch now guards on `payment_total >= amount_due_at_checkout` rather than `paid?`, which required a positive total and so refused to ship a fully discounted or store-credit-paid order.
+## 2026-09-04: Catalog audiences are alternatives, not layers — a company buyer is never also priced by their customer group (V-3570)
+
+**Context:** `Catalog.for_context` consults a buyer's customer groups only when the company axis came back empty, so a merchant who put a shared range on a dealer group's company node and each trade tier on a customer group got tier prices that never applied — every dealer paid retail, with the catalog active, the audience assigned and the percentage saved. The code said two things about whether that was intended: the plan and the resolver describe a fallback chain, while `Spree::Catalog`'s class comment said visibility across applicable catalogs is their union, which reads as both audiences being consulted. The reading had to be ruled before either could be documented.
+
+**Decision:** The fallback chain is the intended behaviour and stays: the company subtree if any of its nodes carry a catalog, otherwise the customer's groups, otherwise the channel's default catalog. A buyer is on one agreement, resolved from the nearest party to them — layering a personal segment's prices on top of a company's negotiated ones would price one purchase under two agreements at once, and which won would depend on catalog position rather than on anything a merchant chose. Trade tiers over a company tree are expressed as company assignments: the shared range on the root, each tier's catalog on the member companies or divisions in that tier (one tier catalog carries as many assignments as the tier has members). That route already works and is what the union-within-an-audience plus nearest-node-first pricing was built for. Customer group assignments remain for buyers not purchasing for a company at all — a retail loyalty tier, a staff discount.
+
+**Consequences:** No behaviour change; the fix is that the code and the dashboard now say so. The class comment is corrected (it was the only place claiming the two audiences combine), the `for_context` and pricing-resolver comments read "or failing that" rather than "then", and the fallback carries an inline note. The dashboard states the precedence where a merchant can act on it: help text under the audience picker when a customer group is chosen, and a standing note on the audience card and wizard step whenever a group assignment is present, pointing at the company route for tier pricing. The developer docs stop framing the three ways of reaching a buyer as combining and carry the tier recipe as a warning. Three examples in `catalog_spec.rb` lock the ruling — the group dropping out once a company catalog exists, the group still applying when none does, and the subtree union when the tier is a company assignment. What is *not* solved: nothing detects a catalog assigned only to groups whose members are all company buyers, so such a catalog is still silently unreachable; a reachability warning needs the buyer population and is a separate piece of work.
+
## 2026-09-03: A return label buys the cheapest rate; the fulfillment's tracking becomes a read-through summary
**Context:** Implementing `6.0-shipping-labels-and-deliveries.md` raised two