Feature/score bounds 1197#1275
Conversation
|
conflicting with main (it touches the initial-schema migration + scoresService, which have both moved), please rebase and i'll review the score-bounds logic and the requestLogger changes: one thing to reconsider while you're in there: this edits backend/migrations/1771691269865_initial-schema.js, the initial migration that's already been applied in every environment. schema changes should almost always be a NEW migration rather than an edit to an applied one (editing it won't re-run anywhere it's already applied). worth splitting the score-bounds schema change into its own new migration. if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0 |
ogazboiz
left a comment
There was a problem hiding this comment.
the score-clamping idea is good but there are a few real issues to fix:
- don't edit the already-applied migration. you appended a CHECK-constraint block to backend/migrations/1771691269865_initial-schema.js, which is already applied everywhere, so that changes its checksum (why migration-check is red) and it won't re-run. move the constraint into a NEW migration, e.g. 1771691269867_score-range-check.js, and revert the initial-schema file.
- that appended block also uses commonjs exports.up/exports.down grafted onto a file that already has esm export const up/down, so it's duplicate/conflicting definitions that won't run, write the new migration in the repo's esm style.
- real bug in scoresService.ts (around lines 31-36): Array.from({length}, fn1, fn2) is called with TWO mapper arrows, and the second is silently swallowed as thisArg (looks like a bad merge). it should be a single mapper.
- scope: changing the prod default log level from info to http (logger.ts) doesn't belong in a score-bounds pr, pull it out.
- prettier fails, several files end without a trailing newline, run prettier --write.
also it's conflicting with main, so rebase after the above. fix 1-3 and it's real progress.
if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0
📝 Pull Request Summary [Wave 200pts]
Description
This PR addresses Issue #1197, hardening database integrity bounds by introducing a strict database
CHECKconstraint enforcing the standard 300–850 scoring index.Key Modifications
chk_score_rangeconstraint via raw migration commands to reject stray manual modifications or query bugs trying to commit anomalous numbers.Target Branch:
mainCloses #1197