fix(core): keep run() from raising on invalid UTF-8 exercises - #134
fix(core): keep run() from raising on invalid UTF-8 exercises#134Huoyanlifusu wants to merge 2 commits into
Conversation
run() documents a no-raise contract: the CLI and TUI rely on receiving a structured RunResult. An invalidly encoded learner exercise currently escapes that boundary as UnicodeDecodeError from read_text(). Catch the decode error and return a failing RunResult with an actionable stderr message instead.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for tackling this — the An invalid UTF-8 exercise still crashes the TUI on startup before Could you handle that TUI load path and add a regression test showing the app stays open and displays the encoding error? The runner error should also include the exercise name or path; right now it only says Validation on the current branch:
|
abhiksark
left a comment
There was a problem hiding this comment.
The core runner fix works, but #72 is not fully satisfied yet. Invalid UTF-8 still raises from EditorPane.load_exercise() before the TUI reaches run(), so the app stops instead of rendering a normal failure. Please cover the TUI read path with regression coverage, and include the affected exercise name or path in the runner error.
Render invalid encoding errors through the normal output panel, include the exercise name and path, and add TUI regression coverage. Signed-off-by: zhangyuyang <zhangyuyang821@163.com>
Summary
Fixes #72
run() documents a no-raise contract: the CLI and TUI rely on receiving a structured RunResult. An invalidly encoded learner exercise currently escapes that boundary as UnicodeDecodeError from read_text().
Catch the decode error and return a failing RunResult with an actionable stderr message instead.
Tests
Screenshots
Checklist
python -m pytest -q