Skip to content

revert推送到cnb - #2508

Closed
A-nony-mous wants to merge 2 commits into
OneDragon-Anything:mainfrom
A-nony-mous:revert/1594919
Closed

revert推送到cnb#2508
A-nony-mous wants to merge 2 commits into
OneDragon-Anything:mainfrom
A-nony-mous:revert/1594919

Conversation

@A-nony-mous

@A-nony-mous A-nony-mous commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

image

Summary by CodeRabbit

  • 新功能

    • 代码同步新增 GitHub、CNB、Gitee 的自动回退机制,并显示实际使用的来源。
    • 同步失败时保留当前工作区状态,避免因镜像版本落后导致代码回退。
  • 界面调整

    • 移除设置中的“代码源”选项,区域配置不再修改代码仓库来源。
    • 安装失败提示改为显示实际错误信息。
  • 文档

    • 补充代码同步来源、回退顺序及安全策略说明。
  • 维护

    • 移除自动同步至 CNB 的工作流配置。

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • .github/workflows/sync-cnb.yml
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 71125af7-779c-4c63-9404-a01a9d2f812a

📥 Commits

Reviewing files that changed from the base of the PR and between 8dcffea and aa586b3.

📒 Files selected for processing (1)
  • .github/workflows/sync-cnb.yml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

源码同步改为按 GitHub、CNB、Gitee 顺序拉取并报告来源或失败原因,新增 CNB 镜像配置,移除旧代码源设置入口与相关提示,并删除 CNB 同步工作流。

Changes

多源源码同步

Layer / File(s) Summary
源码来源配置与兼容字段
config/project.yml, src/one_dragon/envs/project_config.py, src/one_dragon/envs/env_config.py, src/one_dragon/envs/git_service.py
新增 CNB HTTPS 镜像配置,固定 GitHub、CNB、Gitee 来源顺序,并保留 repository_type 作为旧配置兼容字段。
多来源拉取与结果传递
src/one_dragon/envs/git_service.py, docs/develop/one_dragon/runtime_launcher.md
新增多来源拉取结果结构、fallback 引用处理、回退保护及失败汇总,并将来源信息传递至克隆、更新和一致性检查结果。
旧代码源入口移除与界面同步
src/one_dragon_qt/view/setting/setting_env_interface.py, src/one_dragon_qt/view/source_config_interface.py, src/one_dragon_qt/widgets/install_card/code_install_card.py
移除代码源选择及其配置联动,调整源配置布局,并取消安装失败时追加的 Gitee 建议。

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitService
  participant GitHub
  participant CNB
  participant Gitee
  participant LocalRepository
  GitService->>GitHub: fetch 主来源
  GitHub-->>GitService: 返回成功或错误
  GitService->>CNB: fetch fallback 来源
  CNB-->>GitService: 返回成功或错误
  GitService->>Gitee: fetch fallback 来源
  Gitee-->>GitService: 返回成功或错误
  GitService->>LocalRepository: 更新 origin/<branch> 或返回失败汇总
Loading

Possibly related PRs

Suggested reviewers: shadowlemoon

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题明确指向撤销与 CNB 推送相关的改动,和本次回滚型变更一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/one_dragon_qt/view/source_config_interface.py (1)

176-176: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

补充缺失的返回值类型注解。

按照项目的代码规范,所有函数签名都必须包含类型注解。虽然根据所学知识,__init__ 不应添加 -> None 返回值注解,但对于其他普通的方法,应显式标明返回值类型。建议为本次更改范围内的这两个方法补充 -> None

  • src/one_dragon_qt/view/source_config_interface.py#L176-L176: 在 _on_region_changed 的签名末尾补充 -> None
  • src/one_dragon_qt/view/source_config_interface.py#L194-L194: 在 _init_config_values 的签名末尾补充 -> None
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/one_dragon_qt/view/source_config_interface.py` at line 176, 为
src/one_dragon_qt/view/source_config_interface.py 第176行的 _on_region_changed
和第194行的 _init_config_values 方法补充 -> None 返回值类型注解;无需修改其他方法。

Sources: Coding guidelines, Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/one_dragon/envs/project_config.py`:
- Line 14: 为配置成员 cnb_https_repository 补充类型注解,声明其类型为 str |
None,以覆盖配置缺失时返回空值的情况;保持现有 self.get('cnb_https_repository') 初始化逻辑不变。

---

Nitpick comments:
In `@src/one_dragon_qt/view/source_config_interface.py`:
- Line 176: 为 src/one_dragon_qt/view/source_config_interface.py 第176行的
_on_region_changed 和第194行的 _init_config_values 方法补充 -> None 返回值类型注解;无需修改其他方法。
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e8fd43b9-be92-4863-b337-c683a79172b9

📥 Commits

Reviewing files that changed from the base of the PR and between ab8da6a and 8dcffea.

📒 Files selected for processing (9)
  • .github/workflows/sync-cnb.yml
  • config/project.yml
  • docs/develop/one_dragon/runtime_launcher.md
  • src/one_dragon/envs/env_config.py
  • src/one_dragon/envs/git_service.py
  • src/one_dragon/envs/project_config.py
  • src/one_dragon_qt/view/setting/setting_env_interface.py
  • src/one_dragon_qt/view/source_config_interface.py
  • src/one_dragon_qt/widgets/install_card/code_install_card.py
💤 Files with no reviewable changes (3)
  • .github/workflows/sync-cnb.yml
  • src/one_dragon_qt/widgets/install_card/code_install_card.py
  • src/one_dragon_qt/view/setting/setting_env_interface.py

Comment thread src/one_dragon/envs/project_config.py Outdated
self.github_homepage = self.get('github_homepage')
self.github_https_repository = self.get('github_https_repository')
self.github_ssh_repository = self.get('github_ssh_repository')
self.cnb_https_repository = self.get('cnb_https_repository')

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

为新增配置成员补充类型注解。

该配置可能缺失,下游也显式处理了空地址,建议声明为 str | None

建议修改
-        self.cnb_https_repository = self.get('cnb_https_repository')
+        self.cnb_https_repository: str | None = self.get('cnb_https_repository')

As per coding guidelines,src/**/*.py 要求“所有函数签名和类成员变量都必须有类型注解”。

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self.cnb_https_repository = self.get('cnb_https_repository')
self.cnb_https_repository: str | None = self.get('cnb_https_repository')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/one_dragon/envs/project_config.py` at line 14, 为配置成员 cnb_https_repository
补充类型注解,声明其类型为 str | None,以覆盖配置缺失时返回空值的情况;保持现有 self.get('cnb_https_repository')
初始化逻辑不变。

Source: Coding guidelines

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants