{"record":{"id":"1d165f37acce8059","repo":"spree/spree","slug":"spree-dependencies-legacy-is-deprecated-and-n","errorCode":null,"errorMessage":"Spree::Dependencies##{legacy}= is deprecated and NO LONGER CONSULTED by Spree — the override was not applied. Port the class to the #{current} contract and set #{current}= instead. The #{legacy} name is removed in Spree 6.1.","messagePattern":"Spree::Dependencies##(.+?)= is deprecated and NO LONGER CONSULTED by Spree — the override was not applied\\. Port the class to the #(.+?) contract and set #(.+?)= instead\\. The #(.+?) name is removed in Spree 6\\.1\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"spree/core/lib/spree/core/dependencies.rb","lineNumber":280,"sourceCode":"\n        # Spree.<name> resolves through <name>_class, so the rename needs the\n        # constantized reader too.\n        define_method(\"#{legacy}_class\") do\n          Spree::Deprecation.warn(\n            \"Spree::Dependencies##{legacy} is deprecated and will be removed in Spree 6.1. \" \\\n            \"Use #{current} instead.\"\n          )\n          send(\"#{current}_class\")\n        end\n      end\n\n      def legacy_workflow_overrides\n        @legacy_workflow_overrides ||= {}\n      end\n\n      LEGACY_WORKFLOW_KEYS.merge(LEGACY_SERVICE_KEYS).each do |legacy, current|\n        define_method(\"#{legacy}=\") do |value|\n          Spree::Deprecation.warn(\n            \"Spree::Dependencies##{legacy}= is deprecated and NO LONGER CONSULTED by Spree — \" \\\n            \"the override was not applied. Port the class to the #{current} contract and \" \\\n            \"set #{current}= instead. The #{legacy} name is removed in Spree 6.1.\"\n          )\n          legacy_workflow_overrides[legacy] = value\n        end\n\n        define_method(legacy) do\n          Spree::Deprecation.warn(\"Spree::Dependencies##{legacy} is deprecated and will be removed in Spree 6.1. Use #{current} instead.\")\n          legacy_workflow_overrides.fetch(legacy) { send(current) }\n        end\n\n        define_method(\"#{legacy}_class\") do\n          Spree::Deprecation.warn(\"Spree::Dependencies##{legacy} is deprecated and will be removed in Spree 6.1. Use #{current} instead.\")\n          if legacy_workflow_overrides.key?(legacy)\n            value = legacy_workflow_overrides[legacy]\n            value.is_a?(String) ? value.constantize : value\n          else","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/spree/spree/blob/06bf66a8684b9de03210bbb2ddc8c1f5ba522fa2/spree/core/lib/spree/core/dependencies.rb#L262-L298","documentation":"In 6.0 the service tier seams became workflow seams (Spree::Workflow classes with named steps). A legacy writer such as Spree::Dependencies.cart_add_item_service = 'MyService' warns with this message and STASHES the value in legacy_workflow_overrides - the override is NOT applied to the workflow seam, because a class written against the old service contract is not interchangeable with the workflow the new call sites consume. Legacy readers return the stash (so legacy code calling its own class keeps working), falling back to the workflow class. Affected keys: cart_add_item_service, cart_recalculate_service, cart_merge_strategy, carts_complete_service, carts_upsert_items_service, payments_handle_webhook_service, fulfillment_create_service, order_cancel_service, order_complete_service, shipment_update_service, fulfillment_update_service, gift_card_apply_service, gift_card_remove_service, gift_card_redeem_service. Removed in Spree 6.1.","triggerScenarios":"Running an initializer that sets any of the fourteen legacy *_service / cart_merge_strategy keys, e.g. Spree::Dependencies.cart_add_item_service = 'MyApp::Cart::AddItem'. The warning fires at boot, and the customized behavior silently stops being consulted by checkout, cart, webhook, fulfillment and gift-card flows.","commonSituations":"Apps upgraded from Spree 5.x that swapped checkout/cart services (custom add-item validation, custom completion, custom merge) and find the custom logic inactive after the upgrade; extensions installing overrides via generators; the trap is silent - everything still works, just with default behavior.","solutions":["Port the custom class to the workflow contract: subclass Spree::Workflow, express the logic as step/external_step, accept the new keyword vocabulary (cart:, items:, fulfillment:, ...)","Set the new seam in the initializer: Spree::Dependencies.cart_add_item_workflow = 'MyApp::Carts::AddItemWorkflow' (or the matching *_workflow key from the warning text)","Delete the legacy assignment once ported - keep it only while other legacy code still reads the old key","Add a spec asserting the workflow seam resolves to your class, so a silently-stashed override can never ship"],"exampleFix":"# before\nSpree::Dependencies.cart_add_item_service = 'MyApp::Cart::AddItem'  # warned AND ignored\n\n# after\nclass MyApp::Carts::AddItemWorkflow < Spree::Workflow\n  def perform(cart:, variant:, quantity: nil, metadata: {}, options: {})\n    super\n    step :apply_loyalty_pricing\n  end\nend\nSpree::Dependencies.cart_add_item_workflow = 'MyApp::Carts::AddItemWorkflow'","handlingStrategy":"validation","validationCode":"# After boot, prove your override is live on the seam new call sites consume:\nexpected = 'MyApp::Carts::AddItemWorkflow'\nraise 'override stashed, not applied' unless Spree::Dependencies.cart_add_item_workflow_class == expected","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never assume a deprecated writer still routes - this family stashes legacy overrides instead of applying them","Add a seam-assertion spec for every customized Spree::Dependencies entry so a silent no-op fails CI","When porting a service to a workflow, reuse the workflow's own specs (e.g. the Carts::AddItem battery) against your subclass"],"tags":["deprecation","service-to-workflow","dependencies","silent-noop","spree-6-1"],"backgroundTag":"deprecated-api-usage","analyzedSha":"06bf66a8684b9de03210bbb2ddc8c1f5ba522fa2","analyzedAt":"2026-08-21T14:59:48.125Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}