Skip to content

Conversation

@littleniannian
Copy link
Collaborator

@littleniannian littleniannian commented Sep 2, 2025

User description

skip review

关联的 issue

描述你的变更

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc


Description

  • 修正 SSH 密钥判断逻辑错误

  • 修改 API 返回中 SSH 公钥条件判断

  • 移除系统变量错误码检查


Diagram Walkthrough

flowchart LR
  A["配置文件 SSH 校验修改"]
  B["API SSH 公钥返回修改"]
  C["清理系统变量错误检查修改"]
  A -- "调整条件判断" --> B
  A -- "移除错误码检查" --> C
Loading

File Walkthrough

Relevant files
Bug fix
configuration.go
优化 SSH 密钥校验及返回处理                                                                                 

sqle/api/controller/v1/configuration.go

  • 将 systemVariable.Code 判断替换为 SSHPrimaryKey 条件
  • 修改错误返回逻辑提示 "git ssh private key not found"
  • 更新 GetSSHPublicKey 方法中 SSH 密钥判断逻辑
+2/-2     
clean.go
修正系统变量错误检查逻辑                                                                                         

sqle/server/clean.go

  • 移除 systemVariables.Code 判断条件
  • 仅检查错误 err 后返回默认过期时间
+1/-1     

(cherry picked from commit e8c645a)
(cherry picked from commit 32f4640)
@github-actions
Copy link

github-actions bot commented Sep 2, 2025

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

SSH密钥判断

请检查 SSH 私钥判断逻辑是否正确,新增加的条件与错误提示可能存在逻辑矛盾,需要确认该判断是否符合预期。

if systemVariable.Data.SystemVariableSSHPrimaryKey != "" {
SSH密钥判断

请核实 API 返回中 SSH 公钥判断的条件是否与整体设计一致,确保逻辑判断与预期行为一致。

if systemVariable.Data.SystemVariableSSHPrimaryKey == "" {
错误处理

移除对系统变量返回码的判断后,请确认错误处理逻辑是否充分覆盖所有异常情况,避免遗漏潜在错误。

if err != nil {

@github-actions
Copy link

github-actions bot commented Sep 2, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
修正SSH私钥判断条件

建议将判断条件修改为检查私钥是否为空,因为错误信息指明“git ssh private key not
found”应在私钥丢失时返回错误。如果私钥为空时应返回错误,而非非空时返回。

sqle/api/controller/v1/configuration.go [422]

-if systemVariable.Data.SystemVariableSSHPrimaryKey != "" {
+if systemVariable.Data.SystemVariableSSHPrimaryKey == "" {
Suggestion importance[1-10]: 8

__

Why: The suggestion reverses the condition on systemVariable.Data.SystemVariableSSHPrimaryKey, ensuring an error is returned when the SSH private key is missing, which addresses a clear logic mistake.

Medium
恢复状态码检查

建议恢复对系统变量返回状态的检查,确保在获取系统变量时不仅捕获错误,还能检测到状态码异常导致的情况。这样能够避免在系统变量异常时继续使用默认值,造成逻辑不一致。

sqle/server/clean.go [160]

-if err != nil {
+if err != nil || systemVariables.Code != 0 {
Suggestion importance[1-10]: 7

__

Why: The suggestion reintroduces the check on systemVariables.Code alongside the error check, enhancing error detection and maintaining consistency with previous logic, though it targets a less critical issue.

Medium

@littleniannian littleniannian merged commit 30f003e into release-4.2508.x Sep 2, 2025
4 checks passed
@littleniannian littleniannian deleted the cherry-pick_main branch September 2, 2025 07:12
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.

2 participants