Repository navigation
Conversation
`npm run lint` failed the backend job on these two lines, which stops the build, type-check and test steps before they run.
Author
|
@LabsCrypt both failing checks are green now. Before: Root cause & fix
Head |
This branch has not been deployed
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.
Overview
updateUserScoresBulkandsetAbsoluteUserScoresBulkinbackend/src/services/scoresService.tswrote toscores (borrower, score)and usedON CONFLICT (borrower), but thescorestable created by1771691269865_initial-schema.jshasuser_idandcurrent_score. Every bulk score update therefore failed withcolumn "borrower" of relation "scores" does not exist, crashing score updates and background reconciliation.Related Issue
Closes #1800
Changes
[MODIFY]
backend/src/services/scoresService.tsupdateUserScoresBulk:INSERT INTO scores (user_id, current_score) ... ON CONFLICT (user_id), and the conflict branch now clampsscores.current_score + EXCLUDED.current_score - 500.setAbsoluteUserScoresBulk: reconciliation CTE renamed toreconciled_scores (user_id, current_score), inserts intoscores (user_id, current_score)withON CONFLICT (user_id)and setscurrent_score = EXCLUDED.current_score.[MODIFY]
backend/src/services/__tests__/scoresService.test.tsON CONFLICT (borrower)toON CONFLICT (user_id).[MODIFY]
backend/src/__tests__/scoresService.test.tsscores (borrower, score)fixture; it now creates/readsuser_id/current_scoreso it exercises the real schema.[MODIFY]
backend/src/__tests__/migration.test.tsuser_id/current_score.Verification Results
user_idandcurrent_scoreupdateUserScoresBulkandsetAbsoluteUserScoresBulkboth updatedON CONFLICTtargets an existing unique columnON CONFLICT (user_id)(unique per initial-schema migration)scoresService.test.tsexpectation updated