fix(pr-create): 錶沒在跑時 409 與 500 都不算失敗
Gitea 回「cannot stop a non-existent stopwatch」時用的狀態碼隨站台而異:這台回 409, 而腳本只認 500。結果是 PR 已經開出去了,卻以 exit 1 與 HTTP_ERROR 收場——照它自己 寫下的理由,那會讓人以為 PR 沒開成而重跑一次。三次重現(議題 #41、#50、#42)。 認的是「狀態碼在 409/500 這一組 **且** 訊息說的是碼錶」:只看訊息會把真的伺服器錯誤 一起吞掉,只看狀態碼會把別的衝突也當成沒錶。兩種狀態碼各一條測試,另加一條 「訊息對不上的 409 照常拋出」。 README 與 AGENTS.md 的「六個流程正本尚未到齊」也一併改掉——六份都在了,那句話會讓 使用者以為裝了也沒指令可用,在 AGENTS.md 裡還會誤導下一個 agent。並補一條測試把說法 與 prompts/ 的實際份數釘在一起,免得下次又走鐘。 議題 #54 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
||||
import { mkdtempSync, readFileSync, readdirSync, rmSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { repoRoot, runBin, tmpRoot } from './helpers/run-script.js';
|
||||
|
||||
@@ -22,6 +22,21 @@ function commands(text) {
|
||||
}
|
||||
|
||||
|
||||
test('說明不得宣稱正本沒到齊——prompts/ 裡有幾份,說明就得跟著', () => {
|
||||
// 「裝了也沒指令可用」這種過時的說法,會讓使用者以為工具還不能用而不去裝;
|
||||
// 同一句話在 AGENTS.md 裡還會誤導下一個 agent。
|
||||
const 正本數 = readdirSync(join(repoRoot, 'prompts')).filter((f) => f.endsWith('.md')).length;
|
||||
|
||||
for (const [名字, 內容] of [['README.md', readme()], ['AGENTS.md', agents()]]) {
|
||||
const 說沒到齊 = /正本尚未到齊|仍在實作中/.test(內容);
|
||||
assert.equal(
|
||||
說沒到齊,
|
||||
正本數 < 6,
|
||||
`${名字} 對正本進度的說法與 prompts/ 的實際份數(${正本數})對不上`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('安裝以 npm 為唯一建議路徑,指令含完整可複製的 git URL', () => {
|
||||
const install = commands(readme()).filter((line) => line.startsWith('npm i -g'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user