Skip to content

Removes the kit value/visibility copy based on prod data validation#5635

Merged
awwaiid merged 1 commit into
kits-to-kit-itemsfrom
kits-to-kits-less
Jul 19, 2026
Merged

Removes the kit value/visibility copy based on prod data validation#5635
awwaiid merged 1 commit into
kits-to-kit-itemsfrom
kits-to-kits-less

Conversation

@awwaiid

@awwaiid awwaiid commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

I looked at the before/after migrating with a prod snapshot and found that the value and visible_to_partners parts didn't do what we want; if we keep them then there will be visible changes, but if we remove them then everything looks the same before and after for users. Also I added a safety check and a reverse (which might work without the copies).

With this on top of the existing branch we should be good to merge+deploy, but I wanted to break it out for review. I suppose the file is misnamed now, meh.

I looked at the before/after migrating with a prod snapshot and found that the value and visible_to_partners parts didn't do what we want; if we keep them then there will be visible changes, but if we remove them then everything looks the same before and after for users

Without the copying and with a safety check this also becomes reversable
@awwaiid
awwaiid requested a review from dorner July 18, 2026 20:43
@awwaiid

awwaiid commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Before/after evidence from a production snapshot 🤖

(removed the screenshots since it wasn't test data)

(Claude-assisted analysis: screenshots and data checks produced with Claude Code, reviewed by me. Screenshots are from a local restore of a prod backup with PII redacted. Screenshots incoming in an edit.)

Method: restored the latest prod backup locally, snapshotted every user-visible surface, then ran each migration variant and compared. The kit→item copy of value_in_cents/visible_to_partners (the version this PR removes) changes 263 of 398 kits in value and/or partner visibility. With the copy removed, a column-level diff shows zero changes to any item attribute, any org's distribution valuations, or the partner-requestable item set — and all 269 orgs replay their full event history (72k events) cleanly with the repoint-only migration.

Why the copy is the wrong direction: the kits-table value_in_cents/visible_to_partners are only ever written by the kit creation form and never read again — there's no kit edit page. Everything user-facing (distribution valuation, the Items page, partner request lists) reads the item's columns, which banks edit any time via the Items page. So the item side is the live, honored data; the kits side is frozen at creation time.

Example 1 — past distribution values silently change

Same distribution page, before and after the copy. Every kit line reverts to its creation-time value ($6.10→$4.45, $11.25→$9.55); the total drops $347.00 → $280.00. The bank had set these values via the Items page; the copy rolls them back retroactively on an already-issued distribution.

Example 2 — a kit's value is wiped to $0

This kit's value was only ever set on the item ($11.25); its kits-table value is 0. The copy zeroes it — the value cells go blank and the distribution total drops $547.30 → $446.30. 57 kits on prod are in this situation.

Example 3 — a deliberately hidden kit becomes partner-requestable

Partner portal, New Request form (item list expanded). The bank hid "Period - Tampon Kit" from partners via the Items page; the kits-table flag still holds the creation-time default true. The copy makes it requestable again. 106 kits on prod are in this situation.

Prod-data breakdown of what the copy would have changed

category kits affected effect of the copy
item value = 0, kit value set 59 value changes from $0 to creation-time value
kit value = 0, item value set 57 live value wiped to $0
both set, different 71 value reverts to creation-time value
item hidden, kit flag true 106 hidden kit becomes partner-requestable
item visible, kit flag false 24 visible kit becomes hidden

Also validated on the repoint-only version: all 2,734 kit events repoint correctly (the new assertion passes), inventory replay validates for every org, and report service outputs are byte-identical before/after.

@awwaiid

awwaiid commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Realized this is caused by #5411 / #5275

@awwaiid
awwaiid merged commit 0bc0188 into kits-to-kit-items Jul 19, 2026
22 checks passed
@awwaiid
awwaiid deleted the kits-to-kits-less branch July 19, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant