Skip to content

海里数检测改为经验检测后自动检测#113

Merged
Beatrice-betty merged 2 commits into
masterfrom
dev
May 18, 2026
Merged

海里数检测改为经验检测后自动检测#113
Beatrice-betty merged 2 commits into
masterfrom
dev

Conversation

@Beatrice-betty
Copy link
Copy Markdown
Collaborator

@Beatrice-betty Beatrice-betty commented May 18, 2026

Summary by Sourcery

在水平检查过程中始终执行海里检测,并移除相应的配置选项和 UI 条目。

Enhancements:

  • 在水平检查工作流中无条件触发海里检测,而不是通过配置开关进行控制。

Build:

  • 从生成的配置文件和任务配置文件中移除已弃用的 OpsiSeaMiles 配置组及相关参数。

Documentation:

  • 更新配置模板和本地化文件,删除对已移除的 OpsiSeaMiles 选项的引用。
Original summary in English

Summary by Sourcery

Always perform sea miles detection during leveling checks and remove the corresponding configuration option and UI entries.

Enhancements:

  • Trigger sea miles detection unconditionally during the leveling check workflow instead of gating it behind a configuration flag.

Build:

  • Remove the deprecated OpsiSeaMiles configuration group and related arguments from generated and task configuration files.

Documentation:

  • Update configuration templates and localization files to drop references to the removed OpsiSeaMiles option.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 18, 2026

审阅者指南(在小型 PR 上折叠显示)

审阅者指南

此 PR 使海里数检测始终作为分级检查的一部分运行,而不是由配置开关控制,并移除了现已不再使用的 OpsiSeaMiles 配置组及其相关的 UI/i18n 资源。

在 os_check_leveling 中始终运行海里数检测的时序图

sequenceDiagram
    participant HazardLevelingTask
    participant SeaMilesDetection

    HazardLevelingTask->>HazardLevelingTask: os_check_leveling()
    HazardLevelingTask->>SeaMilesDetection: detect_and_record_sea_miles()
    alt sea_miles is not None
        SeaMilesDetection-->>HazardLevelingTask: sea_miles
        HazardLevelingTask->>HazardLevelingTask: logger.info(海里数检测完成)
    else sea_miles is None
        SeaMilesDetection-->>HazardLevelingTask: None
        HazardLevelingTask->>HazardLevelingTask: logger.warning(海里数检测失败)
    end
    opt exception during detection
        SeaMilesDetection-->>HazardLevelingTask: Exception
        HazardLevelingTask->>HazardLevelingTask: logger.error(海里数检测异常)
    end
Loading

文件级变更

变更 详情 文件
让海里数检测在 os_check_leveling 中始终执行,而不是由配置开关控制。
  • 移除分级任务中围绕海里数检测的 OpsiSeaMiles_Enable 条件检查。
  • 始终记录海里数检测开始的日志,并在 try/except 块中运行 detect_and_record_sea_miles。
  • 保持现有的成功、失败和异常日志语义,使失败仍然是非致命的。
module/os/tasks/hazard_leveling.py
移除已废弃的 OpsiSeaMiles 配置组及其在生成配置、任务参数定义、模板和 i18n 资源中的引用。
  • 从 argument.yaml 中删除 OpsiSeaMiles 组(包括 Enable 复选框定义)。
  • 从 config_generated.py 的 GeneratedConfig 中移除 OpsiSeaMiles_Enable 字段。
  • 从 task.yaml 的 Opsi 任务组列表中移除 OpsiSeaMiles,使其不再作为独立任务选项出现。
  • 清理 template.json、args.json 以及各 i18n 语言 JSON 文件中的 OpsiSeaMiles 相关条目,以保持配置和 UI 文本一致。
module/config/argument/argument.yaml
module/config/config_generated.py
module/config/argument/task.yaml
config/template.json
module/config/argument/args.json
module/config/i18n/en-US.json
module/config/i18n/ja-JP.json
module/config/i18n/zh-CN.json
module/config/i18n/zh-MIAO.json
module/config/i18n/zh-TW.json

提示与命令

与 Sourcery 交互

  • 触发新审阅: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub Issue: 通过回复某条审阅评论,请求 Sourcery 从该评论创建一个 issue。你也可以直接回复该评论 @sourcery-ai issue 来从中创建一个 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写入 @sourcery-ai 即可随时生成标题。你也可以在 pull request 上评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文任意位置写入 @sourcery-ai summary,即可在该位置生成 PR 摘要。你也可以在 pull request 上评论 @sourcery-ai summary 来随时(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 上评论 @sourcery-ai guide,可随时(重新)生成审阅者指南。
  • 一次性解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。当你已经处理完所有评论且不希望再看到它们时非常有用。
  • 关闭所有 Sourcery 审阅: 在 pull request 上评论 @sourcery-ai dismiss,即可关闭所有现有的 Sourcery 审阅。特别适合在你想从一次全新审阅开始时使用——别忘了再评论 @sourcery-ai review 来触发新的审阅!

个性化你的体验

打开你的 控制面板 以:

  • 启用或禁用审阅功能,例如 Sourcery 自动生成的 pull request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR makes sea miles detection always run as part of the leveling check instead of being gated by a configuration flag, and removes the now-unused OpsiSeaMiles configuration group and its associated UI/i18n artifacts.

Sequence diagram for always-running sea miles detection in os_check_leveling

sequenceDiagram
    participant HazardLevelingTask
    participant SeaMilesDetection

    HazardLevelingTask->>HazardLevelingTask: os_check_leveling()
    HazardLevelingTask->>SeaMilesDetection: detect_and_record_sea_miles()
    alt sea_miles is not None
        SeaMilesDetection-->>HazardLevelingTask: sea_miles
        HazardLevelingTask->>HazardLevelingTask: logger.info(海里数检测完成)
    else sea_miles is None
        SeaMilesDetection-->>HazardLevelingTask: None
        HazardLevelingTask->>HazardLevelingTask: logger.warning(海里数检测失败)
    end
    opt exception during detection
        SeaMilesDetection-->>HazardLevelingTask: Exception
        HazardLevelingTask->>HazardLevelingTask: logger.error(海里数检测异常)
    end
Loading

File-Level Changes

Change Details Files
Make sea miles detection always execute during os_check_leveling instead of being controlled by a config flag.
  • Remove the conditional check for OpsiSeaMiles_Enable around sea miles detection in the leveling task.
  • Always log the start of sea miles detection and run detect_and_record_sea_miles within a try/except block.
  • Preserve existing success, failure, and exception logging semantics so failures remain non-fatal.
module/os/tasks/hazard_leveling.py
Remove the obsolete OpsiSeaMiles configuration group and its references from generated config, task argument definitions, templates, and i18n resources.
  • Delete the OpsiSeaMiles group (including Enable checkbox definition) from argument.yaml.
  • Remove the OpsiSeaMiles_Enable field from GeneratedConfig in config_generated.py.
  • Drop OpsiSeaMiles from the Opsi task group listing in task.yaml so it no longer appears as a standalone task option.
  • Clean up OpsiSeaMiles-related entries from template.json, args.json, and i18n locale JSON files to keep configuration and UI texts consistent.
module/config/argument/argument.yaml
module/config/config_generated.py
module/config/argument/task.yaml
config/template.json
module/config/argument/args.json
module/config/i18n/en-US.json
module/config/i18n/ja-JP.json
module/config/i18n/zh-CN.json
module/config/i18n/zh-MIAO.json
module/config/i18n/zh-TW.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

嗨——我已经审阅了你的改动,一切看起来都很棒!


Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进评审质量。
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Beatrice-betty Beatrice-betty merged commit d83620a into master May 18, 2026
6 checks passed
Copy link
Copy Markdown
Contributor

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

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 removes the 'OpsiSeaMiles' configuration option and its related localization entries across multiple files, effectively making the sea miles detection feature run unconditionally during hazard leveling. The reviewer suggested improving error handling by using logger.exception instead of logger.error to capture full stack traces when broad exceptions occur, which aids in debugging.

Comment on lines +517 to +518
except Exception as e:
logger.error(f"海里数检测异常: {e},但不影响后续流程")
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

捕获过于宽泛的 Exception 可能会隐藏一些意料之外的错误。为了更好地进行错误诊断,建议使用 logger.exception 来代替 logger.errorlogger.exception 会自动记录异常信息和堆栈跟踪,这在调试时非常有用。

虽然最佳实践是捕获更具体的异常,但如果这里的意图确实是捕获所有可能的错误以确保流程继续,那么记录完整的堆栈跟踪就显得尤为重要。

Suggested change
except Exception as e:
logger.error(f"海里数检测异常: {e},但不影响后续流程")
except Exception:
logger.exception(f"海里数检测异常,但不影响后续流程")

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