Skip to content

Instantly share code, notes, and snippets.

@matthutchinson
Created March 6, 2026 18:25
Show Gist options
  • Select an option

  • Save matthutchinson/3b0d1c8961bad10f31ac7a1c8bc910b2 to your computer and use it in GitHub Desktop.

Select an option

Save matthutchinson/3b0d1c8961bad10f31ac7a1c8bc910b2 to your computer and use it in GitHub Desktop.
FlowContext Settings Audit — Investigation TODO

FlowContext Settings Audit — Investigation TODO

Top-Level FlowContext Settings

  • 1. shop — Verify all consumers read from FlowContext (not legacy Settings). Check repository.rb, policy_context_builder.rb:17, cart_violations_mapper.rb, input_validator.rb, cart_update_from_negotiation.rb.
  • 2. api_client — Verify all consumers read from FlowContext. Check repository.rb:53,58,62,317,374,512, negotiation.rb, policy_context_builder.rb:22, cart_update_from_negotiation.rb, proposal_updater.rb, purchase_proposal_from_cart_next.rb.
  • 3. session — Confirm updater.rb reads session from FlowContext for recognized_shop_account_uuid. Nullable — verify nil-safety.
  • 4. raw_request — Confirm all 6+ callsites in repository.rb and others read from FlowContext. Nullable — verify nil-safety.
  • 5. engine_mode — Validate that CartContext returns EngineMode.immediate(allowed_list:) and CheckoutContext returns EngineMode.progressive. Check policy_context_builder.rb:81, cart_checkout_validation_policy.rb:364.
  • 6. payment_provided — Verify CartContext correctly derives from cart_input.payment.present? and CheckoutContext defaults to false. Private ivar — confirm no direct external access.
  • 7. should_payment_error_on_pending_artifact? — Confirm CartContext returns @payment_provided, CheckoutContext returns false. Check cart_update_from_negotiation.rb:1107.
  • 8. should_skip_tax_and_duty_policies? — Confirm CartContext respects @skip_tax_and_duty_policies config, CheckoutContext returns false. Check repository.rb:54,207, negotiation.rb:89.
  • 9. client_details — Confirm CartContext returns nil, CheckoutContext builds ClientDetails from raw_request with Shopify-Storefront-Buyer-IP header. Check policy_context_builder.rb:25.
  • 10. should_create_breadcrumb? — Confirm CartContext logic (true unless Online Store + portable-wallets SDK variant). Effectively unused in CheckoutContext — consider removing or documenting.
  • 11. use_any_amount_for_payment? — Verify CartContext derives from Stripe shared token / UCP payment method, CheckoutContext is always true. Check cart_update_from_negotiation.rb:661,674,1106, input_validator.rb:691, purchase_proposal_from_cart_next.rb:317, cart_completion/purchase_proposal_from_cart_next.rb:259.
  • 12. should_flag_deferred_payment_required_error? — Confirm both contexts return @payment_provided. Check cart_violations_mapper.rb:31.
  • 13. force_available_payment_method_policy — Verify CartContext reads from configuration (default false), CheckoutContext is always true. Check negotiation.rb:90.
  • 14. warnings_for_discount_codes — Verify CartContext reads from configuration, CheckoutContext defaults to false. Check cart_violations_mapper.rb:22-23,167. Never true in CheckoutContext.
  • 15. warnings_for_selling_plans — Verify CartContext reads from configuration, CheckoutContext defaults to false. Check cart_violations_mapper.rb:26-27,198. Never true in CheckoutContext.
  • 16. errors_for_required_ui_extensions — Verify both contexts read from configuration (default false). Check policy_context_builder.rb:82.
  • 17. request_channel_override — Verify CartContext sets from graphql_context[:channel] when feature enabled, CheckoutContext is always nil. Check policy_context_builder.rb:28. Never set in CheckoutContext.
  • 18. api_permission — Absorbed from Repository. Verify both contexts set from graphql_context[:api_permission]. Check repository.rb:211,250,263,513.
  • 19. channel — Absorbed from Repository. Verify CartContext sets from graphql_context[:channel], CheckoutContext only sets when shop.feature_set.use_override_channel?. Check repository.rb:71.
  • 20. country_code — Absorbed from Repository. Verify both contexts set from graphql_context[:buyer_context]&.country. Check repository.rb:72.

Delivery Sub-Settings (FlowContext::Delivery)

  • 21. fetch_dynamic_rates? — Verify CartContext reads from configuration (default false), CheckoutContext is always true. Check purchase_proposal_from_cart_next.rb:405, cart_completion/purchase_proposal_from_cart_next.rb:287, cart_platform_input_builder.rb:197.
  • 22. force_inline_dynamic_rates? — Always false in both contexts. Potentially vestigial. Investigate if any non-factory caller sets this to true. Check purchase_proposal_from_cart_next.rb:371, cart_platform_input_builder.rb:189.
  • 23. flag_violation_on_pending_artifact? — Verify CartContext logic (true if delivery groups present AND config not disabled), CheckoutContext returns false. Check cart_update_from_negotiation.rb:1117.
  • 24. skip_default_delivery_option_fallback? — Verify CartContext mirrors fetch_dynamic_rates, CheckoutContext is always true. Check purchase_proposal_from_cart_next.rb:368, cart_platform_input_builder.rb:188.
  • 25. use_partial_delivery_address? — Verify CartContext defaults to false, CheckoutContext is always true. Check cart_completion/purchase_proposal_from_cart_next.rb:180.

Merchandise Sub-Settings (FlowContext::Merchandise)

  • 26. allow_overselling? — Always false in both contexts via factory. Potentially vestigial — investigate non-factory callers. Check updater.rb:255, policy_context_builder.rb:78.
  • 27. skip_channel_validation? — Always false in both contexts via factory. Potentially vestigial — investigate non-factory callers. Check policy_context_builder.rb:46.
  • 28. filter_input_with_missing_variants? — Always false in both contexts via factory. Potentially vestigial — investigate non-factory callers. Check updater.rb:196.
  • 29. skip_variant_publication_checks? — Both contexts default false, auto-set to true for ReCharge sessions. Check policy_context_builder.rb:49.
  • 30. skip_selling_plan_validation? — Both contexts default false, auto-set to true for ReCharge sessions. Check policy_context_builder.rb:79, input_validator.rb:582.
  • 31. block_modifying_out_of_stock_variant? — Always false in both contexts via factory. Potentially vestigial. Check cart_violations_mapper.rb:14.
  • 32. block_selling_plan_on_company_location? — Always false in both contexts via factory. Potentially vestigial. Check cart_violations_mapper.rb:18.
  • 33. max_quantity_in_cart_error?Asymmetry: CartContext = false (explicit), CheckoutContext = true (default). Verify this is intentional. Check updater.rb:256.

Not-Yet-Migrated Methods (Critical Gap)

  • 34. instrumentation — Still called via settings. at policy_context_builder.rb:42,129. Needs migration to FlowContext or callers updated.
  • 35. buyer_identity_provider — Still called via settings. at policy_context_builder.rb:23, negotiation.rb:99, cart_completion/buyer_identity_terms_builder.rb:115, cart_completion/purchase_proposal_from_cart_next.rb:58. Needs migration.
  • 36. theme_provider — Still called via settings. at policy_context_builder.rb:21. Needs migration.
  • 37. checkout_shop_config — Still called via settings. at policy_context_builder.rb:45,76, cart_update_from_negotiation.rb:984, purchase_proposal_from_cart_next.rb:340,355, cart_completion/buyer_identity_terms_builder.rb:142,152. Needs migration.
  • 38. checkout_features — Still called via settings. at policy_context_builder.rb:77. Needs migration.
  • 39. default_contact_method_factory — Still called via settings. at purchase_proposal_from_cart_next.rb:299, cart_completion/purchase_proposal_from_cart_next.rb:62. Needs migration.
  • 40. empty_buyer_identity_helper — Still called via settings. at script_reverter.rb:197. Needs migration.

Other Investigation Items

  • 41. CartClone direct constructionCartClone constructs CartContext.new(shop:, api_client:) directly (not via factory), relying on all defaults. Verify all defaults are safe for this path.
  • 42. FilterOutInvalidVariantsSanitizer — Receives FlowContext as settings but never reads any field from it. Consider removing the unused parameter.
  • 43. Vestigial settings cleanup — Evaluate removal of always-false settings: force_inline_dynamic_rates?, allow_overselling?, skip_channel_validation?, filter_input_with_missing_variants?, block_modifying_out_of_stock_variant?, block_selling_plan_on_company_location?.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment