.2059806565729300:1cdc91c9ec2e77ad7595657af3aef7d8_69e3499ab13256d09ece8088.69e4e048b13256d09ece8616.69e4e0477afba9383018b93f:Trae CN.T(2026/4/19 22:01:44)#1279
Conversation
重构集成测试脚本,增加健康检查轮询机制替代固定等待时间 添加详细的测试帮助文档和环境变量配置说明 改进日志记录和错误检测功能
添加全局和单测超时控制,改进错误分类和诊断信息 添加 pytest-timeout 依赖,支持进程树清理 优化日志输出和错误处理流程
添加 GitHub Actions 集成测试工作流,支持通过输入参数跳过构建步骤直接下载二进制文件 设置全局测试超时和分步超时控制 支持多平台(ubuntu/macos)测试环境
在构建流程中添加 doctor 检查步骤,确保环境依赖正确 新增严格模式验证脚本,检查打包内容和版本一致性 优化构建日志输出,增加详细步骤和错误处理
添加用于验证Windows安装包和zip压缩包内容一致性的脚本
添加WINDOWS_VERIFY_STRICT环境变量以严格验证Windows构建产物 在CI工作流中为Windows平台启用严格验证模式,确保zip内容与源码目录一致 更新Makefile和package-all.sh脚本以支持新的验证功能
重构版本获取脚本,增加对 GitHub Actions、Travis CI 和 AppVeyor 的支持 添加多种输出格式选项(标签版本、显示版本、环境变量、JSON) 增加自测试功能和详细的日志记录 完善错误处理和版本回退机制
| import json | ||
| import signal | ||
| import atexit | ||
| import sys |
|
|
||
|
|
||
| GLOBAL_SERVER_PROCESS: Optional['ServerProcess'] = None | ||
| GLOBAL_TEST_TIMEOUT: int = 120 |
| for child in children: | ||
| try: | ||
| child.kill() | ||
| except psutil.NoSuchProcess: |
|
|
||
| try: | ||
| parent.kill() | ||
| except psutil.NoSuchProcess: |
| for p in still_alive: | ||
| try: | ||
| p.kill() | ||
| except psutil.NoSuchProcess: |
| p.kill() | ||
| except psutil.NoSuchProcess: | ||
| pass | ||
| except psutil.NoSuchProcess: |
| else: | ||
| try: | ||
| os.killpg(os.getpgid(pid), signal.SIGKILL) | ||
| except ProcessLookupError: |
| except OSError: | ||
| try: | ||
| os.kill(pid, signal.SIGKILL) | ||
| except ProcessLookupError: |
|
|
||
| start_time = time.time() | ||
| poll_count = 0 | ||
| last_exit_check = 0 |
| if path and os.path.exists(path): | ||
| try: | ||
| os.remove(path) | ||
| except Exception: |
Greptile SummaryThis PR is a large-scale refactor of the build/packaging infrastructure: it introduces a unified
Confidence Score: 4/5Not safe to merge until the two P1 bugs in verify-windows-artifacts.sh are fixed. Two P1 bugs exist in verify-windows-artifacts.sh: scripts/package/verify-windows-artifacts.sh requires fixes at lines 382 and 487 before merging. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CI Workflow: build/package] --> B[make doctor pre-check]
B --> C[make build]
C --> D{make package}
D -->|Non-Windows| E[PACKAGE_STRICT=true\nmake package]
D -->|Windows| F[WINDOWS_VERIFY_STRICT=true\nPACKAGE_STRICT=true\nmake package]
E --> G[package-all.sh]
F --> G
G --> H[getversion.sh --env\nPriority: CI env > git tag > pyproject.toml]
H --> I[Build zip archive]
I -->|Windows only| J[Build Inno Setup installer]
J --> K[verify-windows-artifacts.sh\ncompare dir vs zip]
K -->|strict & differences| L[❌ Exit 2\nBuild fails]
K -->|no differences| M[✅ Continue]
I --> N[verify-package.sh\nCheck executables, dirs, versions]
M --> N
N -->|PACKAGE_STRICT & errors| O[❌ Exit 2]
N -->|pass| P[✅ Upload artifacts]
Reviews (1): Last reviewed commit: "refactor(scripts): 重构版本获取脚本以支持多环境和多种输出格式" | Re-trigger Greptile |
| exit 0 | ||
| else | ||
| # Differences found | ||
| local diff_count=$? |
There was a problem hiding this comment.
local is a bash builtin that is only valid inside a function body. Here it is used at the top-level script scope (in the else branch of the main if). With set -euo pipefail active (line 26), bash will print local: can only be used in a function and exit with status 1, meaning the failure-reporting branch of the Windows artifact comparison is broken — the script exits before logging the diff count or enforcing STRICT_MODE.
| local diff_count=$? | |
| diff_count=$? |
| rm -f "$missing_files" "$extra_files" "$different_sizes" | ||
|
|
||
| # Return count of differences | ||
| return $total_differences |
There was a problem hiding this comment.
return value overflows for >255 differences
compare_manifests uses return $total_differences to communicate the count. Bash return is limited to 0–255; if there are exactly 256 differences the function returns 0, causing the caller (if compare_manifests …) to enter the "no differences" path and silently report success even when the artifacts diverge significantly.
Use a shared variable or stdout instead:
| return $total_differences | |
| echo "$total_differences" | |
| return $(( total_differences > 0 ? 1 : 0 )) |
Then update the call site to capture the count: diff_count=$(compare_manifests …) and check $? for the boolean result.
| if [[ "$GITHUB_REF_NAME" == v* ]] || [[ "$GITHUB_REF_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then | ||
| tag_version="$GITHUB_REF_NAME" | ||
| source="GITHUB_REF_NAME" | ||
| log_debug "Using version from GITHUB_REF_NAME: $tag_version" | ||
| fi | ||
| fi |
There was a problem hiding this comment.
Branch names matching version regex accepted as version
GITHUB_REF_NAME is set for every workflow run (branches and tags). The guard only rejects values that don't start with v and don't match ^[0-9]+\.[0-9]+\.[0-9]+. A branch named e.g. 0.14.0-hotfix would pass that regex and be used as the release version, producing a build with a branch name embedded in artifact filenames. Consider requiring the branch to match a full semver pattern without a trailing suffix, or checking GITHUB_REF_TYPE == 'tag'.
| error_indicators = ["ERROR", "panic", "thread '", "stack backtrace", "fatal", "Error:"] | ||
|
|
||
| found_errors = [] | ||
|
|
||
| if self.stdout_path: | ||
| with open(self.stdout_path, "r", encoding="utf-8", errors="replace") as f: | ||
| stdout = f.read() | ||
| for indicator in error_indicators: | ||
| if indicator in stdout: | ||
| found_errors.append(f"stdout contains '{indicator}'") | ||
|
|
||
| if self.stderr_path: | ||
| with open(self.stderr_path, "r", encoding="utf-8", errors="replace") as f: | ||
| stderr = f.read() | ||
| for indicator in error_indicators: | ||
| if indicator in stderr: | ||
| found_errors.append(f"stderr contains '{indicator}'") | ||
|
|
There was a problem hiding this comment.
Overly broad error indicator list causes false positives
check_for_errors flags any log line containing "ERROR", "error" (via "Error:"), "thread '", etc. Many server frameworks log "ERROR" in informational contexts (e.g. "No ERROR responses", "error_count=0"). This can cause spurious test failures. Consider anchoring the search to line-start patterns like r'^\d{4}-.*\bERROR\b', or at minimum skipping known-benign strings.
重构版本获取脚本以支持多环境和多种输出格式
重构版本获取脚本,增加对 GitHub Actions、Travis CI 和 AppVeyor 的支持
添加多种输出格式选项(标签版本、显示版本、环境变量、JSON)
增加自测试功能和详细的日志记录
完善错误处理和版本回退机制