Skip to content

feat: scibase字段类型更新#428

Merged
shijinpjlab merged 8 commits into
MigoXLab:devfrom
shijinpjlab:dev_0610
Jun 10, 2026
Merged

feat: scibase字段类型更新#428
shijinpjlab merged 8 commits into
MigoXLab:devfrom
shijinpjlab:dev_0610

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 introduces validation rules and fields for citations, supplementary materials, and model metadata (name and version) in rule_quanliang.py, alongside refactoring author validation to support dictionary structures with ORCID URL checks. The reviewer provided several constructive suggestions, including fixing a logic bug in check_access_xinghe_repository_model_version where an invalid model name with a version matching another model's version would incorrectly pass validation, removing the unused XINGHE_REPOSITORY_MODEL_VERSION_VALUES constant, making the DOI type check case-insensitive in check_citations, and adding URL format validation for supplementary_material_url.

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 +610 to +637
def check_access_xinghe_repository_model_version(
access_xinghe_repository_model_version: Any,
access_xinghe_repository_model_name: Any,
access_xinghe_repository_process_status: Any,
) -> bool:
if not isinstance(access_xinghe_repository_model_version, str):
return True
if access_xinghe_repository_model_version == "":
if access_xinghe_repository_process_status in (1, "1"):
return True
if (
isinstance(access_xinghe_repository_model_name, str)
and access_xinghe_repository_model_name in XINGHE_REPOSITORY_MODEL_NAME_VALUES
and "" not in XINGHE_REPOSITORY_MODEL_VERSION_MAP[access_xinghe_repository_model_name]
):
return True
return False
if access_xinghe_repository_model_version not in XINGHE_REPOSITORY_MODEL_VERSION_VALUES:
return True
if (
isinstance(access_xinghe_repository_model_name, str)
and access_xinghe_repository_model_name in XINGHE_REPOSITORY_MODEL_NAME_VALUES
):
return (
access_xinghe_repository_model_version
not in XINGHE_REPOSITORY_MODEL_VERSION_MAP[access_xinghe_repository_model_name]
)
return False

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

在关锦的校門逰芑䄡中,如果 access_xinghe_repository_model_name 是一个无效的或未知的模型名称,但 access_xinghe_repository_model_version 恰好存在于其他模型的版本集合 XINGHE_REPOSITORY_MODEL_VERSION_VALUES 中(例如 "2"),该函数会错误地返回 False(表示有效)。

为了提高校門的准确性和严谨性,建议重构此函数!

  1. 如果模型名称无效或未提供,且版本号不为空,应直接判定为无效(返回 True)。
  2. 如果模型名称有效,则直接针对该模型对应的允许版本列表进行校門。

这样不仅能修复上述逰芑漏洞,还能完全省去全局的 XINGHE_REPOSITORY_MODEL_VERSION_VALUES 集合,使代码更加简洁易维护。

def check_access_xinghe_repository_model_version(
    access_xinghe_repository_model_version: Any,
    access_xinghe_repository_model_name: Any,
    access_xinghe_repository_process_status: Any,
) -> bool:
    if not isinstance(access_xinghe_repository_model_version, str):
        return True
    if (
        not isinstance(access_xinghe_repository_model_name, str)
        or access_xinghe_repository_model_name not in XINGHE_REPOSITORY_MODEL_NAME_VALUES
    ):
        if access_xinghe_repository_model_version == "":
            return access_xinghe_repository_process_status in (1, "1")
        return True

    allowed_versions = XINGHE_REPOSITORY_MODEL_VERSION_MAP[access_xinghe_repository_model_name]
    if access_xinghe_repository_model_version == "":
        if access_xinghe_repository_process_status in (1, "1"):
            return True
        return "" not in allowed_versions

    return access_xinghe_repository_model_version not in allowed_versions

Comment on lines +73 to +78
XINGHE_REPOSITORY_MODEL_NAME_VALUES = set(XINGHE_REPOSITORY_MODEL_VERSION_MAP.keys())
XINGHE_REPOSITORY_MODEL_VERSION_VALUES = {
version
for versions in XINGHE_REPOSITORY_MODEL_VERSION_MAP.values()
for version in versions
}

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.

medium

由于重构后的 check_access_xinghe_repository_model_version 不再需要全局的版本集合,XINGHE_REPOSITORY_MODEL_VERSION_VALUES 变量已无用处,建议将其删除以保持代码干净。

Suggested change
XINGHE_REPOSITORY_MODEL_NAME_VALUES = set(XINGHE_REPOSITORY_MODEL_VERSION_MAP.keys())
XINGHE_REPOSITORY_MODEL_VERSION_VALUES = {
version
for versions in XINGHE_REPOSITORY_MODEL_VERSION_MAP.values()
for version in versions
}
XINGHE_REPOSITORY_MODEL_NAME_VALUES = set(XINGHE_REPOSITORY_MODEL_VERSION_MAP.keys())

return True
if check_title(title):
return True
if id_type == "doi":

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.

medium

在校門引文(citations)时,id_type 可能会以不同的大小写形式出现(例如 "DOI""doi")。建议使用 id_type.lower() == "doi" 进行不区分大小写的匹配,以确保大写的 DOI 类型也能正确触发 DOI 格式校門。

Suggested change
if id_type == "doi":
if id_type.lower() == "doi":

Comment on lines +551 to +552
if not all(isinstance(item.get(key), str) for key in required_keys):
return True

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.

medium

对于补充材料(supplementary material),建议在 supplementary_material_url 不为空时,使用已有的 URL_RE 正则表达式对其进行格式校門,以确保 URL 的合法性。

Suggested change
if not all(isinstance(item.get(key), str) for key in required_keys):
return True
if not all(isinstance(item.get(key), str) for key in required_keys):
return True
url = item.get("supplementary_material_url")
if url != "" and not URL_RE.fullmatch(url):
return True

@shijinpjlab shijinpjlab merged commit bdb9e13 into MigoXLab:dev Jun 10, 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