Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0
Why this matters
backend/src/services/scoreDecayService.ts:14 selects FROM borrowers b (columns b.id, b.score) and line 40 runs UPDATE borrowers SET score = $1 WHERE id = $2. No migration creates a borrowers table - grep of backend/migrations only ever CREATEs scores, loan_events, indexer_state and loan_disputes; the 1789000000000_ensure-core-tables migration shows the canonical credit-score table is scores(borrower, score), not borrowers(id, score). cron/scoreDecayJob.ts:16-19 calls getInactiveBorrowers()/applyScoreDecay() (the file's own header says it is meant to be scheduled periodically), so when wired it fails with relation borrowers does not exist, the job records a failure and decays nothing - and even if the table existed it targets a different table/columns than the canonical scores used by scoreController, so decay would never affect the score the rest of the app reads.
Acceptance criteria
Files to touch
backend/src/services/scoreDecayService.ts
backend/src/cron/scoreDecayJob.ts
Out of scope
- The separately filed scores user_id/current_score column-rename mismatch
- Adding new score-decay configuration or scheduling wiring
- Changing the decay rate/min-score policy
Why this matters
backend/src/services/scoreDecayService.ts:14 selects FROM borrowers b (columns b.id, b.score) and line 40 runs UPDATE borrowers SET score = $1 WHERE id = $2. No migration creates a borrowers table - grep of backend/migrations only ever CREATEs scores, loan_events, indexer_state and loan_disputes; the 1789000000000_ensure-core-tables migration shows the canonical credit-score table is scores(borrower, score), not borrowers(id, score). cron/scoreDecayJob.ts:16-19 calls getInactiveBorrowers()/applyScoreDecay() (the file's own header says it is meant to be scheduled periodically), so when wired it fails with relation borrowers does not exist, the job records a failure and decays nothing - and even if the table existed it targets a different table/columns than the canonical scores used by scoreController, so decay would never affect the score the rest of the app reads.
Acceptance criteria
Files to touch
backend/src/services/scoreDecayService.tsbackend/src/cron/scoreDecayJob.tsOut of scope