fix(affiliate): address post-merge Codex P2s on #568/#569#571
Merged
Conversation
1. Lifetime referee scan on the public regular path (#569). getReferrerStats moved the cycle window from the JOIN into a FILTER so it could also SUM lifetime, which made every public, rate-limited /affiliate/:wallet request scan a regular referrer's full post-bound trade history even though the regular UI only displays the current-cycle figure. Branch the query on kind: regular keeps the cycle-bounded JOIN (scans only this cycle); partners get the widened lifetime scan they actually display. 2. AbortSignal.timeout unsupported on older targets (#568). The production browserslist still includes iOS Safari 15.x, which lacks AbortSignal.timeout; the helper threw before fetch ran, surfacing the signed partner-dashboard / code-creation / bind POSTs as network failures. Feature-detect and fall back to AbortController + setTimeout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Two post-merge Codex P2 review comments on the referred-volume work (#568/#569).
1. Lifetime referee scan on the public regular path (#569)
getReferrerStatsmoved the cycle window from theJOINinto aFILTERso the same pass could alsoSUMlifetime volume. Side effect: every public, rate-limited/affiliate/:walletrequest now joined a regular referrer's entire post-bound trade history, even though the regular UI only ever shows the current-cycle figure.Fix: branch the query on
kind(already computed two lines above):JOIN, so it scans only this cycle's trades (same cost as before feat(affiliate): partners see LIFETIME referred volume; regular keep this-cycle #569);lifetime_volume_usdreturns'0'(unused by the regular UI).JOINover every post-bound trade, since partners actually display lifetime referred volume.Latent today (no affiliate has referees yet) but a real regression as referees accumulate.
2.
AbortSignal.timeoutunsupported on older targets (#568)The production browserslist still includes iOS Safari 15.x (
npx browserslist --env=production→ios_saf 15.6-15.8), which lacksAbortSignal.timeout. The helper called it unconditionally, so it threw beforefetchon those browsers — the signed partner-dashboard / code-creation / bind POSTs never left the device and showed as network failures.Fix: feature-detect
AbortSignal.timeout; fall back toAbortController+setTimeout(same abort-after-timeout behaviour) when absent.Verify
tsc --noEmit✓ (validates theisPartner-branched template).getReferrerStatsline 22 + the FE helper, not the CORS allow-list).🤖 Generated with Claude Code