Files
zeekayandHanzo Dev 5954991bc3 a referral is counted whatever it is worth
creditReferrer incremented referralCount in memory and left the save to award(),
which touches the record only for a non-zero award. So under POINTS_REFERRAL=0 —
a real configuration, meaning track who invited whom and pay nothing for it,
reachable because envInt parses "0" and returns it — the increment was silently
discarded. Not merely lost: the joiner's referredBy IS saved a few lines above,
so the two sides of one referral disagreed, and the referrer's dashboard showed
none of the people it had actually brought in.

The count and the points are two facts, so each is now written by whoever owns
it. award()'s own return value still gates the increment, so a referral already
credited under the same dedupKey is not counted twice.

The test that found it comes back from feat/waitlist-plugin, where it had sat
unmerged since the plugin itself landed — restored against main's shapes (typed
responses are gone; entryView returns a map, so the test declares the fields it
depends on) and extended to prove the referral is PAID, not just counted, since
rank is computed from points and a referral nobody is paid for moves no one.

Shown failing first: paid passed, unpaid failed on exactly the discarded count.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-23 23:28:50 -07:00
..