diff --git a/docs/devteam/scripts/devteam.mjs b/docs/devteam/scripts/devteam.mjs index 03d8e7c..152eadd 100644 --- a/docs/devteam/scripts/devteam.mjs +++ b/docs/devteam/scripts/devteam.mjs @@ -8317,6 +8317,9 @@ function cmdDecide() { const incs = refs.map((r) => logGet(r)).filter(isIncident); if (incs.length !== 1) die(`an incident-fix decision names exactly one incident in --refs (sensor incident …), then the fix ticket's id; it names ${incs.length}`); const inc = incs[0]; + // a fix names its ticket too, picked first: ticket add takes only a decision that names it, and + // an answer approves one decision, so a fix decided without it meant asking the owner again + if (!/^\s*(watch|ignore)\b/i.test(what) && !refs.some((r) => r !== inc.id && !/^[a-z]-\d{8}-/.test(r))) die(`a fix decision names its fix ticket's id in --refs too (pick it first): --refs ${inc.id} . ticket add needs a decision that names the ticket, and an answer approves one decision, so leaving it out means asking again; "watch …" or "ignore …" needs no ticket`); const want = sevScope(incidentSeverity(inc)); if (scope && scope !== want) die(`${inc.id} has computed severity ${incidentSeverity(inc)}: its scope is ${want}, not ${scope}`); scope = want; diff --git a/test/lib/chain.mjs b/test/lib/chain.mjs index 86c4a9d..0aeb57f 100644 --- a/test/lib/chain.mjs +++ b/test/lib/chain.mjs @@ -1228,6 +1228,7 @@ out({ cursor: 'x' }); assert.equal(dec.status, 3, dec.err); assert.match(dt(['decide', '--class', 'incident-fix', '--scope', 'sev:low', '--refs', pid, tid, '--', 'x'], sup).err, /its scope is sev:high, not sev:low/); assert.match(dt(['decide', '--class', 'incident-fix', '--refs', tid, '--', 'x'], sup).err, /names exactly one incident/); + assert.match(dt(['decide', '--class', 'incident-fix', '--refs', pid, '--', 'fix OutOfMemory'], sup).err, /names its fix ticket's id/, 'a fix without its ticket would mean asking again'); const q = must(['ask', '--class', 'incident-fix', '--blocks', pid, '--question', 'Fix the checkout OutOfMemory?', '--recommendation', 'fix it', '--default', 'fix it', '--deadline', '2h', '--reasons', 'below-rung'], sup); const qv = json(must(['questions', '--all', '--json'])).find((x) => x.id === q); assert.equal(qv.scope, 'sev:high');