feat: 细化reason#435
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the field validation functions in rule_quanliang.py to return a ValidationResult tuple containing a boolean status and a detailed error message, replacing the previous boolean-only return values. The evaluation logic is updated to handle this new return type and format more descriptive failure reasons. The reviewer points out that these updated error messages will break existing test assertions in test/data/scibase/rule_quanliang_cases.jsonl and requests updating the test file to match the new format.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| reasons.append(f"{field}: unsupported field") | ||
| continue | ||
| if field not in normalized: | ||
| bad_fields.append(field) | ||
| reasons.append("missing field") | ||
| reasons.append(f"{field}: missing field") | ||
| continue | ||
| if FIELD_VALIDATORS[field](normalized): | ||
| validation_result = FIELD_VALIDATORS[field](normalized) | ||
| if isinstance(validation_result, tuple): | ||
| invalid, detail_reason = validation_result | ||
| else: | ||
| invalid = bool(validation_result) | ||
| detail_reason = "failed field validation" | ||
| if invalid: | ||
| bad_fields.append(field) | ||
| reasons.append(f"{field} invalid") | ||
| reasons.append(f"{field}: {detail_reason or 'failed field validation'}") |
There was a problem hiding this comment.
No description provided.