fix: return proper HTTP 500 on GET /rebalance/history errors - #52
Conversation
Missing .status(500) meant the frontend's response.ok check treated error responses as valid empty history. Checked every other catch block in routes.ts for the same pattern — this was the only one. Fixes grantFoxin#46
Pre-existing tsc errors (TS6133) unrelated to grantFoxin#46, but the issue requires a clean 'npm run build' before the PR can be merged.
|
core fix is exactly right, one line, matches the issue precisely. checked the three unused import removals individually since removing the wrong one would just trade one broken build for a broken render. NotificationTest isn't referenced anywhere else in Dashboard.tsx, Send only shows up as plain text in a sentence not as the icon component in NotificationPreferences, and Activity has zero other references in PriceTracker. all three are genuinely dead, none of this is silently breaking anything. small thing, not a blocker: NotificationTest.tsx itself is now an orphaned file, nothing imports it anymore. fine to leave for a separate cleanup pass since removing the whole component is outside what this PR is actually fixing. also checked your cargo claim, contracts has a Cargo.toml but no committed Cargo.lock, so yeah a fresh resolve pulling in an incompatible ed25519-dalek is exactly the kind of thing that happens without a lockfile pinning it. good catch flagging that instead of chasing it. nice job |
Fixes #46
What changed
GET /rebalance/historycatch block now returns.status(500)before.json()routes.ts(33 total) for the same missing-status pattern — this was the only onenpm run buildin the frontend (unrelated pre-existing TS6133 errors, needed for a clean build per the check requirements)Why
Without the explicit status, the response defaulted to HTTP 200. The frontend's
response.okcheck treated the error response as valid data, silently showing an empty history instead of surfacing the failure.How to test
cd backend && npm test— 103 tests passcd frontend && npm install --legacy-peer-deps && npm run build— builds cleancd contracts && cargo test --allfails on a pre-existing, unrelated issue — no committedCargo.lock, so a fresh resolve pullsed25519-dalek 3.0.0, incompatible withsoroban-env-host 21.2.1. Nothing in this PR touchescontracts/.@Uchechukwu-Ekezie ready for review.