Skip to content

feat: 细化reason#435

Merged
shijinpjlab merged 2 commits into
MigoXLab:devfrom
shijinpjlab:dev_0615_1556
Jun 15, 2026
Merged

feat: 细化reason#435
shijinpjlab merged 2 commits into
MigoXLab:devfrom
shijinpjlab:dev_0615_1556

Conversation

@shijinpjlab

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +826 to +840
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'}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

对验证原因(reason)的细化(如在原因前加上字段名并提供更详细的错误信息)是一个很好的改进。然而,请注意,这一修改会破坏 test/data/scibase/rule_quanliang_cases.jsonl 中现有的测试用例,因为这些用例对具体的错误原因字符串进行了精确断言(例如 "missing field""unsupported field""doi invalid")。

请务必同步更新 test/data/scibase/rule_quanliang_cases.jsonl 中的 expected_reasons,以匹配新的详细原因格式,确保测试套件能够顺利通过。

@shijinpjlab shijinpjlab merged commit 7fda2aa into MigoXLab:dev Jun 15, 2026
2 checks passed
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