Merge pull request #919 from omdsh-dev/chore/issue-triage-board-sync

fix(skill): board-sync 清掉失效的继承优先级 + 认「dev 已修待发版」清单
This commit is contained in:
Atlas Zeng authored and GitHub committed 2026-10-12 21:02:06 +08:00
commit fc09a72f3f
4 files changed
+27 -3

No files matched your search

@@ -0,0 +1,4 @@
{
"_comment": "已在 `dev` 修好、但还没随版本发布的 issue:看板 Status 固定 Done(脚本按它覆盖 等待开发/等待审核),因为队列里已经没有剩余开发工作,只剩发版。发版后把这里清空(或删掉已随该版本进 main 的号)。不要用这个文件表达排期——排期看 priority 标签与 promoted.json。",
"done": [826, 898, 899, 900, 914, 915, 927]
}
@@ -16,6 +16,7 @@
## 字段与选项
- **`updateProjectV2Field(singleSelectOptions: [...])` 是整体替换**:被替换掉的选项 id 失效、`Status` 值会掉;想改选项就把**全部**目标选项一次列全(name/color/description 三个字段都是必填),改完**重新给条目写一遍值**。
- **清空某个单选字段的值:传 `value:{singleSelectOptionId:null}`**,不要传 `value:null`——`UpdateProjectV2ItemFieldValueInput.value` 的类型是 `ProjectV2FieldValue!`(非空),传 null 会被 schema 拒(`argumentLiteralsIncompatible`)。`board-sync.mjs` 依赖这条来清掉「继承来源已关闭」的 PR 优先级:只在有新值时才写的实现会让 `verify()` 永远报 `mismatched`(2026-10-11 实测 23 条)。
- option id 会随替换变化 → 脚本每次运行都按**名字**重新解析 id,不要硬编码。
- `ProjectV2SingleSelectFieldOptionInput` 三个字段全 `NON_NULL`:`name` / `color`(枚举 `GRAY BLUE GREEN YELLOW ORANGE RED PINK PURPLE`)/ `description`(可空串)。
@@ -40,6 +40,12 @@
机器可读的唯一来源:`references/promoted.json`(脚本按它算批次)。改这里 = 改排期;**不要**同时把 issue 标签从 P2 抬到 P1 来表达同一件事,否则两套真相。
### 「dev 已修待发版」清单
机器可读的唯一来源:`references/fixed-pending-release.json`(脚本按它把 `Status` 钉成 `Done`)。收录标准:**修复已在 `dev` 落地、队列里没有剩余开发工作**,只等下一次发版(`Status` 的其他值都由「标签 + 是否有 open PR」算出来,PR 一合并就会算成「等待开发」)。发版后把对应号从文件里删掉。
**为什么必须写进文件**:手工把看板条目改成 `Done` 会被下一次同步覆盖,`verify` 也会判它不符——「等待开发」与「已修待发版」在推导规则里长得一样,只有这份清单能把它们分开。
## 落档位置
- 分诊文档:`docs/plans/<YYYY-MM-DD>-issue-triage.md`(分组清单 / 关闭理由 / 优先级调整记录 / 排期表 / 看板地址)
@@ -36,6 +36,11 @@ const OPTIONS = {
};
const COLORS = ['BLUE', 'GREEN', 'YELLOW', 'ORANGE', 'RED', 'PINK', 'PURPLE', 'GRAY'];
const promoted = JSON.parse(fs.readFileSync(path.join(HERE, '..', 'references', 'promoted.json'), 'utf8')).R1 ?? [];
// Issues whose fix is already on `dev` but not in a release: no development is
// left, so their Status is pinned to Done (the queue state for everything else
// is derived from labels + open PRs). Kept in a file so the value survives a
// re-run — a manual `Status=Done` would be recomputed away by this very script.
const fixedPendingRelease = JSON.parse(fs.readFileSync(path.join(HERE, '..', 'references', 'fixed-pending-release.json'), 'utf8')).done ?? [];
const gql = (query) => {
const out = execFileSync('gh', ['api', 'graphql', '-f', 'query=' + query], { encoding: 'utf8', maxBuffer: 1 << 28 });
@@ -127,7 +132,9 @@ for (const i of openIssues) {
desired.set(`issue:${i.number}`, {
prio,
batch,
status: !prio ? STATUS.todo : hasOpenPR.has(i.number) ? STATUS.review : STATUS.dev,
status: fixedPendingRelease.includes(i.number)
? STATUS.done
: !prio ? STATUS.todo : hasOpenPR.has(i.number) ? STATUS.review : STATUS.dev,
});
}
for (const p of openPRs) {
@@ -174,7 +181,13 @@ for (const [key, want] of desired) {
}
const wantValues = { '优先级': want.prio, '批次': want.batch, 'Status': want.status };
for (const [name, value] of Object.entries(wantValues)) {
if (!value || item.current[name] === value) continue;
if ((item.current[name] ?? undefined) === (value ?? undefined)) continue;
// A value that is no longer desired must be CLEARED, not left behind: a PR
// inherits its priority from the issues it cites, so when the last of those
// issues closes the inherited value has to go (otherwise verify() fails on
// exactly this mismatch). `value: null` is rejected — ProjectV2FieldValue!
// is non-null; the null option id is what clears a single-select.
if (!value) { mutations.push({ itemId: item.id, fieldId: fieldId[name], clear: true }); continue; }
const oid = optionId[`${name}:${value}`];
if (!oid) { console.log(`! ${key} no option ${name}:${value}`); continue; }
mutations.push({ itemId: item.id, fieldId: fieldId[name], optionId: oid });
@@ -182,7 +195,7 @@ for (const [key, want] of desired) {
}
for (let i = 0; i < mutations.length; i += 16) {
const chunk = mutations.slice(i, i + 16);
gql('mutation{' + chunk.map((m, k) => `m${k}:updateProjectV2ItemFieldValue(input:{projectId:"${PROJECT}",itemId:"${m.itemId}",fieldId:"${m.fieldId}",value:{singleSelectOptionId:"${m.optionId}"}}){projectV2Item{id}}`).join(' ') + '}');
gql('mutation{' + chunk.map((m, k) => `m${k}:updateProjectV2ItemFieldValue(input:{projectId:"${PROJECT}",itemId:"${m.itemId}",fieldId:"${m.fieldId}",value:${m.clear ? '{singleSelectOptionId:null}' : `{singleSelectOptionId:"${m.optionId}"}`}}){projectV2Item{id}}`).join(' ') + '}');
}
console.log(`items: ${items.size} on board | field writes: ${mutations.length}`);
verify();