Skip to content

.2059806565729300:1cdc91c9ec2e77ad7595657af3aef7d8_69e3499ab13256d09ece8088.69e4e048b13256d09ece8616.69e4e0477afba9383018b93f:Trae CN.T(2026/4/19 22:01:44)#1279

Closed
Wpc-121 wants to merge 7 commits intoActivityWatch:masterfrom
Wpc-121:bug_rep_09
Closed

.2059806565729300:1cdc91c9ec2e77ad7595657af3aef7d8_69e3499ab13256d09ece8088.69e4e048b13256d09ece8616.69e4e0477afba9383018b93f:Trae CN.T(2026/4/19 22:01:44)#1279
Wpc-121 wants to merge 7 commits intoActivityWatch:masterfrom
Wpc-121:bug_rep_09

Conversation

@Wpc-121
Copy link
Copy Markdown
Contributor

@Wpc-121 Wpc-121 commented Apr 19, 2026

重构版本获取脚本以支持多环境和多种输出格式

重构版本获取脚本,增加对 GitHub Actions、Travis CI 和 AppVeyor 的支持

添加多种输出格式选项(标签版本、显示版本、环境变量、JSON)

增加自测试功能和详细的日志记录

完善错误处理和版本回退机制

Wpc-121 added 7 commits April 19, 2026 00:11
重构集成测试脚本,增加健康检查轮询机制替代固定等待时间
添加详细的测试帮助文档和环境变量配置说明
改进日志记录和错误检测功能
添加全局和单测超时控制,改进错误分类和诊断信息
添加 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-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 19, 2026

Greptile Summary

This PR is a large-scale refactor of the build/packaging infrastructure: it introduces a unified getversion.sh version authority supporting GitHub Actions, Travis CI, and AppVeyor; adds strict-mode artifact verification scripts for both cross-platform and Windows-specific checks; and rewrites integration tests with health polling, error classification, and timeout guards.

  • P1 – script crash: local diff_count=$? at global scope in verify-windows-artifacts.sh (line 487) is invalid bash; with set -euo pipefail the failure-reporting branch exits immediately, silently swallowing all diagnostic output and never enforcing STRICT_MODE.
  • P1 – silent overflow: compare_manifests uses return $total_differences, which wraps to 0 at 256 differences, making the caller treat a divergent artifact set as identical.

Confidence Score: 4/5

Not safe to merge until the two P1 bugs in verify-windows-artifacts.sh are fixed.

Two P1 bugs exist in verify-windows-artifacts.sh: local at global scope causes a script crash under set -euo pipefail, and return $total_differences silently overflows for ≥256 differences. Both affect the Windows packaging verification path that CI now relies on for artifact integrity.

scripts/package/verify-windows-artifacts.sh requires fixes at lines 382 and 487 before merging.

Important Files Changed

Filename Overview
scripts/package/verify-windows-artifacts.sh New Windows artifact verification script with two P1 bugs: local keyword used at global scope (script crash under set -euo pipefail) and return $total_differences integer overflow for ≥256 differences.
scripts/package/getversion.sh New version-determination script supporting GitHub Actions, Travis CI, and AppVeyor with multi-format output; minor risk of branch names matching version regex being used as release versions.
scripts/tests/integration_tests.py Major rewrite of integration tests with health polling, error classification, timeouts, and diagnostic output; overly broad error-string matching may cause false positives.
scripts/package/package-all.sh Refactored packaging script delegating version authority to getversion.sh and adding Windows artifact consistency checks; logic is correct.
scripts/package/verify-package.sh New package verification script checking executables, directories, and version consistency across artifacts; logic is sound.
.github/workflows/build-tauri.yml Adds make doctor pre-check and STRICT/WINDOWS_VERIFY_STRICT mode to the package step; changes look correct.
.github/workflows/build.yml Mirrors build-tauri.yml changes: doctor pre-check and strict packaging; changes look correct.
Makefile Adds venv-check, doctor target, build-pre-check, and extended test-integration with help and timeout support; overall solid additions.

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]
Loading

Reviews (1): Last reviewed commit: "refactor(scripts): 重构版本获取脚本以支持多环境和多种输出格式" | Re-trigger Greptile

exit 0
else
# Differences found
local diff_count=$?
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.

P1 local used outside a function

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.

Suggested change
local diff_count=$?
diff_count=$?

rm -f "$missing_files" "$extra_files" "$different_sizes"

# Return count of differences
return $total_differences
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.

P1 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:

Suggested change
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.

Comment on lines +233 to +238
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
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.

P2 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'.

Comment on lines +378 to +395
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}'")

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.

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

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.

3 participants