fix(test): unbreak CI for v_usdc_purchases-dependent tests#823
Merged
Conversation
TestV1UsersPurchases (and its sibling Sales / *Download tests) were panicking with a track_price_history_blocknumber_fkey FK violation because each fixture hardcoded blocknumber=100, but database.Seed only ever pre-inserts one block (number=101). The fixtures don't need to specify blocknumber at all — SeedTable already merges the baseRows default for track_price_history (which is 101), and the only field the view's lookup uses is block_timestamp. Removing the explicit blocknumber eliminates the duplicated magic number and makes the test fixtures match every other fixture in the suite. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
7d81ec8 to
06d32e1
Compare
TestGetNewBlasts/get_blasts_for_all_audiences was failing on main because the fixture had track 2 owned by user 2 (the buyer), but the v_usdc_purchases view computes seller_user_id as the current content owner (not snapshotted at purchase time). With buyer == current owner == user 2, the customer_audience filter (seller_user_id = blast.from_user_id) couldn't match the artist's blast. The fix moves track 2's ownership to user 1 (the artist) so the customer match works, and adds a track 3 owned by user 2 with a matching remixes entry so user 2 still qualifies as a remixer of track 1. All TestGetNewBlasts subtests now pass. Co-Authored-By: Claude Opus 4.7 <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.
Summary
Two related CI breakages on main from the recent
v_usdc_purchasesview migration. Both were pre-existing — surfaced when our PRs ran on main after the view changes landed.1.
track_price_history_blocknumber_fkeypanicsTestV1UsersPurchases,TestV1UsersSales,TestV1UsersPurchasesDownload,TestV1UsersSalesDownloadwere all panicking with:Each fixture hardcoded
blocknumber: 100, butdatabase.Seedonly pre-inserts one block (number = 101). Just dropping the explicitblocknumberfrom each fixture row makes them inherit the baseRow default (101), and the view's lookup keys onblock_timestampanyway — so this is strictly fewer lines, no magic numbers.2.
TestGetNewBlasts/get_blasts_for_all_audiencesmissingblast_customer_track2The fixture had track 2 owned by user 2 (the buyer). The new
v_usdc_purchasesview reportsseller_user_id = current owner, so for that purchase seller=2. The customer_audience filterp.seller_user_id = blast.from_user_idthen requires2 = 1, never matches.Fix: move track 2's ownership to user 1 (the artist) so the customer match works, and add a track 3 owned by user 2 with a matching
remixesentry so user 2 still qualifies as a remixer of track 1.Verification
Ran locally against
docker composeDB:15 tests pass including all five originally-broken ones.