spree_core 6.0.3 → 6.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/app/jobs/spree/imports/create_rows_job.rb +4 -2
  3. data/app/jobs/spree/imports/process_rows_job.rb +4 -2
  4. data/app/jobs/spree/payments/handle_webhook_job.rb +12 -1
  5. data/app/jobs/spree/products/auto_match_taxons_job.rb +5 -2
  6. data/app/jobs/spree/search_provider/index_job.rb +8 -0
  7. data/app/jobs/spree/search_provider/remove_job.rb +3 -0
  8. data/app/jobs/spree/stock_locations/stock_items/create_job.rb +5 -2
  9. data/app/mailers/spree/base_mailer.rb +1 -1
  10. data/app/models/concerns/spree/acted_by.rb +2 -2
  11. data/app/models/concerns/spree/customer_methods.rb +6 -4
  12. data/app/models/concerns/spree/deprecated_customer_alias.rb +11 -3
  13. data/app/models/concerns/spree/derived_number.rb +1 -1
  14. data/app/models/concerns/spree/has_custom_fields.rb +16 -11
  15. data/app/models/concerns/spree/integrations_concern.rb +5 -3
  16. data/app/models/concerns/spree/label_translatable.rb +4 -4
  17. data/app/models/concerns/spree/metadata.rb +3 -3
  18. data/app/models/concerns/spree/personal_data_matching.rb +5 -1
  19. data/app/models/concerns/spree/presentation_translatable.rb +1 -1
  20. data/app/models/concerns/spree/product_scopes.rb +2 -2
  21. data/app/models/concerns/spree/publishable.rb +26 -3
  22. data/app/models/concerns/spree/purchase/addresses.rb +8 -5
  23. data/app/models/concerns/spree/purchase/deprecated_aliases.rb +2 -2
  24. data/app/models/concerns/spree/stores/markets.rb +4 -2
  25. data/app/models/concerns/spree/user_address.rb +5 -2
  26. data/app/models/concerns/spree/user_methods.rb +2 -2
  27. data/app/models/spree/address.rb +29 -14
  28. data/app/models/spree/asset.rb +3 -3
  29. data/app/models/spree/authentication/strategies/base_strategy.rb +10 -1
  30. data/app/models/spree/base.rb +1 -1
  31. data/app/models/spree/calculator/shipping/flat_rate.rb +6 -4
  32. data/app/models/spree/cart.rb +9 -4
  33. data/app/models/spree/category.rb +8 -6
  34. data/app/models/spree/classification.rb +2 -2
  35. data/app/models/spree/current.rb +19 -0
  36. data/app/models/spree/custom_field.rb +6 -6
  37. data/app/models/spree/custom_field_definition.rb +10 -7
  38. data/app/models/spree/delivery_method.rb +21 -15
  39. data/app/models/spree/delivery_rate.rb +1 -1
  40. data/app/models/spree/digital.rb +1 -1
  41. data/app/models/spree/digital_asset.rb +2 -2
  42. data/app/models/spree/digital_link.rb +4 -4
  43. data/app/models/spree/export.rb +29 -2
  44. data/app/models/spree/fulfillment/custom_events.rb +18 -10
  45. data/app/models/spree/fulfillment.rb +30 -23
  46. data/app/models/spree/fulfillment_item.rb +3 -3
  47. data/app/models/spree/fulfilment_changer.rb +1 -1
  48. data/app/models/spree/gift_card.rb +12 -12
  49. data/app/models/spree/import.rb +23 -15
  50. data/app/models/spree/import_row.rb +6 -6
  51. data/app/models/spree/inventory_unit.rb +1 -1
  52. data/app/models/spree/invitation.rb +14 -6
  53. data/app/models/spree/line_item.rb +10 -8
  54. data/app/models/spree/media.rb +27 -3
  55. data/app/models/spree/metafield.rb +1 -1
  56. data/app/models/spree/metafield_definition.rb +1 -1
  57. data/app/models/spree/metafields.rb +2 -2
  58. data/app/models/spree/option_type.rb +26 -0
  59. data/app/models/spree/option_value.rb +3 -3
  60. data/app/models/spree/order.rb +92 -46
  61. data/app/models/spree/order_inventory.rb +2 -2
  62. data/app/models/spree/order_merger.rb +2 -2
  63. data/app/models/spree/order_updater.rb +34 -20
  64. data/app/models/spree/payment.rb +8 -8
  65. data/app/models/spree/payment_method.rb +11 -9
  66. data/app/models/spree/price.rb +22 -8
  67. data/app/models/spree/price_list.rb +12 -6
  68. data/app/models/spree/price_rules/zone_rule.rb +1 -1
  69. data/app/models/spree/product.rb +32 -33
  70. data/app/models/spree/product_category.rb +10 -4
  71. data/app/models/spree/product_collection.rb +8 -1
  72. data/app/models/spree/promotion/rules/category.rb +27 -10
  73. data/app/models/spree/promotion/rules/country.rb +1 -1
  74. data/app/models/spree/promotion/rules/taxon.rb +4 -2
  75. data/app/models/spree/promotion/rules/user.rb +1 -1
  76. data/app/models/spree/promotion_action.rb +1 -1
  77. data/app/models/spree/promotion_rule_category.rb +5 -5
  78. data/app/models/spree/promotion_rule_taxon.rb +2 -2
  79. data/app/models/spree/prototype.rb +4 -1
  80. data/app/models/spree/return_authorization_reason.rb +3 -3
  81. data/app/models/spree/return_reason.rb +1 -1
  82. data/app/models/spree/search_provider/base.rb +2 -2
  83. data/app/models/spree/search_provider.rb +7 -5
  84. data/app/models/spree/seller.rb +93 -10
  85. data/app/models/spree/seller_requirements/complete_profile.rb +26 -7
  86. data/app/models/spree/shipment.rb +4 -1
  87. data/app/models/spree/shipping_method.rb +4 -1
  88. data/app/models/spree/shipping_rate.rb +1 -1
  89. data/app/models/spree/stock/coordinator.rb +2 -2
  90. data/app/models/spree/stock/estimator.rb +7 -5
  91. data/app/models/spree/stock/package.rb +10 -8
  92. data/app/models/spree/stock_item.rb +1 -1
  93. data/app/models/spree/stock_level/custom_events.rb +1 -1
  94. data/app/models/spree/stock_level.rb +31 -2
  95. data/app/models/spree/stock_location.rb +12 -8
  96. data/app/models/spree/stock_movement.rb +7 -6
  97. data/app/models/spree/stock_reservation.rb +5 -5
  98. data/app/models/spree/store.rb +42 -16
  99. data/app/models/spree/store_credit.rb +2 -2
  100. data/app/models/spree/store_credit_category.rb +5 -5
  101. data/app/models/spree/store_credit_type.rb +2 -2
  102. data/app/models/spree/subscriber.rb +7 -7
  103. data/app/models/spree/tax_rate.rb +5 -5
  104. data/app/models/spree/taxon.rb +3 -3
  105. data/app/models/spree/taxon_rule.rb +2 -2
  106. data/app/models/spree/taxonomy.rb +1 -1
  107. data/app/models/spree/variant.rb +12 -10
  108. data/app/models/spree/variant_media.rb +1 -1
  109. data/app/models/spree/wished_item.rb +1 -1
  110. data/app/models/spree/wishlist.rb +2 -2
  111. data/app/models/spree/wishlist_item/custom_events.rb +2 -2
  112. data/app/models/spree/zone.rb +1 -1
  113. data/app/models/spree/zone_member.rb +1 -1
  114. data/app/services/spree/carts/associate.rb +6 -2
  115. data/app/services/spree/carts/create.rb +1 -1
  116. data/app/services/spree/carts/destroy.rb +23 -7
  117. data/app/services/spree/carts/remove_item.rb +1 -1
  118. data/app/services/spree/carts/remove_line_item.rb +2 -2
  119. data/app/services/spree/carts/remove_out_of_stock_items.rb +3 -1
  120. data/app/services/spree/carts/set_quantity.rb +2 -2
  121. data/app/services/spree/carts/update.rb +17 -0
  122. data/app/services/spree/checkout/add_store_credit.rb +3 -3
  123. data/app/services/spree/checkout/remove_store_credit.rb +2 -2
  124. data/app/services/spree/collections/regenerate_products.rb +37 -15
  125. data/app/services/spree/companies/add_member.rb +9 -4
  126. data/app/services/spree/diagnostics/error_log.rb +139 -0
  127. data/app/services/spree/diagnostics/section.rb +72 -0
  128. data/app/services/spree/diagnostics/sections.rb +121 -0
  129. data/app/services/spree/diagnostics/stack.rb +73 -0
  130. data/app/services/spree/diagnostics.rb +132 -0
  131. data/app/services/spree/imports/row_processors/product_variant.rb +19 -0
  132. data/app/services/spree/newsletter/subscribe.rb +7 -3
  133. data/app/services/spree/orders/approve.rb +3 -3
  134. data/app/services/spree/orders/create_user_account.rb +2 -2
  135. data/app/services/spree/orders/remove_line_item.rb +16 -5
  136. data/app/services/spree/product_memberships.rb +21 -1
  137. data/app/services/spree/product_types/apply_to_products.rb +12 -2
  138. data/app/services/spree/products/auto_match_collections.rb +20 -4
  139. data/app/services/spree/products/auto_match_taxons.rb +5 -2
  140. data/app/services/spree/shipments/update.rb +2 -2
  141. data/app/services/spree/stock_locations/stock_items/create.rb +5 -2
  142. data/app/services/spree/stock_reservations/extend.rb +3 -1
  143. data/app/services/spree/stock_reservations/reserve.rb +12 -7
  144. data/app/services/spree/store_credits/apply.rb +9 -1
  145. data/app/services/spree/taxons/add_products.rb +4 -2
  146. data/app/services/spree/taxons/regenerate_products.rb +5 -2
  147. data/app/services/spree/taxons/remove_products.rb +4 -2
  148. data/app/services/spree/update_check.rb +7 -31
  149. data/app/tools/spree/agent_tools/describe_resource.rb +3 -0
  150. data/app/tools/spree/agent_tools/get_resource.rb +1 -1
  151. data/app/tools/spree/agent_tools/resource_write.rb +1 -1
  152. data/app/tools/spree/agent_tools/search_resources.rb +42 -10
  153. data/app/workflows/spree/carts/add_item.rb +52 -1
  154. data/app/workflows/spree/carts/complete.rb +14 -2
  155. data/app/workflows/spree/carts/recalculate.rb +1 -1
  156. data/app/workflows/spree/fulfillments/update.rb +1 -1
  157. data/app/workflows/spree/orders/cancel.rb +3 -1
  158. data/app/workflows/spree/payments/capture.rb +2 -2
  159. data/app/workflows/spree/payments/handle_webhook.rb +7 -3
  160. data/app/workflows/spree/seller_transfers/create.rb +1 -1
  161. data/app/workflows/spree/sellers/approve.rb +6 -0
  162. data/app/workflows/spree/sellers/create.rb +5 -2
  163. data/app/workflows/spree/stock_levels/bulk_upsert.rb +19 -7
  164. data/config/locales/be.yml +1 -1
  165. data/config/locales/en.yml +12 -0
  166. data/config/locales/fr.yml +1 -1
  167. data/config/locales/lt.yml +1 -1
  168. data/config/locales/ru.yml +1 -1
  169. data/config/locales/uk.yml +1 -1
  170. data/db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb +14 -10
  171. data/db/migrate/20260710000001_rename_taxons_to_categories.rb +1 -1
  172. data/db/migrate/20260728000004_rename_shipping_to_fulfillment_and_delivery.rb +1 -1
  173. data/db/migrate/20260806000001_add_store_id_to_spree_tax_rates_and_categories.rb +1 -1
  174. data/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb +1 -1
  175. data/db/migrate/20260809000001_rename_metafields_to_custom_fields.rb +1 -1
  176. data/db/migrate/20260809150001_promote_shipping_categories_to_delivery_profiles.rb +1 -1
  177. data/db/migrate/20260811000001_add_delivery_tracking_to_fulfillments.rb +1 -1
  178. data/db/migrate/20260814000001_rename_stock_items_to_stock_levels.rb +13 -7
  179. data/db/migrate/20260824000001_add_store_to_spree_media.rb +1 -1
  180. data/db/migrate/20260828100001_unify_import_and_export_tenancy.rb +1 -1
  181. data/db/migrate/20261016000001_remove_default_from_spree_tax_rates_included_in_price.rb +1 -1
  182. data/lib/spree/agent_tool.rb +3 -3
  183. data/lib/spree/agent_tools/default_catalog.rb +2 -2
  184. data/lib/spree/agent_tools/legacy_tools.rb +1 -1
  185. data/lib/spree/agent_tools/operation_tool.rb +1 -1
  186. data/lib/spree/agent_tools/record_summary.rb +8 -2
  187. data/lib/spree/agent_tools/resource_map.rb +82 -7
  188. data/lib/spree/core/dependencies.rb +10 -10
  189. data/lib/spree/core/engine.rb +14 -0
  190. data/lib/spree/core/number_generator.rb +4 -3
  191. data/lib/spree/core/preferences/preferable.rb +1 -1
  192. data/lib/spree/core/preferences/preferable_class_methods.rb +5 -1
  193. data/lib/spree/core/pricing/resolver.rb +2 -2
  194. data/lib/spree/core/version.rb +1 -1
  195. data/lib/spree/core.rb +48 -10
  196. data/lib/spree/i18n.rb +6 -2
  197. data/lib/spree/localized_number.rb +1 -1
  198. data/lib/spree/removed_apis.rb +274 -0
  199. data/lib/spree/reporting/default_vocabulary.rb +26 -6
  200. data/lib/spree/testing_support/factories/digital_asset_factory.rb +1 -1
  201. data/lib/spree/testing_support/factories/stock_level_factory.rb +1 -1
  202. data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
  203. data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
  204. data/lib/spree/testing_support/factories/wishlist_item_factory.rb +1 -1
  205. data/lib/spree/testing_support/i18n.rb +7 -2
  206. data/lib/spree/testing_support/order_walkthrough.rb +5 -2
  207. data/lib/spree/upgrades/5_6_to_6_0/manifest.yml +14 -14
  208. data/lib/tasks/carts_migration.rake +1 -1
  209. data/lib/tasks/categories_and_collections.rake +1 -1
  210. data/lib/tasks/deliveries_migration.rake +1 -1
  211. data/lib/tasks/delivery_method_rules_migration.rake +1 -1
  212. data/lib/tasks/delivery_migration.rake +1 -1
  213. data/lib/tasks/delivery_profiles_migration.rake +2 -2
  214. data/lib/tasks/diagnostics.rake +11 -0
  215. data/lib/tasks/fold_store_credit_categories.rake +1 -1
  216. data/lib/tasks/migrate_country_state_codes.rake +1 -1
  217. data/lib/tasks/migrate_returns.rake +4 -4
  218. data/lib/tasks/migrate_rich_text_to_columns.rake +1 -1
  219. data/lib/tasks/store_settings.rake +1 -1
  220. data/lib/tasks/typed_stock_movements_migration.rake +1 -1
  221. metadata +13 -6
@@ -0,0 +1,274 @@
1
+ module Spree
2
+ # Names the replacement when code calls a Ruby API that Spree removed.
3
+ #
4
+ # Spree is old enough that coding agents, older tutorials and extensions
5
+ # still reach for 4.x and 5.x APIs: the checkout state machine,
6
+ # adjustments, single-currency prices, return authorizations. Without help,
7
+ # those calls fail with a bare NoMethodError or NameError, and the reader
8
+ # has to work out what replaced them. This module adds one paragraph to
9
+ # those errors naming what to use instead.
10
+ #
11
+ # The hint is added to Exception#detailed_message, the text Ruby, IRB and
12
+ # RSpec print for an error. The Rails log prints #message instead, so
13
+ # ErrorSubscriber logs the hint for errors Rails reports (unhandled request
14
+ # and job errors). The error keeps its class, its #message and its
15
+ # #respond_to? answers, so rescues and duck typing behave exactly as they
16
+ # did. Removed names are never defined, so nothing that still exists can be
17
+ # shadowed.
18
+ #
19
+ # docs/developer/upgrades/removed-apis.mdx lists every entry; regenerate it
20
+ # with UPDATE_DOCS=1 pnpm test:rspec core spec/lib/spree/removed_apis_spec.rb.
21
+ #
22
+ # Keys: 'Spree::Order#next' is an instance method, 'Spree::Order.checkout_flow'
23
+ # a class method (also matched when called on a relation), 'Spree::Adjustment'
24
+ # a constant. A key matches subclasses too.
25
+ #
26
+ # When you remove a public Ruby API, add it under the release that removed
27
+ # it (see spree/AGENTS.md).
28
+ module RemovedApis
29
+ UPGRADE_GUIDES = {
30
+ '6.0' => 'https://spreecommerce.org/docs/developer/upgrades/5.6-to-6.0'
31
+ }.freeze
32
+
33
+ # @return [Hash{String => String}] each name in +entries+, prefixed with each owner
34
+ def self.expand(owners, separator, entries)
35
+ owners.product(entries.to_a).to_h { |owner, (name, hint)| ["#{owner}#{separator}#{name}", hint] }
36
+ end
37
+
38
+ CHECKOUT = 'Checkout has no state machine. Write cart fields in any order (Spree::Carts::Update, ' \
39
+ 'or the Store API cart endpoints), read cart.current_checkout_step and the cart ' \
40
+ 'requirements to see what is missing, and place the order with ' \
41
+ 'Spree::Dependencies.carts_complete_workflow.constantize.call(cart: cart).'.freeze
42
+ CHECKOUT_CUSTOMIZATION = 'Checkout has no state machine. Add a checkout requirement with ' \
43
+ 'Spree::Checkout::Registry.add_requirement, or a step with Spree::Checkout::Registry.register_step, ' \
44
+ 'and run side effects of placing an order in an order.placed subscriber (Spree::Subscriber).'.freeze
45
+ ADJUSTMENTS = 'Adjustments are typed rows: tax_lines, discounts and fees.'.freeze
46
+ RETURNS = 'Returns, exchanges and claims are their own records on the order: returns, exchanges, claims.'.freeze
47
+ STATE_CHANGES = 'Status history is no longer stored. Subscribe to events instead (Spree::Subscriber).'.freeze
48
+ PRIMARY_MEDIA = 'Use primary_media.'.freeze
49
+ CUSTOMER_PRICE = 'Use price_in(currency).display_amount for the base price, or, on a variant (product.default_variant), ' \
50
+ 'price_for(context).display_amount for the price a customer pays including price lists.'.freeze
51
+ SEARCH = 'Use search, or q[search] in the Admin API.'.freeze
52
+
53
+ ORDER_AND_CART = {
54
+ 'next' => CHECKOUT,
55
+ 'next!' => CHECKOUT,
56
+ 'state' => 'Orders have status (draft, placed, canceled). Carts have no status: completed_at marks completion, ' \
57
+ 'and current_checkout_step says where checkout stands.',
58
+ 'state=' => 'Status changes through workflows, for example Spree::Orders::Cancel. Carts have no status.',
59
+ 'can_go_to_state?' => CHECKOUT,
60
+ 'restart_checkout_flow' => CHECKOUT,
61
+ 'contents' => 'Change cart items with Spree.cart_add_item_workflow or Spree::Dependencies.cart_upsert_items_workflow.',
62
+ 'adjustments' => ADJUSTMENTS,
63
+ 'all_adjustments' => ADJUSTMENTS,
64
+ 'state_changes' => STATE_CHANGES
65
+ }.freeze
66
+
67
+ ORDER_AND_CART_CLASS = {
68
+ 'checkout_flow' => CHECKOUT_CUSTOMIZATION,
69
+ 'checkout_steps' => CHECKOUT_CUSTOMIZATION,
70
+ 'insert_checkout_step' => CHECKOUT_CUSTOMIZATION,
71
+ 'remove_checkout_step' => CHECKOUT_CUSTOMIZATION,
72
+ 'remove_transition' => CHECKOUT_CUSTOMIZATION,
73
+ 'go_to_state' => CHECKOUT_CUSTOMIZATION,
74
+ 'state_machine' => 'Spree 6 has no state machines. Records move between statuses through workflows.',
75
+ 'multi_search' => SEARCH
76
+ }.freeze
77
+
78
+ VARIANT_AND_PRODUCT = {
79
+ 'price' => 'Prices are per currency: price_in(currency).amount or amount_in(currency).',
80
+ 'default_price' => 'Use price_in(currency).',
81
+ 'currency' => 'Pass the currency you mean to price_in(currency).',
82
+ 'display_price' => CUSTOMER_PRICE,
83
+ 'display_amount' => CUSTOMER_PRICE,
84
+ 'display_compare_at_price' => 'Use price_in(currency).display_compare_at_amount.',
85
+ 'price_including_vat_for' => 'Use price_in(currency).amount: prices are charged as entered.',
86
+ 'has_default_price?' => 'Use prices.base_prices.exists?(currency: currency).',
87
+ 'default_image' => PRIMARY_MEDIA,
88
+ 'primary_image' => PRIMARY_MEDIA
89
+ }.freeze
90
+
91
+ REPORTS = 'Use reporting queries for aggregates, or a Spree::Export subclass for CSV rows.'.freeze
92
+
93
+ # Removed APIs by the release that removed them.
94
+ REMOVED = {
95
+ '6.0' => {
96
+ # Checkout, orders and carts
97
+ **expand(%w[Spree::Order Spree::Cart], '#', ORDER_AND_CART),
98
+ **expand(%w[Spree::Order Spree::Cart], '.', ORDER_AND_CART_CLASS),
99
+ 'Spree::Order#line_item_adjustments' => 'Use line_item_tax_lines and line_item_discounts.',
100
+ 'Spree::Order#shipment_adjustments' => 'Use fulfillment_tax_lines and fulfillment_discounts.',
101
+ **expand(%w[Spree::Order], '#', %w[return_authorizations customer_returns reimbursements].index_with(RETURNS)),
102
+ 'Spree::Order::Checkout' => CHECKOUT_CUSTOMIZATION,
103
+ 'Spree::OrderContents' => 'Change cart items with Spree.cart_add_item_workflow or Spree::Dependencies.cart_upsert_items_workflow.',
104
+ 'Spree::Adjustment' => 'Adjustments are typed rows: Spree::TaxLine, Spree::Discount and Spree::Fee.',
105
+ 'Spree::LineItem#adjustments' => ADJUSTMENTS,
106
+ 'Spree::Fulfillment#adjustments' => ADJUSTMENTS,
107
+ 'Spree::StateChange' => STATE_CHANGES,
108
+ 'Spree::LogEntry' => STATE_CHANGES,
109
+ 'Spree::Payment#state_changes' => STATE_CHANGES,
110
+ 'Spree::Payment#log_entries' => STATE_CHANGES,
111
+ 'Spree::Fulfillment#state_changes' => STATE_CHANGES,
112
+
113
+ # Returns
114
+ 'Spree::ReturnAuthorization' => 'Use Spree::Return, or Spree::Exchange when different items go out.',
115
+ 'Spree::CustomerReturn' => 'Use Spree::Return: receiving is a status on the same record.',
116
+ 'Spree::Reimbursement' => 'Refund a return with the Spree::Returns::Refund workflow.',
117
+ 'Spree::ReimbursementType' => 'Refund a return with the Spree::Returns::Refund workflow.',
118
+ 'Spree::ReturnItem' => 'Use Spree::ReturnLineItem, Spree::ExchangeLineItem or Spree::ClaimLineItem.',
119
+
120
+ # Catalog and prices
121
+ **expand(%w[Spree::Variant Spree::Product], '#', VARIANT_AND_PRODUCT),
122
+ 'Spree::Variant#price=' => 'Use set_price(currency, amount).',
123
+ 'Spree::Variant#compare_at_price=' => 'Use set_price(currency, amount, compare_at_amount).',
124
+ 'Spree::Product#price=' => 'Set prices on a variant: default_variant.set_price(currency, amount).',
125
+ 'Spree::Product#compare_at_price=' => 'Set prices on a variant: default_variant.set_price(currency, amount, compare_at_amount).',
126
+ 'Spree::Product#featured_image' => PRIMARY_MEDIA,
127
+ 'Spree::DefaultPrice' => 'Use variant.price_in(currency) and variant.set_price(currency, amount).',
128
+ 'Spree::VatPriceCalculation' => 'Use price_in(currency).amount: prices include tax per market.',
129
+ 'Spree::Product.with_option' => 'Use with_option_value(option, value).',
130
+ **expand(%w[Spree::Product], '.', %w[in_name in_name_or_keywords in_name_or_description].index_with(SEARCH)),
131
+ 'Spree::Product.with_ids' => 'Use where(id: ids).',
132
+ 'Spree::Product.add_search_scope' => 'Declare a plain Active Record scope. To filter by it through the Admin API (q[...]), ' \
133
+ 'also register it with Spree.ransack.add_scope(Spree::Product, :scope_name).',
134
+ **expand(%w[Spree::Product Spree::Variant], '.', { 'multi_search' => SEARCH }),
135
+ 'Spree::OptionType#color?' => 'Use color_swatch?.',
136
+ 'Spree::Category#set_store' => 'Nothing to call: a new category gets its store from its parent or the current store when it is saved.',
137
+ 'Spree::Category.for_taxonomy' => 'Use for_store(taxonomy.store). It returns every category in that store, not one taxonomy.',
138
+
139
+ # Stores, addresses, users and permissions
140
+ 'Spree::Store#admin_users' => 'Use users.',
141
+ 'Spree::Store#supported_shipping_zones' => 'Use countries_with_shipping_coverage.',
142
+ 'Spree::Address#user_default_billing?' => 'Use is_default_billing?.',
143
+ 'Spree::Address#user_default_shipping?' => 'Use is_default_shipping?.',
144
+ 'Spree.searcher_class' => 'Use Spree.search_provider.',
145
+ 'Spree::PermittedAttributes' => 'Add writable API attributes with Spree::Product.additional_permitted_attributes += [...] ' \
146
+ 'inside Rails.application.config.to_prepare (any model; always +=).',
147
+ 'Spree::Preference' => 'Preferences live on each model in a JSON preferences column.',
148
+ 'Spree::User' => 'Use Spree.customer_class for customers and Spree.admin_user_class for staff.',
149
+
150
+ # Services and screens that are gone
151
+ 'Spree::PromotionHandler::Page' => 'Apply the promotion with a coupon code, or make it automatic.',
152
+ 'Spree::Carts::Empty' => 'Remove items through the Store API cart items endpoints, or delete the cart with Spree.cart_destroy_service.',
153
+ 'Spree::Payments::Create' => 'Use the Store API payments endpoint, Spree::StoreCredits::Apply or Spree.gift_card_apply_workflow.',
154
+ 'Spree::Report' => REPORTS,
155
+ 'Spree::ReportLineItem' => REPORTS,
156
+ 'Spree::ImageMethods' => 'Use Active Storage variants with cdn_image_url.',
157
+ 'Spree::Frontend' => 'The Rails storefront is gone. Build the storefront on the Store API (/api/v3/store), ' \
158
+ 'for example with the Next.js storefront and @spree/sdk.',
159
+ 'Spree::Backend' => 'The Rails admin is gone. The back office is the React Admin Dashboard on the Admin API (/api/v3/admin); ' \
160
+ 'extend it with dashboard plugins.',
161
+ 'Spree::Api::V2' => 'API v2 is gone. Use the Store API (/api/v3/store) or the Admin API (/api/v3/admin).'
162
+ }.freeze
163
+ }.freeze
164
+
165
+ module_function
166
+
167
+ # @param error [NameError]
168
+ # @return [String, nil] the hint for a removed Spree API, or nil
169
+ def hint_for(error)
170
+ key = lookup(error)
171
+ return unless key
172
+
173
+ version, entries = REMOVED.find { |_release, removed| removed.key?(key) }
174
+ "Spree #{version} removed #{key}. #{entries[key]}\nUpgrade guide: #{UPGRADE_GUIDES.fetch(version)}"
175
+ rescue StandardError
176
+ nil
177
+ end
178
+
179
+ def known?(key)
180
+ REMOVED.each_value.any? { |entries| entries.key?(key) }
181
+ end
182
+
183
+ # A receiverless call (`state` inside an Order decorator) raises a plain
184
+ # NameError, so only a capitalized name is treated as a constant.
185
+ def lookup(error)
186
+ name = error.name.to_s
187
+ receiver = error.receiver
188
+
189
+ if error.is_a?(NoMethodError) || !name.match?(/\A[A-Z]/)
190
+ method_lookup(receiver, name)
191
+ elsif receiver.is_a?(Module)
192
+ constant_lookup(receiver, name)
193
+ end
194
+ end
195
+
196
+ def method_lookup(receiver, name)
197
+ if receiver.is_a?(Module)
198
+ ancestor_lookup(receiver, ".#{name}")
199
+ elsif defined?(ActiveRecord::Relation) && receiver.is_a?(ActiveRecord::Relation)
200
+ ancestor_lookup(receiver.klass, ".#{name}")
201
+ else
202
+ ancestor_lookup(receiver.class, "##{name}")
203
+ end
204
+ end
205
+
206
+ def ancestor_lookup(klass, suffix)
207
+ klass.ancestors.each do |ancestor|
208
+ key = "#{ancestor.name}#{suffix}"
209
+ return key if known?(key)
210
+ end
211
+ nil
212
+ end
213
+
214
+ # Code written directly inside the Spree namespace (`module Spree; module
215
+ # OrderDecorator`) reports its own module as the receiver of a missing
216
+ # constant, so 'Spree::OrderDecorator::Adjustment' also tries 'Spree::Adjustment'.
217
+ # Deeper namespaces don't, so a missing Spree::Reporting::Report is not
218
+ # mistaken for the removed Spree::Report.
219
+ def constant_lookup(receiver, name)
220
+ candidates = receiver == Object ? [name] : ["#{receiver.name}::#{name}"]
221
+ candidates << "Spree::#{name}" if receiver.name.to_s.match?(/\ASpree::\w+\z/)
222
+ candidates.find { |candidate| known?(candidate) }
223
+ end
224
+
225
+ # @return [String] the documentation page listing every removed API
226
+ def to_mdx
227
+ sections = REMOVED.map do |version, entries|
228
+ rows = entries.map { |key, replacement| "| `#{key}` | #{replacement} |" }
229
+ <<~MARKDOWN
230
+ ## Removed in Spree #{version}
231
+
232
+ See the [upgrade guide](#{UPGRADE_GUIDES.fetch(version)}) for the reasons behind each change.
233
+
234
+ | Removed | Use instead |
235
+ | --- | --- |
236
+ #{rows.join("\n")}
237
+ MARKDOWN
238
+ end
239
+
240
+ <<~MARKDOWN
241
+ ---
242
+ title: Removed Ruby APIs
243
+ description: Ruby classes and methods removed from Spree, and what replaced each one.
244
+ ---
245
+
246
+ Code written for an older Spree release, or by a coding agent working from old examples, may call one of these APIs. It fails with a `NoMethodError` or `NameError`, and Ruby, the Rails console, RSpec and the Rails log add the replacement below to that error.
247
+
248
+ APIs that still work but print a deprecation warning are not listed here. They are in the upgrade guide for the release that deprecated them.
249
+
250
+ #{sections.join("\n")}
251
+ MARKDOWN
252
+ end
253
+
254
+ # Logs the hint for an error Rails reports, such as an unhandled error in
255
+ # a request or a job, so it appears in the Rails log next to the error.
256
+ class ErrorSubscriber
257
+ def report(error, **)
258
+ hint = Spree::RemovedApis.hint_for(error) if error.is_a?(NameError)
259
+ Rails.logger&.warn(hint) if hint
260
+ end
261
+ end
262
+
263
+ # Prepended to NameError (and so NoMethodError).
264
+ module ErrorHint
265
+ def detailed_message(**)
266
+ message = super
267
+ hint = Spree::RemovedApis.hint_for(self)
268
+ hint ? "#{message}\n\n#{hint}" : message
269
+ end
270
+ end
271
+ end
272
+ end
273
+
274
+ NameError.prepend(Spree::RemovedApis::ErrorHint)
@@ -429,13 +429,21 @@ module Spree
429
429
  metric :orders_lifetime, sql: LIFETIME_ORDERS_SUBQUERY, base: :orders, format: :integer,
430
430
  requires_grouping: :customer,
431
431
  subject: -> { Spree.customer_class }, key_scope: 'read_customers'
432
+ end
433
+ install_dimensions(registry)
434
+ install_axes(registry)
435
+ install_counters(registry)
436
+ end
432
437
 
438
+ # Dimensions of the orders and line items bases.
439
+ def self.install_dimensions(registry)
440
+ registry.instance_eval do
433
441
  dimension :completed_at, base: :orders, column: :completed_at, type: :time,
434
442
  grains: %i[hour day week month]
435
443
  dimension :payment_status, base: :orders, column: :payment_status,
436
444
  values: -> { Spree::Order::PAYMENT_STATUSES }
437
445
  # The rollup values Orders::UpdateStatuses writes today; the model
438
- # constant still carries the legacy machine states until 6.1.
446
+ # constant still carries the legacy machine states until 6.3.
439
447
  dimension :fulfillment_status, base: :orders, column: :fulfillment_status,
440
448
  values: -> { %w[backorder canceled partial unfulfilled fulfilled delivered] }
441
449
 
@@ -555,7 +563,12 @@ module Spree
555
563
  }]
556
564
  end
557
565
  }
566
+ end
567
+ end
558
568
 
569
+ # Dimensions of the carts, promotions, payments and stock bases.
570
+ def self.install_axes(registry)
571
+ registry.instance_eval do
559
572
  # ---- cart axes ----
560
573
 
561
574
  dimension :started_at, base: :carts, column: :created_at, type: :time,
@@ -650,7 +663,11 @@ module Spree
650
663
  [location.id, { id: location.prefixed_id, label: location.name, meta: {} }]
651
664
  end
652
665
  }
666
+ end
667
+ end
653
668
 
669
+ def self.install_counters(registry)
670
+ registry.instance_eval do
654
671
  # ---- counters ----
655
672
  #
656
673
  # What needs attention right now. Order counters honour the channel
@@ -697,19 +714,22 @@ module Spree
697
714
  link: { resource: 'claims',
698
715
  filters: [{ field: 'status', operator: 'in', value: OPEN_CLAIM_STATUSES.join(',') }] }
699
716
 
717
+ # Variants, not stock levels: a SKU stocked in one warehouse and
718
+ # absent from another is not out of stock, and counting one row per
719
+ # location would report every such pair as a problem.
700
720
  counter :low_stock_items,
701
721
  subject: -> { Spree::StockLevel }, key_scope: 'read_stock',
702
- count: lambda { |store, channel:|
703
- STORE_STOCK.call(store).low_stock(store.preferred_low_stock_threshold).count
722
+ count: lambda { |store, **|
723
+ STORE_STOCK.call(store).low_stock_overall(store.preferred_low_stock_threshold).distinct.count(:variant_id)
704
724
  },
705
725
  link: { resource: 'inventory',
706
- filters: [{ field: 'stock_status', operator: 'in', value: 'low_stock' }] }
726
+ filters: [{ field: 'stock_status', operator: 'in', value: 'low_stock_overall' }] }
707
727
 
708
728
  counter :out_of_stock_items,
709
729
  subject: -> { Spree::StockLevel }, key_scope: 'read_stock',
710
- count: ->(store, channel:) { STORE_STOCK.call(store).out_of_stock.count },
730
+ count: ->(store, **) { STORE_STOCK.call(store).out_of_stock_overall.distinct.count(:variant_id) },
711
731
  link: { resource: 'inventory',
712
- filters: [{ field: 'stock_status', operator: 'in', value: 'out_of_stock' }] }
732
+ filters: [{ field: 'stock_status', operator: 'in', value: 'out_of_stock_overall' }] }
713
733
  end
714
734
  end
715
735
  end
@@ -8,6 +8,6 @@ FactoryBot.define do
8
8
  variant
9
9
  end
10
10
 
11
- # @deprecated Use :digital_asset; removed in 6.1.
11
+ # @deprecated Use :digital_asset; removed in 6.3.
12
12
  factory :digital, parent: :digital_asset
13
13
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- # :stock_item is the pre-6.0 name, kept for one release so host-app factories
2
+ # :stock_item is the pre-6.0 name, kept until 6.3 so host-app factories
3
3
  # and specs written against it keep working.
4
4
  factory :stock_level, class: Spree::StockLevel, aliases: [:stock_item] do
5
5
  backorderable { true }
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
2
  # @deprecated Use :category. Kept so existing extension and application suites
3
- # keep passing through the 6.0 rename; removed in 6.1 with Spree::Taxon.
3
+ # keep passing through the 6.0 rename; removed in 6.3 with Spree::Taxon.
4
4
  #
5
5
  # A category is store-owned via store_id, so this creates no taxonomy. Callers
6
6
  # that need a legacy taxonomy-backed row pass `taxonomy:` explicitly.
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- # @deprecated Taxonomy is data-only in 6.0 and dropped in 6.1. Retained for the
2
+ # @deprecated Taxonomy is data-only in 6.0 and dropped in 6.3. Retained for the
3
3
  # upgrade-path specs. The root category is created here because the model no
4
4
  # longer manages one.
5
5
  factory :taxonomy, class: Spree::Taxonomy do
@@ -4,7 +4,7 @@ FactoryBot.define do
4
4
  wishlist
5
5
  end
6
6
 
7
- # Renamed in 6.0; the old name is kept for one release so extension suites
7
+ # Renamed in 6.0; the old name is kept until 6.3 so extension suites
8
8
  # keep building.
9
9
  factory :wished_item, parent: :wishlist_item
10
10
  end
@@ -1,3 +1,8 @@
1
1
  # Deprecated: Spree's specs now catch missing keys through Rails'
2
- # config.i18n.raise_on_missing_translations. Removed in Spree 6.1.
3
- Spree::Deprecation.warn("spree/testing_support/i18n is deprecated and does nothing; set config.i18n.raise_on_missing_translations = true in your test environment instead. It will be removed in Spree 6.1.") if defined?(Spree::Deprecation)
2
+ # config.i18n.raise_on_missing_translations. Removed in Spree 6.3.
3
+ if defined?(Spree::Deprecation)
4
+ Spree::Deprecation.warn(
5
+ 'spree/testing_support/i18n is deprecated and does nothing; set config.i18n.raise_on_missing_translations = true in your test environment ' \
6
+ 'instead. It will be removed in Spree 6.3.'
7
+ )
8
+ end
@@ -2,13 +2,16 @@
2
2
  # every step BEFORE the given one satisfied (matching the legacy contract
3
3
  # where `up_to(:delivery)` had completed the address step). `up_to(:complete)`
4
4
  # runs the real completion pipeline and returns the resulting Spree::Order.
5
- # @deprecated Removed in Spree 6.1 — build checkout state with the factories
5
+ # @deprecated Removed in Spree 6.3 — build checkout state with the factories
6
6
  # instead: create(:cart_ready_for_delivery) (address + delivery proposals),
7
7
  # create(:cart_ready_to_complete) (payment-covered), or
8
8
  # create(:completed_order_with_totals) for a placed order.
9
9
  class OrderWalkthrough
10
10
  def self.up_to(state, store = nil)
11
- Spree::Deprecation.warn('OrderWalkthrough is deprecated and will be removed in Spree 6.1. Use the cart factories instead: :cart_ready_for_delivery, :cart_ready_to_complete, or :completed_order_with_totals.')
11
+ Spree::Deprecation.warn(
12
+ 'OrderWalkthrough is deprecated and will be removed in Spree 6.3. ' \
13
+ 'Use the cart factories instead: :cart_ready_for_delivery, :cart_ready_to_complete, or :completed_order_with_totals.'
14
+ )
12
15
  store ||= Spree::Store.default
13
16
 
14
17
  # A payment method must exist for checkout to proceed
@@ -68,7 +68,7 @@ steps:
68
68
  polymorphic type column an extension points at media rows.
69
69
 
70
70
  Run immediately after db:migrate. Spree::Asset stays readable as a
71
- deprecated alias until 6.1, so code referencing it keeps working either
71
+ deprecated alias until 6.3, so code referencing it keeps working either
72
72
  way; this step is about the stored strings.
73
73
 
74
74
  Idempotent — rows already saying Spree::Media are left alone.
@@ -205,7 +205,7 @@ steps:
205
205
 
206
206
  Only copies where an Action Text row exists, so content already in the
207
207
  column is never overwritten. Source rows are left in place as the rollback
208
- path and are dropped with the Action Text tables in 6.1. Idempotent.
208
+ path and are dropped with the Action Text tables in 6.3. Idempotent.
209
209
 
210
210
  - id: migrate_shipping_to_delivery
211
211
  name: "Backfill fulfillment & delivery naming"
@@ -247,7 +247,7 @@ steps:
247
247
  inside the other profile if both links were intended. Run after
248
248
  migrate_shipping_to_delivery (it reads the backfilled fulfillment
249
249
  providers). Idempotent — processed rows gain a store_id and drop out of
250
- the work set. spree_shipping_method_categories survives to 6.1 as the
250
+ the work set. spree_shipping_method_categories survives to 6.3 as the
251
251
  source and rollback reference.
252
252
 
253
253
  - id: migrate_fulfillment_statuses
@@ -388,7 +388,7 @@ steps:
388
388
  Reads the legacy tables by name (the legacy models are gone in 6.0) and
389
389
  writes history without validation, so rows referencing deleted variants
390
390
  or stock locations still copy. The legacy tables stay in place as a
391
- safety net and are dropped in 6.1.
391
+ safety net and are dropped in 6.3.
392
392
 
393
393
  Resumable by construction: the legacy number is copied onto the new
394
394
  record and uniquely indexed there, so the task scopes itself to the
@@ -437,7 +437,7 @@ steps:
437
437
  a fulfillment shipped before the task runs never gets an allocation,
438
438
  and dispatch only ships allocated units, so its stock is never
439
439
  decremented twice. originator_type and originator_id stay in place as
440
- the rollback path and are dropped in 6.1. Tune the load size with
440
+ the rollback path and are dropped in 6.3. Tune the load size with
441
441
  BATCH_SIZE (default 5000).
442
442
 
443
443
  - id: backfill_delivery_and_stock_store_ids
@@ -446,7 +446,7 @@ steps:
446
446
  notes: |
447
447
  Delivery methods and stock locations carry a store_id in Spree 6.
448
448
  Unassigned rows go to the default store; additional stores manage
449
- their own records afterwards. The NOT NULL constraints land in 6.1.
449
+ their own records afterwards. The NOT NULL constraints land in 6.3.
450
450
  Idempotent.
451
451
 
452
452
  - id: migrate_tax_zones
@@ -476,7 +476,7 @@ steps:
476
476
  afterwards. Category names become unique per store rather than globally,
477
477
  so installs that relied on global names may need to reconcile duplicates
478
478
  once several stores hold tax configuration. The NOT NULL constraints land
479
- in 6.1. Idempotent.
479
+ in 6.3. Idempotent.
480
480
 
481
481
  - id: backfill_market_tax_inclusive
482
482
  name: "Decide whether each market's prices include tax"
@@ -524,7 +524,7 @@ steps:
524
524
  orders that predate markets. Channel needs no step here — the 5.4→5.5
525
525
  manifest's channels step already backfills channel_id on every upgrade
526
526
  path. Run before the cart conversion so converted carts inherit
527
- resolved values. The NOT NULL constraints on spree_orders land in 6.1.
527
+ resolved values. The NOT NULL constraints on spree_orders land in 6.3.
528
528
  Idempotent.
529
529
 
530
530
  - id: migrate_incomplete_orders_to_carts
@@ -573,7 +573,7 @@ steps:
573
573
  a non-default value of its own.
574
574
 
575
575
  Remove the settings from your initializer afterwards — the globals are
576
- deprecated and are deleted in 6.1.
576
+ deprecated and are deleted in 6.3.
577
577
 
578
578
  Idempotent: each store is visited at most once, recorded in its metadata,
579
579
  so a later run never undoes a change made in the dashboard after the
@@ -594,8 +594,8 @@ steps:
594
594
  own setting. Run after store_settings_backfill_from_config so the store
595
595
  they inherit from already holds the right value.
596
596
 
597
- The auto_capture column stays readable as a fallback for one release and
598
- is dropped in 6.1. Idempotent — only rows without a capture_method are
597
+ The auto_capture column stays readable as a fallback until 6.3 and
598
+ is dropped in 6.3. Idempotent — only rows without a capture_method are
599
599
  written.
600
600
 
601
601
  - id: store_regional_settings
@@ -642,7 +642,7 @@ steps:
642
642
  originator (return, exchange, claim, gift card) plus the memo, so this
643
643
  copies each legacy category name into the memo of credits that have
644
644
  none. Admin-written memos are never overwritten. Idempotent, and a
645
- no-op once the legacy tables are dropped in 6.1.
645
+ no-op once the legacy tables are dropped in 6.3.
646
646
 
647
647
  - id: migrate_stripe_webhook_keys
648
648
  name: "Move Stripe webhook signing secrets onto the gateway"
@@ -660,7 +660,7 @@ steps:
660
660
  Until this runs, a gateway carrying a pre-6.0 endpoint has no signing
661
661
  secret and rejects incoming webhooks. Idempotent — gateways that already
662
662
  hold a secret are skipped, and the legacy tables stay in place as a
663
- rollback path until they are dropped in 6.1.
663
+ rollback path until they are dropped in 6.3.
664
664
 
665
665
  - id: migrate_paypal_payments
666
666
  name: "Give PayPal payments taken before 6.0 the PayPal order id"
@@ -711,7 +711,7 @@ steps:
711
711
  are invisible to every scoped query, including the admin list.
712
712
 
713
713
  The owner_type/owner_id columns stay in place as this step's source and
714
- its rollback path; they are dropped in 6.1, along with the deprecated
714
+ its rollback path; they are dropped in 6.3, along with the deprecated
715
715
  Import#owner reader. Exports need no data step — they have always had a
716
716
  store, and their seller_id column is new for everyone.
717
717
 
@@ -29,7 +29,7 @@ namespace :spree do
29
29
  stats = Hash.new(0)
30
30
 
31
31
  # spree_state_changes has no model anymore (removed in 6.0; the table
32
- # survives until 6.1 as legacy data), so read it anonymously.
32
+ # survives until 6.3 as legacy data), so read it anonymously.
33
33
  state_changes = Class.new(ActiveRecord::Base) { self.table_name = 'spree_state_changes' }
34
34
 
35
35
  incomplete = Spree::Order.unscoped.where(completed_at: nil, canceled_at: nil)
@@ -132,7 +132,7 @@ namespace :spree do
132
132
  puts "\n migrated #{migrated}, skipped #{skipped}, failed #{failed}. (Manual categories stay as categories.)"
133
133
 
134
134
  # Sever the taxonomy structure from the surviving (manual) categories — in 6.0
135
- # categories are store-owned; Taxonomy + the taxonomy_id column drop in 6.1.
135
+ # categories are store-owned; Taxonomy + the taxonomy_id column drop in 6.3.
136
136
  puts 'Severing taxonomy links from surviving categories...'
137
137
 
138
138
  # Drop legacy taxonomy roots (parentless, taxonomy-backed containers) left with no
@@ -14,7 +14,7 @@ namespace :spree do
14
14
  created = 0
15
15
  skipped = 0
16
16
 
17
- # The column is dropped in 6.1; until then the model reads tracking from
17
+ # The column is dropped in 6.3; until then the model reads tracking from
18
18
  # the delivery, so the legacy value is read straight off the row.
19
19
  fulfillments = Spree::Fulfillment.unscoped.
20
20
  where.not(tracking: [nil, '']).
@@ -3,7 +3,7 @@
3
3
  # 5.6 → 6.0: fold the FlatRate calculator's eligibility bound preferences
4
4
  # into DeliveryMethodRule rows (docs/plans/6.0-delivery-method-rules.md).
5
5
  # The calculator preferences keep working as a deprecation bridge through
6
- # 6.0; this task moves the data so the bridge can drop in 6.1.
6
+ # 6.0; this task moves the data so the bridge can drop in 6.3.
7
7
  namespace :spree do
8
8
  desc 'Convert FlatRate calculator eligibility bounds into delivery method rules'
9
9
  task migrate_calculator_bounds_to_delivery_method_rules: :environment do
@@ -11,7 +11,7 @@ namespace :spree do
11
11
  say = ->(message) { puts message }
12
12
 
13
13
  # 1. Stored polymorphic class names. spree_state_changes has no model
14
- # anymore (removed in 6.0; the table survives until 6.1 as legacy data),
14
+ # anymore (removed in 6.0; the table survives until 6.3 as legacy data),
15
15
  # so it is read through an anonymous ActiveRecord class.
16
16
  state_changes = Class.new(ActiveRecord::Base) { self.table_name = 'spree_state_changes' }
17
17
 
@@ -7,7 +7,7 @@
7
7
  # deliberately left out: store assignment, kind detection, folding
8
8
  # non-narrowing categories into the store default, and re-homing methods
9
9
  # from the legacy method↔category m:n (spree_shipping_method_categories,
10
- # which survives to 6.1 as this task's source and rollback reference).
10
+ # which survives to 6.3 as this task's source and rollback reference).
11
11
  namespace :spree do
12
12
  desc 'Assign 5.x shipping-category rows their store, kind and methods as delivery profiles'
13
13
  task migrate_delivery_profiles: :environment do
@@ -104,6 +104,6 @@ namespace :spree do
104
104
  puts "store #{store.code}: #{count} unassigned products moved to the default profile" if count.positive?
105
105
  end
106
106
 
107
- puts 'migrate_delivery_profiles done. spree_shipping_method_categories is kept until 6.1 as the rollback reference.'
107
+ puts 'migrate_delivery_profiles done. spree_shipping_method_categories is kept until 6.3 as the rollback reference.'
108
108
  end
109
109
  end
@@ -0,0 +1,11 @@
1
+ namespace :spree do
2
+ # Plumbing for `spree info` in the CLI, which is how users get the report
3
+ # from the command line, so it has no description and stays out of
4
+ # `bin/rails -T`. The CLI passes what only it can see (Node, Docker,
5
+ # @spree packages) as `{ "title": ..., "rows": { label => value } }`.
6
+ task info: :environment do
7
+ extra_sections = ENV['SPREE_INFO_CLIENT'].present? ? [JSON.parse(ENV['SPREE_INFO_CLIENT']).symbolize_keys] : []
8
+ report = Spree::Diagnostics.report(extra_sections: extra_sections, errors: false)
9
+ puts ENV['FORMAT'] == 'json' ? report.to_h.to_json : report.to_markdown
10
+ end
11
+ end
@@ -6,7 +6,7 @@ namespace :spree do
6
6
  credit exists is its originator (return, exchange, claim, gift card)
7
7
  plus the free-text memo — so this keeps the only information a
8
8
  category row held visible in the dashboard once the column and table
9
- are dropped in 6.1.
9
+ are dropped in 6.3.
10
10
 
11
11
  Only credits with a blank memo are touched, so nothing an admin wrote
12
12
  is overwritten. Idempotent — a credit whose memo is already filled is
@@ -1,5 +1,5 @@
1
1
  # Defined here rather than in lib/spree/core/ — this is a one-release upgrade
2
- # step that dies with the country and state tables in 6.1, not engine
2
+ # step that dies with the country and state tables in 6.3, not engine
3
3
  # infrastructure. Same placement as Spree::ReturnsMigrator in a sibling task.
4
4
  module Spree
5
5
  # Copies country and state foreign keys onto the ISO string columns that