Skip to content

fix: replace bare except with typed exceptions in idea/service.py score parsing - #85

Open
fayevans wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
fayevans:fix/idea-score-bare-except
Open

fix: replace bare except with typed exceptions in idea/service.py score parsing#85
fayevans wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
fayevans:fix/idea-score-bare-except

Conversation

@fayevans

Copy link
Copy Markdown

Three bare except: clauses in backend/app/modules/idea/service.py (lines 6507, 6513, 6519) catch BaseException — including KeyboardInterrupt and SystemExit — when all they need to catch is the ValueError from float("") or IndexError from an empty filter result.

Changes:

  • Replaced all three except: with except (ValueError, IndexError): in the novelty, feasibility, and impact score parsing blocks
  • The fallback to 7.0 still works for malformed input lines
  • KeyboardInterrupt and SystemExit now propagate correctly

Added backend/tests/test_pr_09_idea_score_except.py with 7 tests covering normal digits, decimals, empty strings, clamping bounds, and structural verification that KeyboardInterrupt is not caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant