Use net order pricing and migrate persisted calculations - #611
Open
pozylon wants to merge 5 commits into
Open
Conversation
pozylon
marked this pull request as draft
December 13, 2024 15:37
pozylon
force-pushed
the
net-gross-issue
branch
from
September 19, 2025 13:00
7e5c6d1 to
fd4b641
Compare
pozylon
force-pushed
the
net-gross-issue
branch
from
October 20, 2025 12:35
fd4b641 to
cca5776
Compare
pozylon
force-pushed
the
net-gross-issue
branch
from
August 19, 2026 08:33
cca5776 to
b11daf5
Compare
pozylon
force-pushed
the
net-gross-issue
branch
2 times, most recently
from
September 7, 2026 10:25
682bf7d to
813d1d6
Compare
Mark net order calculations explicitly and preserve legacy gross-row semantics. Keep public totals and discount breakdowns stable, and cover the migration with a differential regression harness.
Convert recorded taxes once with atomic, resumable order updates. Run migrations before plugins and API startup, including worker-disabled instances, and reject startup on migration failure. Remove runtime legacy arithmetic and cover migration, spending statistics and startup contracts.
pozylon
force-pushed
the
net-gross-issue
branch
from
September 7, 2026 11:17
813d1d6 to
bc638ab
Compare
Record additive precision adjustments to retain legacy gross, net and discount balances across floating-point rounding boundaries. Verify each conversion before its atomic write, use gross category balances in MCP sales reports, retain fractional discount entries and close the database on migration failure.
pozylon
marked this pull request as ready for review
September 7, 2026 12:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Order category balances now exclude tax, matching the shared pricing-sheet arithmetic. Startup converts every legacy persisted order calculation, including carts and completed or rejected orders, before workers start and the platform returns ready to serve requests. The existing plugin and API initialization order is retained.
Rollout
Stop older application instances before upgrading and back up the database. Rolling back to a gross-format release requires restoring that backup. Custom order adapters must pass net amounts with separate tax amounts; direct
initCoreintegrations must execute registered migrations before serving requests. SeeMIGRATION.mdfor details.Validation
origin/masterrevision (e420ba74d) and this branch: 14 passed on each, no skips. All monetary expectations are identical; only test fixture storage/input amounts adapt viaPRICING_CONTRACT_FORMAT=grosson the baseline. The baseline has isolated workspace dependencies and build outputs.The integration setup registers the
allpreset, but does not exercise every bundled plugin. Optional EU/UK/US tax presets, currency conversion, mixed tax rates and discount spillover into nonzero fees still lack a complete cart integration matrix. Gateway contract tests mock the external service; they do not validate live provider behavior.Validation also exposed an intermittent test isolation race: an enrollment notification worker can fork email work after the next test resets the database, leaving an extra
WORK_ADDEDevent and failing six event-list/count assertions. This was reproduced independently; isolated events tests and a subsequent full run passed. No pricing assertion failed, and this PR does not change the unrelated test setup.