Commit 7ce9262d0c5f329832b8dfda3c8097ccbdfebe5e

Authored by zichun
1 parent 4a3b7270

coding.mjs: drop stale-tag freshness self-check (defensive code for already-fixed ordering bug)

The TAG_REPORT_FRESHNESS_SCHEMA + checkTagReportFreshPromptM + the
post-`tag.exists` freshness branch in runMilestone existed to detect
"tag points at a commit whose § ⑫ is still {{milestone_tag}}". Per the
original comments, this only catches historical leftovers from the
pre-fix tag → § ⑫ ordering; the same fix reversed the order so the
runtime guard is no longer load-bearing. ~25 lines of branchy
defensive code that the source-level fix already prevents.

If a pre-fix repo has stale milestone tags, delete them with
`git tag -d milestone/<id>` and re-run coding-start.
Showing 1 changed file with 2 additions and 30 deletions
workflows/coding.mjs
@@ -71,12 +71,6 @@ const CHECKBOX_STATE_SCHEMA = { type:&#39;object&#39;, additionalProperties:false, @@ -71,12 +71,6 @@ const CHECKBOX_STATE_SCHEMA = { type:&#39;object&#39;, additionalProperties:false,
71 state:{type:'string', enum:['checked','unchecked']}, 71 state:{type:'string', enum:['checked','unchecked']},
72 lineNumber:{type:'integer'} } } 72 lineNumber:{type:'integer'} } }
73 73
74 -// TAG_REPORT_FRESHNESS_SCHEMA:保留以发现旧版 tag → § ⑫ 错序 bug 残留(tag 指向占位符 commit)。  
75 -const TAG_REPORT_FRESHNESS_SCHEMA = { type:'object', additionalProperties:false,  
76 - required:['fresh'], properties:{  
77 - fresh:{type:'boolean'},  
78 - tagReportValue:{type:'string'} } }  
79 -  
80 const ALREADY_MERGED_SCHEMA = { type:'object', additionalProperties:false, 74 const ALREADY_MERGED_SCHEMA = { type:'object', additionalProperties:false,
81 required:['alreadyMerged'], properties:{ alreadyMerged:{type:'boolean'} } } 75 required:['alreadyMerged'], properties:{ alreadyMerged:{type:'boolean'} } }
82 76
@@ -691,21 +685,6 @@ function createTagPromptM(phaseId, fe) { @@ -691,21 +685,6 @@ function createTagPromptM(phaseId, fe) {
691 ].join('\n') 685 ].join('\n')
692 } 686 }
693 687
694 -// 校验 milestone tag 指向的 commit 中报告 § ⑫ 是否已是 targetTag(而非 placeholder)。  
695 -// 用于识别旧 bug 残留:报告 § ⑫ commit 顺序在 tag 之后时,tag 指向占位符版本。  
696 -function checkTagReportFreshPromptM(targetTag, reportPath) {  
697 - return [  
698 - `# 校验 tag \`${targetTag}\` 指向的 commit 中 \`${reportPath}\` § ⑫ 是否新鲜`,  
699 - microStepContract(),  
700 - '',  
701 - `跑 \`git -C ${ROOT} show ${targetTag}:${reportPath}\`。在输出中定位 § ⑫("里程碑"小节)的 tag 字段值。`,  
702 - '## 输出(TAG_REPORT_FRESHNESS_SCHEMA)',  
703 - `- § ⑫ 字段值 == \`${targetTag}\`:\`{ "fresh": true, "tagReportValue": "${targetTag}" }\``,  
704 - `- § ⑫ 字段值 == \`{{milestone_tag}}\` 或其它陈旧值:\`{ "fresh": false, "tagReportValue": "<实际值>" }\``,  
705 - '- `git show` 失败(tag 不存在 / 报告路径不在 tag commit 中)→ 本步骤失败(schema 失败即可)。',  
706 - ].join('\n')  
707 -}  
708 -  
709 function findReportPromptM(phaseId) { 688 function findReportPromptM(phaseId) {
710 return [ 689 return [
711 `# 找最新的 \`${phaseId}\` 完成报告并读取 § ⑫ 的 milestone tag 字段当前值`, 690 `# 找最新的 \`${phaseId}\` 完成报告并读取 § ⑫ 的 milestone tag 字段当前值`,
@@ -928,16 +907,9 @@ async function runMilestone(module) { @@ -928,16 +907,9 @@ async function runMilestone(module) {
928 } 907 }
929 // else: 已是 targetTag → 静默跳过(resume 幂等) 908 // else: 已是 targetTag → 静默跳过(resume 幂等)
930 909
931 - // step 6: annotated tag (idempotent + stale-tag 自检)  
932 - // 注:HEAD 此刻已包含 § ⑫ 更新 commit(或本来就在 targetTag 上),tag 指向新鲜 commit。 910 + // step 6: annotated tag (idempotent — tag exists 时静默跳过)
933 const tag = await agent(checkTagExistsPromptM(targetTag), {label: lbl('tag?'), phase: 'Milestone', schema: EXISTS_SCHEMA}) 911 const tag = await agent(checkTagExistsPromptM(targetTag), {label: lbl('tag?'), phase: 'Milestone', schema: EXISTS_SCHEMA})
934 - if (tag.exists) {  
935 - // 旧版 bug 残留:tag 可能指向 § ⑫ 仍为占位符的 commit。检查并要求人工 `git tag -f`。  
936 - const fresh = await agent(checkTagReportFreshPromptM(targetTag, rpt.path), {label: lbl('tag-fresh?'), phase: 'Milestone', schema: TAG_REPORT_FRESHNESS_SCHEMA})  
937 - if (!fresh.fresh) {  
938 - throw new Error(`HALT milestone-stale-tag ${phaseId}: tag \`${targetTag}\` 指向的 commit 中 ${rpt.path} § ⑫ = ${JSON.stringify(fresh.tagReportValue || '?')},不是 ${targetTag}(旧版顺序 bug 残留)。请人工跑 \`git -C ${ROOT} tag -f ${targetTag}\` 把 tag 重指到 HEAD 后再重跑 coding-start。`)  
939 - }  
940 - } else { 912 + if (!tag.exists) {
941 const r = await agent(createTagPromptM(phaseId, fe), {label: lbl('tag'), phase: 'Milestone', schema: ACTION_RESULT_SCHEMA}) 913 const r = await agent(createTagPromptM(phaseId, fe), {label: lbl('tag'), phase: 'Milestone', schema: ACTION_RESULT_SCHEMA})
942 if (!r.success) throw new Error(`HALT milestone-tag ${phaseId}: ${r.error || ''}`) 914 if (!r.success) throw new Error(`HALT milestone-tag ${phaseId}: ${r.error || ''}`)
943 } 915 }