@@ -1109,9 +1109,19 @@ export function retirementProposals(pipeline, { runs = [], now = Date.now(), obs
11091109 writeTo : "steps[].removedBy(人批后改 status/version)"
11101110 } ,
11111111 "rework-path" : {
1112- question : "从这一步岔出去已经成了常态,是这条路径过时了,还是岔路该并进图里?" ,
1113- choices : [ "路径过时了" , "岔路该并进来" , "不知道" ] ,
1114- writeTo : "新版本的 steps[]"
1112+ // 同一 kind 有两种成因(pipeline.js 的 cause 字段):detoured 问重画路径,
1113+ // skipped 问删步/改 optional——共用一句问法会让跳过场景答非所问
1114+ // (CodeRabbit #458 F3)。cause 缺失(旧提议/外部构造)退回 detoured 问法。
1115+ detoured : {
1116+ question : "从这一步岔出去已经成了常态,是这条路径过时了,还是岔路该并进图里?" ,
1117+ choices : [ "路径过时了" , "岔路该并进来" , "不知道" ] ,
1118+ writeTo : "新版本的 steps[]"
1119+ } ,
1120+ skipped : {
1121+ question : "这一必经步骤总被跳过:是这步该改成 optional(或删掉),还是流程本身写错了?" ,
1122+ choices : [ "该改成 optional" , "该删掉" , "流程写错了" , "不知道" ] ,
1123+ writeTo : "steps[].optional(人批后改 version)"
1124+ }
11151125 } ,
11161126 "violation-precedence" : {
11171127 question : "做了后继却没做它的前置:是顺序写错了,还是这个前置根本不必要?" ,
@@ -1129,15 +1139,24 @@ export function retirementProposals(pipeline, { runs = [], now = Date.now(), obs
11291139 writeTo : "无(信息项;人若要拿掉,走删步流程)"
11301140 }
11311141 } ;
1132- const items = suggestRetirements ( pipeline , { runs, now, observed } ) . map ( ( s ) => ( {
1133- kind : s . kind ,
1134- pipelineId : pipeline . id ,
1135- stepId : s . stepId ,
1136- title : s . title ,
1137- because : s . because ,
1138- effect : s . effect ,
1139- ...( ASK [ s . kind ] ?? { question : "这一步要怎么处理?" , choices : [ "不知道" ] , writeTo : "新版本的 steps[]" } )
1140- } ) ) ;
1142+ const items = suggestRetirements ( pipeline , { runs, now, observed } ) . map ( ( s ) => {
1143+ // rework-path 按 cause 二选一问法;其余 kind 直接查表。缺表项的兜底保持原样。
1144+ const askTable = ASK [ s . kind ] ;
1145+ const ask = askTable
1146+ ? ( s . cause && askTable [ s . cause ] ) || ( typeof askTable . question === "string" ? askTable : askTable . detoured )
1147+ : { question : "这一步要怎么处理?" , choices : [ "不知道" ] , writeTo : "新版本的 steps[]" } ;
1148+ return {
1149+ kind : s . kind ,
1150+ pipelineId : pipeline . id ,
1151+ stepId : s . stepId ,
1152+ title : s . title ,
1153+ because : s . because ,
1154+ effect : s . effect ,
1155+ // cause 只有 rework-path 有;其余 kind 不带 undefined 键(消费方 deepEqual 会看到多余键)
1156+ ...( s . cause ? { cause : s . cause } : { } ) ,
1157+ ...ask
1158+ } ;
1159+ } ) ;
11411160 return { contract : "mneme.nudge/v1" , pipelineId : pipeline . id , generatedAt : new Date ( now ) . toISOString ( ) , items } ;
11421161}
11431162
0 commit comments