ci(scripts): 002 記分守門 CI 端強制——base-ref 模式驗 PR 最終態 vs merge-base - #694
Merged
Conversation
- verify-002-log.mjs 增設 --base-ref <ref> 入口:以 merge-base(<ref>, HEAD) 為基準版、 HEAD(PR 最終態)為待驗版,與 pre-commit staged 語意共用同一 validate002 核心(無雙實作) - 002 未變更時毫秒級跳過(正常 PR 零額外負擔);整檔刪除必紅;merge-base 無法解析時明確失敗 - Quality Checks 於 install 前新增 PR 專屬步驟(零 npm 依賴,搶先紅燈), 堵 --no-verify 與 GitHub 網頁端 merge/squash 繞過 pre-commit 的破口 - vitest 補 6 條臨時 git repo 整合測試:計數不符必紅、正確 append 綠燈、未變更跳過、 多 commit 只驗最終態、base 前進後仍以 merge-base 為基準、刪檔必紅 - root 補宣告 @types/node ^24(對齊 engines)並讓 scripts/tsconfig.json 覆寫 types 白名單: root 測試首次使用 node 內建模組,typed lint 需要型別;lockfile peer 由漂移的 25.0.3 收斂為 24.10.1 測試:pnpm vitest run scripts/__tests__/verify-002-log.test.ts 24 passed、eslint 單檔通過、YAML 解析通過 Closes #661 Co-authored-by: Cursor <cursoragent@cursor.com>
- pre-push hook 跑 vitest 時 husky 注入 GIT_DIR/GIT_INDEX_FILE,臨時 repo 的 git 子行程繼承後操作被導向父 repo,6 條 base-ref 整合測試在 hook 環境全紅 - GIT_ENV 改為先過濾所有 GIT_ 前綴變數再注入隔離設定;runGuard 子行程同步套用 測試:GIT_DIR/GIT_INDEX_FILE 注入環境與一般環境 vitest 各 24 passed、eslint 單檔通過 Co-authored-by: Cursor <cursoragent@cursor.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned Files
|
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
- scripts/tsconfig.json 加入 node 型別後 readFileSync 回傳型別由 error 轉為 string, stylisticTypeChecked 的 prefer-regexp-exec 開始生效,String#match 需改為 RegExp#exec - 行為等價(單次比對、無 g flag),測試結果不變 測試:pnpm lint exit 0、vitest run lighthouse-production 6 passed Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
s123104
merged commit Jul 8, 2026
bcd52c1
into
experiment/ratewise-product-2026h2
20 of 21 checks passed
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
Closes #661
scripts/verify-002-log.mjs增設--base-ref <ref>入口:以merge-base(<ref>, HEAD)為基準版、HEAD(PR 最終態)為待驗版,與 pre-commit staged 語意共用同一validate002核心(無雙實作,僅內容取得方式不同).github/workflows/ci.ymlQuality Checks 於pnpm install前新增 PR 專屬步驟Verify 002 log (vs merge-base)(守門腳本零 npm 依賴,可搶先紅燈),堵--no-verify與 GitHub 網頁端 merge/squash 繞過本地 hook 的破口@types/node ^24+scripts/tsconfig.json覆寫types白名單:root 測試首次使用 node 內建模組,typed lint 需要型別CI 語意選擇(issue 規格第 4 點)
N = reward − penalty、總分鏈(基準總分 + N)、ID 全檔唯一、歷史條目不可刪;base-ref 模式額外把「整檔刪除」也列為必紅紅測證據(本地以 base-ref 模式重演,CI 同款指令)
構造「新增條目但檔頭計數未同步」的壞版,以
--no-verify提交(模擬繞過 pre-commit):對照組:
驗收對照
validate002(無雙實作)yaml.safe_load+ js-yaml 雙驗)pnpm vitest run scripts/__tests__/verify-002-log.test.ts24 passed(18 既有+6 新 base-ref 整合測試)附註
@types/node先前僅由各 app 宣告,root lockfile peer 漂移至 25.0.3;root 顯式宣告^24(對齊 engines^24.0.0)後收斂為 24.10.1——pnpm-lock.yaml的大量 diff 均為此 peer 版本替換,無任何依賴新增或升版GIT_DIR/GIT_INDEX_FILE,臨時 repo 的 git 子行程繼承後被導向父 repo;GIT_ENV已剝除GIT_*前綴變數,hook 注入環境與一般環境雙重驗證各 24 passedMade with Cursor