Skip to content

chore(devex): CI 加 mac 矩阵 + version-triplet 校验 + bump-version.sh#294

Merged
appergb merged 3 commits into
mainfrom
chore/ci-quality-gate-and-version-bump
May 6, 2026
Merged

chore(devex): CI 加 mac 矩阵 + version-triplet 校验 + bump-version.sh#294
appergb merged 3 commits into
mainfrom
chore/ci-quality-gate-and-version-bump

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 6, 2026

User description

针对审查反馈 #1 / #3 / #4 的工程基建改进。

A. CI 加 mac 矩阵 + version 校验

`.github/workflows/ci.yml` 从单一 `windows-tauri` 1 job 改成 matrix:

  • macos-latest: cargo check + npm run build(验证 mac 端跨平台编译)
  • windows-latest: 原 preflight + ps1 tokenize + cargo check + npm run build
  • 新校验:version triplet 一致性 — 一旦 package.json / tauri.conf.json / Cargo.toml drift 立刻 CI fail

B. .gitignore 兜底

  • `promo-openless-v2/`(已实测出现在 untracked)
  • `node_modules/` + `dist/` + `target/` 全局兜底
  • `.cargo/registry/` + `.cargo/git/`

C. `scripts/bump-version.sh`(新文件)

1 个参数(X.Y.Z),sed 同步 3 处版本号 + cargo update -p openless 同步 Cargo.lock。已 dry-run 测试过,输出三处版本号一致 + 后续 git 操作建议。

```
./scripts/bump-version.sh 1.2.21
```

跨 macOS sed / GNU sed 兼容(-i.bak 然后 rm)。

E2E 测试(审查反馈 #2

单独立 issue,本 PR 不动。E2E 工程量大(Playwright + Tauri WebView2/WebKit driver + CI mock mic/hotkey),需要单独 sprint。

Test plan

  • `scripts/bump-version.sh` dry-run 通过
  • CI macos-latest checks 通过
  • CI windows-latest checks 通过
  • CI version verify 通过(三处都是 1.2.20 应该 pass)

PR Type

Enhancement, Documentation


Description

  • Add GitHub Actions matrix for macOS and Windows CI

  • Introduce version consistency check across five files

  • Add scripts/bump-version.sh for safe version synchronization

  • Add comprehensive engineering audit report (docs/audit-2026-05-06.md)


Diagram Walkthrough

flowchart LR
  A["Pull Request"] -- "triggers" --> B["CI Matrix"]
  B -- "macOS-latest" --> C["macOS: cargo check + vite build"]
  B -- "windows-latest" --> D["Windows: preflight + cargo check + vite build"]
  C --> E["Version consistency check across 5 files"]
  D --> E
  F["scripts/bump-version.sh"] -- "synchronizes" --> G["package.json, package-lock.json, tauri.conf.json, Cargo.toml, Cargo.lock"]
Loading

File Walkthrough

Relevant files
Tooling
bump-version.sh
Add bump-version.sh for synchronized version bumps             

scripts/bump-version.sh

  • Add bash script to update version across all required locations
  • Handle package.json, package-lock.json, tauri.conf.json, Cargo.toml,
    and Cargo.lock
  • Use npm version, sed, and awk with cross‑platform (BSD/GNU)
    compatibility
  • Include post‑update verification and git commit guidance
+110/-0 
Ci
ci.yml
Expand CI to macOS matrix with version sync check               

.github/workflows/ci.yml

  • Replace single Windows job with matrix strategy targeting macOS and
    Windows
  • Add conditional preflight and PowerShell tokenization steps
  • Add frontend tsc + vite build and backend cargo check steps
  • Add version consistency verification across all five version files
+54/-5   
Documentation
audit-2026-05-06.md
Add comprehensive engineering audit report                             

docs/audit-2026-05-06.md

  • Add full‑stack engineering audit covering architecture, frontend bugs,
    and platform consistency
  • Document backend issues like coordinator fragmentation and
    command‑layer business logic
  • Analyze frontend animation bugs, XSS surface, and scroll interruptions
  • Provide P0/P1/P2 recommendations for immediate and long‑term
    improvements
+293/-0 

baiqing added 2 commits May 6, 2026 20:55
审查反馈:
1. CI 缺质量门禁 — 仅 windows-latest 1 job,mac 端 cargo check 路径
   无 PR-time 验证,每次 release-tauri.yml 才暴露平台问题
2. .gitignore 不全 — promo-openless-v2/ 反复出现在 git status;
   node_modules / dist / target 没全局兜底
3. 版本号同步风险 — package.json + tauri.conf.json + Cargo.toml 三处
   人工改,每次发版都担心漏一处

改动:

A. .github/workflows/ci.yml
   - 单一 windows-tauri job → matrix(macos-latest + windows-latest)
   - mac job:cargo check + npm run build 验证跨平台编译
   - Windows job:保留原 preflight + ps1 tokenize
   - 新加 step:Verify version triplet stays in sync(两端都跑)—
     一旦 package.json / tauri.conf.json / Cargo.toml 三处 drift 立刻
     fail,给发版工程加 long-running guard

B. .gitignore
   - 加 promo-openless-v2/(已实测出现在 untracked)
   - 加 node_modules/ + dist/ + target/ 全局兜底(避免某子目录漏配
     时 build artifact 进 PR)
   - 加 .cargo/registry / .cargo/git 兜底

C. scripts/bump-version.sh(新文件)
   - 1 个参数(X.Y.Z),sed 同步改 3 个文件 + cargo update -p openless
     同步 Cargo.lock
   - 验证三处一致后输出后续 git 操作建议
   - 跨 macOS sed / GNU sed 兼容(-i.bak 后 rm)

下次发版:./scripts/bump-version.sh 1.2.21 一行搞定。
未来 PR 漏改版本号 CI 立刻 fail,不需要靠人记忆。
完整工程审计报告(系统化逐项检查):
- 后端架构总评 + 5 个 P1/P2 优化点(coordinator/commands 拆分等)
- 前端 4 个 UI bug(tab 切换竞态、流式滚动打断 QA 等)
- 工程化水平评估 + 4 条改善(CI 门禁 / E2E / gitignore / 版本号)
  → 其中 3 条已在本 PR 实现(CI matrix + gitignore + bump-version 脚本)
- 多端逻辑与体验一致性表(macOS vs Windows 平台差异 vs 行为一致性)
- UI/后端 IPC 1:1 映射校验(全部命令前后端对齐 ✓)
- 改进建议汇总:P0 无;P1 5 项;P2 6 项
- 总结:项目整体健康,建议下迭代处理 coordinator 拆分 + 前端动画竞态

把这份基线纳入 git,让 main 留下 v1.2.20→v1.2.21 这一阶段的工程现状
锚点,后续审计有 baseline 对照。
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b997f5fca2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/bump-version.sh Outdated
# 仅匹配文件顶层 [package] 段下的 version = "X.Y.Z",避免误改 dependencies 里的版本。
# OpenLess 项目 Cargo.toml 第一个出现的 version = 一定是 [package] 自己的。
sed -E -i.bak \
"0,/^version = \"[0-9]+\.[0-9]+\.[0-9]+\"$/s//version = \"$NEW\"/" \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid GNU-only sed addressing in the macOS release helper

When this helper is run on macOS, the default BSD/POSIX sed does not accept the GNU-only 0,/.../ address range (GNU sed itself rejects it under --posix), so the script aborts while updating Cargo.toml. Because this is the version-bump path developers are likely to run from a Mac, use a portable range/awk/perl/node edit instead of 0, here.

Useful? React with 👍 / 👎.

Comment thread scripts/bump-version.sh Outdated
update_cargo_toml_version "$CARGO_TOML"

echo "▶ 同步 Cargo.lock"
( cd "$APP/src-tauri" && cargo update -p openless 2>&1 | grep -E 'Updating|Locking|^error' || true )
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop swallowing Cargo.lock update failures

If cargo update -p openless fails in this step, the trailing || true still lets the script continue and the later validation only checks Cargo.toml, not Cargo.lock. In that failure mode the helper prints success and suggests committing a stale lockfile version, which is exactly the release mismatch this script is meant to prevent.

Useful? React with 👍 / 👎.

Comment thread scripts/bump-version.sh Outdated
Comment on lines +93 to +94
echo " git diff --stat $PKG_JSON $TAURI_CONF $CARGO_TOML \"$APP/src-tauri/Cargo.lock\""
echo " git add $PKG_JSON $TAURI_CONF $CARGO_TOML \"$APP/src-tauri/Cargo.lock\""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include package-lock.json in version bumps

This helper updates package.json but never updates or stages openless-all/app/package-lock.json, even though the lockfile records the root package version and the repo release instructions require bumping it together with the other version fields. Running this script for a release can therefore leave package-lock.json on the previous version while the script reports the bump as complete.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

PR Reviewer Guide 🔍

(Review updated until commit 97fca4a)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ❌

1 - Not compliant

Non-compliant requirements:

  • Hold-to-talk recording mode

2 - Not compliant

Non-compliant requirements:

  • Hold-to-talk hotkey mode
  • Pressed/released hotkey edge events
  • Mode-aware DictationCoordinator handling
  • Settings selector for recording mode
  • Feature docs, build metadata, and tests

4 - Not compliant

Non-compliant requirements:

  • Free-form translation target language setting
  • Shift-modified translation trigger
  • Persisted translation target language preference
  • Translate polish mode and prompt template
  • Translation capsule UI label
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Version scope

The Cargo.toml rewrite and validation both act on the first version = line they find. If src-tauri/Cargo.toml ever contains another version field before [package] (for example workspace metadata or a dependency table), the script can update the wrong value and still report success, leaving the package version out of sync.

awk -v new="$NEW" '
  !done && /^version = "[0-9]+\.[0-9]+\.[0-9]+"$/ {
    sub(/"[0-9]+\.[0-9]+\.[0-9]+"/, "\"" new "\"")
    done = 1
  }
  { print }
' "$CARGO_TOML" > "$CARGO_TOML.tmp"
mv "$CARGO_TOML.tmp" "$CARGO_TOML"

# Cargo.lock:cargo update 显式同步 openless package;失败要立刻退出,不能吞错。
echo "▶ 同步 Cargo.lock"
( cd "$APP/src-tauri" && cargo update -p openless 2>&1 | tail -5 )

# 校验五处一致(package.json / package-lock.json / tauri.conf.json / Cargo.toml / Cargo.lock)
echo
echo "===== 验证版本一致性 ====="
PKG=$(node -p "require('$PKG_JSON').version")
LOCK_ROOT=$(node -p "require('$PKG_LOCK').version")
LOCK_NESTED=$(node -p "require('$PKG_LOCK').packages[''].version")
TAU=$(node -p "require('$TAURI_CONF').version")
CRG=$(grep -E '^version = ' "$CARGO_TOML" | head -1 | sed -E 's/^version = "(.+)"$/\1/')
CARGO_LOCK_VER=$(awk '/^name = "openless"$/{getline; if (match($0, /version = "([0-9.]+)"/, a)) {print a[1]; exit}}' "$CARGO_LOCK" 2>/dev/null \
  || awk 'BEGIN{found=0} /^name = "openless"$/{found=1; next} found && /^version = /{gsub(/"/,""); print $3; exit}' "$CARGO_LOCK")

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Persistent review updated to latest commit 938c6a7

Codex 在 PR #294 上提了 3 个 P2,全部采纳:

P2-A: BSD sed 不支持 GNU 行号范围 0,/.../
  原 sed -E -i.bak "0,/^version = .../s//.../" 在 macOS 默认 BSD sed 上
  会 fail。换成 awk first-match 替换(mac BSD awk + GNU awk 都支持)。

P2-B: Cargo.lock 同步失败被 `|| true` 吞了
  原 cargo update -p openless ... || true 会让脚本继续,validate 又只
  校验 Cargo.toml 不校验 Cargo.lock。删 || true,让 set -euo pipefail
  在 cargo update fail 时立刻退出;同时 validate 加 Cargo.lock 校验。

P2-C: package-lock.json 未跟着同步
  npm 把 root version 也存在 package-lock.json 里(root + packages['']
  两处)。原脚本只 sed package.json 不更 lock,会让 npm ci 在 CI 出现
  EUSAGE。换成 npm version --no-git-tag-version --allow-same-version
  一次更两个文件。

ci.yml 的 verify step 也升级到校验 5 处一致:
  package.json / package-lock.json root+nested / tauri.conf.json /
  Cargo.toml / Cargo.lock 的 [openless] 包。

dry-run 已验证(用当前版本 1.2.20 跑一遍输出全部一致)。
@appergb
Copy link
Copy Markdown
Collaborator Author

appergb commented May 6, 2026

@codex 三个 P2 已全部采纳(commit 97fca4a):

P2-A 修: BSD sed 兼容性 — Cargo.toml 替换从 GNU 0,/.../ 行号范围 改成 awk first-match 替换(mac BSD awk + GNU awk 都支持)

P2-B 修: cargo update 失败必须 fail — 删除 || true,让 set -euo pipefail 在失败时立刻退出;validate 也加上 Cargo.lock 校验

P2-C 修: package-lock.json 同步 — 原脚本只 sed package.json,现在用 npm version --no-git-tag-version --allow-same-version 一次更新两个文件(root + packages[''] 都同步)

ci.yml 的 verify step 也升级:从校验 3 处改为校验 5 处 一致:package.json / package-lock.json (root+nested) / tauri.conf.json / Cargo.toml / Cargo.lock 的 [openless] 包

dry-run 已验证(用当前版本 1.2.20 跑一遍输出全部一致)。

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Persistent review updated to latest commit 97fca4a

@appergb appergb merged commit b9adb6c into main May 6, 2026
3 checks passed
@appergb appergb deleted the chore/ci-quality-gate-and-version-bump branch May 6, 2026 13:24
appergb pushed a commit that referenced this pull request May 6, 2026
主要修复
─────────
- fix(windows): TSF DLL 静态链接 CRT,防 host 进程(QQ 等)私有
  MSVCP140 劫持导致切微软拼音崩溃 0xc0000005(PR #287 + #289 + Codex
  P1 review)。
- fix(windows): 移除 DisableThreadLibraryCalls — /MT 下 CRT 需要
  thread attach/detach 通知做 per-thread TLS 清理,禁用反而触发崩溃。
- fix(recording): 录音条出现时 mic 已 capture,按 Option 不再吞开头
  字。emit Recording 加 race 检查避免短按时覆盖 stop/cancel UI 信号。
- fix(startup): splash 透明背景 + 卡片化,避免长启动时左半白屏。
- fix(vault): keyring chunks 用稳定 account name —— macOS Keychain
  Always-Allow 不再因 UUID 轮换失效;不再每次 load 都尝试删 9 个
  legacy entries 触发 ACL 弹窗(与 PR #277 一起)。

新功能
─────────
- feat(security): 凭据从 plaintext JSON 迁移到平台 credential vault
  (macOS Keychain / Windows Credential Manager / Linux libsecret)。
  Windows 2560 byte 限制下用 chunked storage;partial-write safe。
  legacy 多源迁移完成后自动清理(PR #277)。

工程
─────────
- chore(ci): 暂时搁置 macos-13(Intel mac)matrix —— GH Actions
  runner pool 紧张到每次 dispatch queue 1-2h(已观测 4 次)。Apple
  Silicon 用户 dmg 仍发;Intel mac 用户保留 v1.2.20 dmg + Rosetta
  说明(issue #299)。
- chore(devex): CI 加 macOS 矩阵 + 5-way 版本号一致性校验 +
  scripts/bump-version.sh 一行同步 5 处版本号。.gitignore 加
  promo-openless-v2 / node_modules / dist / target 全局兜底(PR #294)。
- docs: docs/audit-2026-05-06.md 工程审计基线,覆盖架构 / UI bug /
  多端一致性 / IPC 1:1 校验 / P0/P1/P2 改进路径。
- chore: 9 个改进 issue (#295-#303) 跟踪 audit 列出的所有 P1/P2/P3
  问题。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant