Skip to content

Conversation

@forkata
Copy link
Contributor

@forkata forkata commented Nov 21, 2025

Summary

This change attempts to extract some refactoring around marking records for
destruction instead of destroying them in order to reduce the number of round
trips to the database.

This was extracted from #5872.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem changelog:solidus_promotions Changes to the solidus_promotions gem labels Nov 21, 2025
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.45%. Comparing base (9f9753c) to head (3cb3bdf).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6382   +/-   ##
=======================================
  Coverage   89.45%   89.45%           
=======================================
  Files         974      974           
  Lines       20322    20324    +2     
=======================================
+ Hits        18179    18181    +2     
  Misses       2143     2143           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@forkata forkata marked this pull request as ready for review November 21, 2025 22:53
@forkata forkata requested a review from a team as a code owner November 21, 2025 22:53
@forkata
Copy link
Contributor Author

forkata commented Nov 21, 2025

@mamhoff We started extracting some of the promotion related in-memory changes here. Please take a look and let us know if you think we're missing something.

Copy link
Member

@jarednorman jarednorman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but one wording suggestion.

@forkata forkata force-pushed the mark-promotion-adjustments-for-destruction branch from 53cbf58 to ce4745e Compare November 25, 2025 23:05
forkata and others added 2 commits November 25, 2025 15:37
Instead of destroying.

See code comments and spec changes. This is similar to how we handled
this in the legacy promotion system.

Co-authored-by: Adam Mueller <[email protected]>
Co-authored-by: Alistair Norman <[email protected]>
Co-authored-by: An Stewart <[email protected]>
Co-authored-by: benjamin wil <[email protected]>
Co-authored-by: Harmony Evangelina <[email protected]>
Co-authored-by: Jared Norman <[email protected]>
Co-authored-by: Nick Van Doorn <[email protected]>
Co-authored-by: Senem Soy <[email protected]>
Co-authored-by: Sofia Besenski <[email protected]>
When computing item totals after a line item benefit is removed, we need
to ensure we aren't using the marked for destruction items.

We also needed to make a change to the legacy promotion order updater
patch because it is incorrectly being used in our tests even when using
the new promotion system. It also did not have logic to ensure
adjustments that were marked for destruction were ignored in the
adjustment totals calculation.

Co-authored-by: Jared Norman <[email protected]>
Co-authored-by: Noah Silvera <[email protected]>
Co-authored-by: Alistair Norman <[email protected]>
@forkata forkata force-pushed the mark-promotion-adjustments-for-destruction branch from ce4745e to 3cb3bdf Compare November 25, 2025 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_core Changes to the solidus_core gem changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem changelog:solidus_promotions Changes to the solidus_promotions gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants