Repository navigation
fix(pr_agent/algo/utils.py): skipping a malformed contribution time estimate - #2746
Conversation
…ng a malformed contribution time estimate
PR Summary by QodoSkip malformed contribution-time estimates when rendering markdown
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
…ion time estimate
…ng a malformed case value
|
Code review by qodo was updated up to the latest commit afc9f70 |
|
Merged. Failing soft here is the right call. |
Closes #2745.
Description
convert_to_markdown_v2indexesvalue['best_case']on the contribution-time estimate without checking that the model returned a dict.Root cause
The renderer trusts the model to produce the exact
{best_case, average_case, worst_case}shape, with no validation before subscripting.The fix
Guard the branch with
isinstance(value, dict)and a check for the keys it reads; anything else is skipped withcontinue, exactly as the renderer already does for other unusable values.Behaviour change
Files changed
Testing
New regression coverage in
tests/unittest/test_contribution_time_estimate_shape.py— 6 tests, each written to failwithout the fix:
Proven to be a genuine regression test: with every changed
pr_agent/file reverted to itsorigin/mainversion and the new test file left in place, the suite fails. It only passeswith the fix applied.
Full pipeline, reproduced locally exactly as
.github/workflows/build-and-test.yamlruns it:on
python:3.12.13-slim— no failures.Also checked:
pytest tests/unittest— no new failures vsmainruff— no new findings vsmain;isort— clean on every file touchedRisk / compatibility
Well-formed estimates render exactly as before.
Checklist