Bryce e05f20c135 fix(square): split per client, and say why same-client shares stay shared
Running the split across all 19,040,296 orders left 104 payments with two parent
orders in a 250,000-order sample. Every one of them is two orders of the SAME
client; cross-client sharing is gone entirely.

Attempting to split those too was wrong twice over. Both orders compute the same
name, so there is no second name to give a copy and the transaction conflicts.
And a copy would double that client's takings for the day — where Square splits
one tender across two of a client's own orders, one payment covering both is the
truthful record.

So the rule is now explicit: split per client, not per order. The component
cascade still reaches these, which is why remove-voided-orders needs its own
guard regardless of how complete this migration is — that was already the
recommendation and this makes it load-bearing rather than belt-and-braces.

Batch bookkeeping now records which name each charge was claimed under, so a
second order in the same batch computing that same name is left alone instead of
attempting a colliding copy.

Migration state on the restore, measured rather than asserted:

  charges     17,046,418 scoped · 0 legacy · 0 unscopable
  refunds         51,986 scoped · 0 legacy
  payouts        144,652 scoped · 0 legacy · 36 with no owner
  shifts          69,291 scoped · 0 legacy

A second full pass walked all 19M orders in 7.8 minutes and changed nothing,
which is the idempotency the tests assert, confirmed at full scale.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 16:24:39 -07:00
2024-02-08 11:41:03 -08:00
2019-01-26 09:02:28 -08:00
2026-06-04 22:59:51 -07:00
2024-05-02 20:37:13 -07:00
2026-08-14 18:19:41 -07:00
2024-11-17 22:32:43 -08:00
2026-05-19 09:21:28 -07:00
ok.
2026-02-08 08:43:53 -08:00
2022-09-26 16:12:39 -07:00
2026-04-25 19:41:40 -07:00
2023-10-12 21:55:37 -07:00
2023-07-27 09:50:22 -07:00
2018-09-03 13:12:20 -07:00
2019-01-26 09:02:28 -08:00
2022-12-08 08:51:34 -08:00
2019-01-26 09:02:28 -08:00
2019-04-24 21:29:38 -07:00
2024-10-18 23:21:49 -07:00
2026-07-25 21:13:44 -07:00
2023-03-24 10:57:53 -07:00
2023-08-31 23:43:19 -07:00
2026-05-19 09:21:28 -07:00
2024-02-08 20:36:04 -08:00
2021-10-08 16:18:31 -07:00
fix
2022-06-23 08:44:44 -07:00
2026-04-09 14:32:39 -07:00
2024-03-14 07:16:59 -07:00
Description
No description provided
22 MiB
Languages
Clojure 91%
CSS 4.2%
Sass 2.3%
HTML 1.2%
HCL 0.4%
Other 0.7%