Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

🐛 fix(plugin-store): 优先获取commit号在进行插件下载 #1853

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

AkashiCoin
Copy link
Collaborator

No description provided.

Copy link
Contributor

sourcery-ai bot commented Feb 15, 2025

## Sourcery 评审者指南

此拉取请求修改了插件商店,使其在下载插件之前优先获取最新的提交哈希。这确保始终使用最新版本的插件。这些更改包括修改插件安装过程、添加新的 API 端点以及添加新的测试。

_由于更改看起来很简单,不需要可视化表示,因此未生成任何图表。_

### 文件级别更改

| 变更 | 详情 | 文件 |
| ------ | ------- | ----- |
| 优先在下载插件之前获取最新的提交哈希,以确保使用最新版本。 | <ul><li>为默认和额外的插件仓库获取最新的提交哈希。</li><li>如果可用,将分支更新为最新的提交哈希。</li><li>修改插件安装过程,以便在获取插件文件时使用提交哈希作为分支。</li><li>添加测试以验证是否正在使用提交哈希。</li><li>为提交信息添加模拟的 API 端点。</li><li>添加逻辑,以便在提交信息不可用时使用主分支重试。</li></ul> | `tests/builtin_plugins/plugin_store/test_add_plugin.py`<br/>`tests/builtin_plugins/plugin_store/utils.py`<br/>`zhenxun/builtin_plugins/plugin_store/data_source.py`<br/>`zhenxun/utils/github_utils/models.py`<br/>`zhenxun/utils/github_utils/const.py`<br/>`tests/builtin_plugins/plugin_store/test_plugin_store.py`<br/>`tests/builtin_plugins/plugin_store/test_update_all_plugin.py`<br/>`tests/builtin_plugins/plugin_store/test_update_plugin.py`<br/>`tests/response/plugin_store/zhenxun_bot_plugins_commit.json`<br/>`tests/response/plugin_store/zhenxun_bot_plugins_index_commit.json`<br/>`tests/response/plugin_store/zhenxun_github_sub_commit.json` |

---

<details>
<summary>提示和命令</summary>

#### 与 Sourcery 互动

- **触发新的审查:** 在拉取请求上评论 `@sourcery-ai review`。
- **继续讨论:** 直接回复 Sourcery 的审查评论。
- **从审查评论生成 GitHub issue:** 通过回复审查评论,要求 Sourcery 从审查评论创建一个 issue。您也可以回复审查评论并使用 `@sourcery-ai issue` 从中创建一个 issue。
- **生成拉取请求标题:** 在拉取请求标题中的任何位置写入 `@sourcery-ai` 以随时生成标题。您也可以在拉取请求上评论 `@sourcery-ai title` 以随时(重新)生成标题。
- **生成拉取请求摘要:** 在拉取请求正文中的任何位置写入 `@sourcery-ai summary` 以随时在您想要的位置生成 PR 摘要。您也可以在拉取请求上评论 `@sourcery-ai summary` 以随时(重新)生成摘要。
- **生成评审者指南:** 在拉取请求上评论 `@sourcery-ai guide` 以随时(重新)生成评审者指南。
- **解决所有 Sourcery 评论:** 在拉取请求上评论 `@sourcery-ai resolve` 以解决所有 Sourcery 评论。如果您已经处理了所有评论并且不想再看到它们,这将非常有用。
- **驳回所有 Sourcery 审查:** 在拉取请求上评论 `@sourcery-ai dismiss` 以驳回所有现有的 Sourcery 审查。如果您想重新开始新的审查,这将特别有用 - 不要忘记评论 `@sourcery-ai review` 以触发新的审查!
- **为 issue 生成行动计划:** 在 issue 上评论 `@sourcery-ai plan` 以为其生成行动计划。

#### 自定义您的体验

访问您的 [仪表板](https://app.sourcery.ai) 以:
- 启用或禁用审查功能,例如 Sourcery 生成的拉取请求摘要、评审者指南等。
- 更改审查语言。
- 添加、删除或编辑自定义审查说明。
- 调整其他审查设置。

#### 获取帮助

- [联系我们的支持团队](mailto:support@sourcery.ai) 提出问题或反馈。
- 访问我们的 [文档](https://docs.sourcery.ai) 获取详细的指南和信息。
- 通过在 [X/Twitter](https://x.com/SourceryAI)、[LinkedIn](https://www.linkedin.com/company/sourcery-ai/) 或 [GitHub](https://github.com/sourcery-ai) 上关注我们,与 Sourcery 团队保持联系。

</details>
Original review guide in English

Reviewer's Guide by Sourcery

This pull request modifies the plugin store to prioritize fetching the latest commit hash before downloading plugins. This ensures that the most up-to-date version of the plugin is always used. The changes include modifications to the plugin installation process, the addition of new API endpoints, and the addition of new tests.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Prioritizes fetching the latest commit hash before downloading plugins to ensure the most up-to-date version is used.
  • Fetches the newest commit hash for both default and extra plugin repositories.
  • Updates the branch to the newest commit hash if available.
  • Modifies the plugin installation process to use the commit hash as the branch when fetching plugin files.
  • Adds tests to verify the commit hash is being used.
  • Adds mocked API endpoints for commit information.
  • Adds logic to retry with the main branch if commit information is unavailable.
tests/builtin_plugins/plugin_store/test_add_plugin.py
tests/builtin_plugins/plugin_store/utils.py
zhenxun/builtin_plugins/plugin_store/data_source.py
zhenxun/utils/github_utils/models.py
zhenxun/utils/github_utils/const.py
tests/builtin_plugins/plugin_store/test_plugin_store.py
tests/builtin_plugins/plugin_store/test_update_all_plugin.py
tests/builtin_plugins/plugin_store/test_update_plugin.py
tests/response/plugin_store/zhenxun_bot_plugins_commit.json
tests/response/plugin_store/zhenxun_bot_plugins_index_commit.json
tests/response/plugin_store/zhenxun_github_sub_commit.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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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
Contributor

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

@AkashiCoin - 我已经查看了你的更改 - 这里有一些反馈:

总体评论

  • 看起来你添加了很多新的模拟 API 端点;考虑重构以减少重复。
  • 考虑添加注释来解释为什么提交哈希被优先考虑。
以下是我在审查期间查看的内容
  • 🟢 一般问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟡 复杂性:发现 1 个问题
  • 🟢 文档:一切看起来都很好

Sourcery 对开源是免费的 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将使用反馈来改进你的评论。
Original comment in English

Hey @AkashiCoin - I've reviewed your changes - here's some feedback:

Overall Comments:

  • It looks like you've added a lot of new mocked API endpoints; consider refactoring to reduce duplication.
  • Consider adding a comment to explain why the commit hash is being prioritized.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

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.

@HibiKier HibiKier merged commit 0e5a79c into HibiKier:main Feb 18, 2025
3 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants