@codyswann/lisa 4.101.5 → 4.101.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +23 -7
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/scripts/automation-run-record.mjs +678 -0
- package/plugins/lisa/.codex-plugin/scripts/blocker-edge-resolution.mjs +150 -0
- package/plugins/lisa/.codex-plugin/scripts/intake-blocker-reprobe.mjs +1379 -0
- package/plugins/lisa/.codex-plugin/scripts/intake-prework-denominator.mjs +249 -0
- package/plugins/lisa/.codex-plugin/scripts/operator-id-kinds.mjs +120 -0
- package/plugins/lisa/.codex-plugin/scripts/qa-signal-lifecycle.mjs +523 -0
- package/plugins/lisa/.codex-plugin/scripts/ready-queue-order.mjs +549 -0
- package/plugins/lisa/.codex-plugin/scripts/resolve-lifecycle-role.mjs +347 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-jira-evidence/SKILL.md +10 -5
- package/plugins/lisa/.codex-plugin/skills/lisa-jira-journey/SKILL.md +14 -11
- package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/references/completion-authorization.md +7 -3
- package/plugins/lisa/skills/lisa-jira-evidence/SKILL.md +10 -5
- package/plugins/lisa/skills/lisa-jira-journey/SKILL.md +14 -11
- package/plugins/lisa/skills/lisa-tracker-evidence/references/completion-authorization.md +7 -3
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-agy/skills/lisa-jira-journey/SKILL.md +14 -11
- package/plugins/lisa-agy/skills/lisa-tracker-evidence/references/completion-authorization.md +7 -3
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-copilot/skills/lisa-jira-journey/SKILL.md +14 -11
- package/plugins/lisa-copilot/skills/lisa-tracker-evidence/references/completion-authorization.md +7 -3
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-cursor/skills/lisa-jira-journey/SKILL.md +14 -11
- package/plugins/lisa-cursor/skills/lisa-tracker-evidence/references/completion-authorization.md +7 -3
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-devin/skills/lisa-jira-journey/SKILL.md +14 -11
- package/plugins/lisa-devin/skills/lisa-tracker-evidence/references/completion-authorization.md +7 -3
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-expo/.codex-plugin/skills/jira-journey/SKILL.md +14 -11
- package/plugins/lisa-expo/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-expo/skills/jira-journey/SKILL.md +14 -11
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-agy/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-expo-agy/skills/jira-journey/SKILL.md +14 -11
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-expo-copilot/skills/jira-journey/SKILL.md +14 -11
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-expo-cursor/skills/jira-journey/SKILL.md +14 -11
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-expo-devin/skills/jira-journey/SKILL.md +14 -11
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-rails/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-agy/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-jira-evidence/SKILL.md +10 -5
- package/plugins/src/base/skills/lisa-jira-journey/SKILL.md +14 -11
- package/plugins/src/base/skills/lisa-tracker-evidence/references/completion-authorization.md +7 -3
- package/plugins/src/expo/skills/jira-evidence/SKILL.md +10 -5
- package/plugins/src/expo/skills/jira-journey/SKILL.md +14 -11
- package/plugins/src/rails/skills/jira-evidence/SKILL.md +10 -5
- package/scripts/generate-codex-plugin-artifacts.mjs +6 -0
- package/scripts/lib/codex-shared-scripts.mjs +156 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Pre-work denominator for build-queue intake scanners.
|
|
4
|
+
*
|
|
5
|
+
* A build-intake cycle that reports an empty lane is only as trustworthy as the
|
|
6
|
+
* set of lanes it swept. Sweeping by lane NAME (`Backlog`, `Todo`, `Ready`)
|
|
7
|
+
* omits every pre-work lane a team invented — most commonly a `Blocked` lane,
|
|
8
|
+
* which is not a distinct Linear state type at all: teams model it as
|
|
9
|
+
* `unstarted`, i.e. work that was never started. Items parked there carry a
|
|
10
|
+
* written blocker that nothing ever re-reads, so the lane reads as terminal
|
|
11
|
+
* while it is in fact a queue.
|
|
12
|
+
*
|
|
13
|
+
* This module fixes both halves: lanes are selected by TYPE, never by name, and
|
|
14
|
+
* the swept set is reported alongside the total so a wrong denominator is
|
|
15
|
+
* visible on inspection instead of silent forever.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Lane types that hold work which has not started. Both belong to intake. */
|
|
19
|
+
export const PRE_WORK_LANE_TYPES = Object.freeze(["backlog", "unstarted"]);
|
|
20
|
+
|
|
21
|
+
/** Loop ids whose `nothing-needed` runs must state their denominator. */
|
|
22
|
+
export const DENOMINATOR_REQUIRED_LOOP_IDS = Object.freeze(["intake-tickets"]);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Vendor lane-type vocabularies normalized onto Linear's five-value type set.
|
|
26
|
+
* JIRA exposes the same idea as `statusCategory` (key or display name); GitHub
|
|
27
|
+
* has no type field at all, so its callers pass a type explicitly.
|
|
28
|
+
*/
|
|
29
|
+
const LANE_TYPE_ALIASES = Object.freeze({
|
|
30
|
+
backlog: "backlog",
|
|
31
|
+
unstarted: "unstarted",
|
|
32
|
+
started: "started",
|
|
33
|
+
completed: "completed",
|
|
34
|
+
canceled: "canceled",
|
|
35
|
+
cancelled: "canceled",
|
|
36
|
+
new: "unstarted",
|
|
37
|
+
indeterminate: "started",
|
|
38
|
+
done: "completed",
|
|
39
|
+
"to do": "unstarted",
|
|
40
|
+
"in progress": "started",
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Map a vendor lane type onto the normalized vocabulary.
|
|
45
|
+
*
|
|
46
|
+
* @param {unknown} type
|
|
47
|
+
* @returns {string | null} normalized type, or null when unrecognized
|
|
48
|
+
*/
|
|
49
|
+
export function normalizeLaneType(type) {
|
|
50
|
+
if (typeof type !== "string") {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return LANE_TYPE_ALIASES[type.trim().toLowerCase()] ?? null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param {unknown} type
|
|
58
|
+
* @returns {boolean} whether this lane holds not-yet-started work
|
|
59
|
+
*/
|
|
60
|
+
export function isPreWorkLaneType(type) {
|
|
61
|
+
const normalized = normalizeLaneType(type);
|
|
62
|
+
return normalized !== null && PRE_WORK_LANE_TYPES.includes(normalized);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {unknown} lane
|
|
67
|
+
* @returns {{ name: string, type: string | null, count: number, position: number } | null}
|
|
68
|
+
*/
|
|
69
|
+
function normalizeLane(lane) {
|
|
70
|
+
if (!lane || typeof lane !== "object") {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const name = String(lane.name ?? "").trim();
|
|
74
|
+
if (name.length === 0) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const rawCount = Number(lane.count ?? 0);
|
|
78
|
+
const rawPosition = Number(lane.position ?? Number.POSITIVE_INFINITY);
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
name,
|
|
82
|
+
type: normalizeLaneType(lane.type ?? lane.statusCategory),
|
|
83
|
+
count: Number.isFinite(rawCount) && rawCount > 0 ? Math.trunc(rawCount) : 0,
|
|
84
|
+
position: Number.isFinite(rawPosition)
|
|
85
|
+
? rawPosition
|
|
86
|
+
: Number.POSITIVE_INFINITY,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {{ position: number, name: string }} left
|
|
92
|
+
* @param {{ position: number, name: string }} right
|
|
93
|
+
* @returns {number}
|
|
94
|
+
*/
|
|
95
|
+
function compareLanes(left, right) {
|
|
96
|
+
if (left.position !== right.position) {
|
|
97
|
+
return left.position - right.position;
|
|
98
|
+
}
|
|
99
|
+
return left.name.localeCompare(right.name);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Select every lane holding not-yet-started work, by type.
|
|
104
|
+
*
|
|
105
|
+
* Deliberately name-blind: a team that adds `Blocked`, `Triaged`, or `Icebox`
|
|
106
|
+
* as an `unstarted` state gets it swept without a code change, and no hardcoded
|
|
107
|
+
* roster can fall behind the board.
|
|
108
|
+
*
|
|
109
|
+
* @param {readonly unknown[]} lanes
|
|
110
|
+
* @returns {readonly {name: string, type: string, count: number, position: number}[]}
|
|
111
|
+
*/
|
|
112
|
+
export function selectPreWorkLanes(lanes) {
|
|
113
|
+
return (Array.isArray(lanes) ? lanes : [])
|
|
114
|
+
.map(normalizeLane)
|
|
115
|
+
.filter(lane => lane !== null && isPreWorkLaneType(lane.type))
|
|
116
|
+
.sort(compareLanes);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Build the denominator a scanner must report with its verdict.
|
|
121
|
+
*
|
|
122
|
+
* `totalOpen` is the count of open items on the queue, independent of lanes —
|
|
123
|
+
* supplying it is what makes an omitted lane arithmetically visible.
|
|
124
|
+
*
|
|
125
|
+
* @param {{ lanes?: readonly unknown[], totalOpen?: number }} input
|
|
126
|
+
* @returns {{
|
|
127
|
+
* swept: readonly {name: string, type: string, count: number}[]
|
|
128
|
+
* omitted: readonly {name: string, type: string | null, count: number}[]
|
|
129
|
+
* sweptCount: number
|
|
130
|
+
* totalOpen: number
|
|
131
|
+
* unsweptCount: number
|
|
132
|
+
* }}
|
|
133
|
+
*/
|
|
134
|
+
export function buildIntakeDenominator(input = {}) {
|
|
135
|
+
const normalized = (Array.isArray(input.lanes) ? input.lanes : [])
|
|
136
|
+
.map(normalizeLane)
|
|
137
|
+
.filter(lane => lane !== null)
|
|
138
|
+
.sort(compareLanes);
|
|
139
|
+
const swept = normalized.filter(lane => isPreWorkLaneType(lane.type));
|
|
140
|
+
const omitted = normalized.filter(lane => !isPreWorkLaneType(lane.type));
|
|
141
|
+
const sweptCount = swept.reduce((total, lane) => total + lane.count, 0);
|
|
142
|
+
const laneTotal = normalized.reduce((total, lane) => total + lane.count, 0);
|
|
143
|
+
const rawTotalOpen = Number(input.totalOpen);
|
|
144
|
+
const totalOpen =
|
|
145
|
+
Number.isFinite(rawTotalOpen) && rawTotalOpen >= 0
|
|
146
|
+
? Math.trunc(rawTotalOpen)
|
|
147
|
+
: laneTotal;
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
swept: swept.map(({ name, type, count }) => ({ name, type, count })),
|
|
151
|
+
omitted: omitted.map(({ name, type, count }) => ({ name, type, count })),
|
|
152
|
+
sweptCount,
|
|
153
|
+
totalOpen,
|
|
154
|
+
unsweptCount: Math.max(totalOpen - sweptCount, 0),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Render the denominator for a non-technical operator.
|
|
160
|
+
*
|
|
161
|
+
* @param {ReturnType<typeof buildIntakeDenominator>} denominator
|
|
162
|
+
* @returns {string}
|
|
163
|
+
*/
|
|
164
|
+
export function formatIntakeDenominator(denominator) {
|
|
165
|
+
const lanes = denominator?.swept ?? [];
|
|
166
|
+
const listed =
|
|
167
|
+
lanes.length > 0
|
|
168
|
+
? lanes.map(lane => `${lane.name} (${lane.count})`).join(", ")
|
|
169
|
+
: "no pre-work lanes found";
|
|
170
|
+
|
|
171
|
+
return `Looked in every lane holding work that has not started — ${listed} — ${denominator.sweptCount} items checked out of ${denominator.totalOpen} still open.`;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Render the full operator-readable one-liner for a dry build lane.
|
|
176
|
+
*
|
|
177
|
+
* @param {ReturnType<typeof buildIntakeDenominator>} denominator
|
|
178
|
+
* @param {{ queue?: string }} [context]
|
|
179
|
+
* @returns {string}
|
|
180
|
+
*/
|
|
181
|
+
export function summarizeDryLane(denominator, context = {}) {
|
|
182
|
+
const queue =
|
|
183
|
+
typeof context.queue === "string" && context.queue.trim().length > 0
|
|
184
|
+
? ` on ${context.queue.trim()}`
|
|
185
|
+
: "";
|
|
186
|
+
|
|
187
|
+
return `Nothing ready to build${queue}. ${formatIntakeDenominator(denominator)}`;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @param {unknown} loopId
|
|
192
|
+
* @param {unknown} outcome
|
|
193
|
+
* @returns {boolean} whether this run must carry a denominator
|
|
194
|
+
*/
|
|
195
|
+
export function requiresDenominator(loopId, outcome) {
|
|
196
|
+
return (
|
|
197
|
+
outcome === "nothing-needed" &&
|
|
198
|
+
DENOMINATOR_REQUIRED_LOOP_IDS.includes(String(loopId ?? "").trim())
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @param {unknown} denominator
|
|
204
|
+
* @returns {string | null} the reason it is unusable, or null when valid
|
|
205
|
+
*/
|
|
206
|
+
function findDenominatorDefect(denominator) {
|
|
207
|
+
if (!denominator || typeof denominator !== "object") {
|
|
208
|
+
return "no denominator was supplied";
|
|
209
|
+
}
|
|
210
|
+
if (!Array.isArray(denominator.swept) || denominator.swept.length === 0) {
|
|
211
|
+
return "it names no swept lanes";
|
|
212
|
+
}
|
|
213
|
+
if (!Number.isInteger(denominator.sweptCount)) {
|
|
214
|
+
return "its swept count is not a whole number";
|
|
215
|
+
}
|
|
216
|
+
if (!Number.isInteger(denominator.totalOpen)) {
|
|
217
|
+
return "its open-item total is not a whole number";
|
|
218
|
+
}
|
|
219
|
+
if (denominator.sweptCount > denominator.totalOpen) {
|
|
220
|
+
return "it claims to have swept more items than are open";
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Refuse to record a dry build lane that does not say what it looked at.
|
|
227
|
+
*
|
|
228
|
+
* Thirty-one consecutive cycles reported an empty lane against a queue holding
|
|
229
|
+
* unswept pre-work rows. Every record was honest and every conclusion was
|
|
230
|
+
* false, because none of them stated a denominator. This turns that silent
|
|
231
|
+
* wrong answer into a loud one.
|
|
232
|
+
*
|
|
233
|
+
* @param {{ loopId?: unknown, outcome?: unknown, denominator?: unknown }} input
|
|
234
|
+
* @throws {Error} when a denominator is required and missing or malformed
|
|
235
|
+
*/
|
|
236
|
+
export function assertDenominatorReported(input = {}) {
|
|
237
|
+
if (!requiresDenominator(input.loopId, input.outcome)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const defect = findDenominatorDefect(input.denominator);
|
|
241
|
+
if (defect === null) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
throw new Error(
|
|
246
|
+
`A "nothing-needed" run for loop "${String(input.loopId).trim()}" must state the lanes it swept, and ${defect}. ` +
|
|
247
|
+
`Pass a denominator built by buildIntakeDenominator() so an omitted lane is visible instead of silent.`
|
|
248
|
+
);
|
|
249
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kind-keyed identity entries for `sessionManager.operatorIds` and
|
|
3
|
+
* `sessionManager.trustedAuthorIds` (CodySwannGT/lisa#4623).
|
|
4
|
+
*
|
|
5
|
+
* ## Why this exists
|
|
6
|
+
*
|
|
7
|
+
* One plain config value used to mean two identities. An all-digit entry was
|
|
8
|
+
* a numeric account id to the answer matcher (#4571: anyone can register an
|
|
9
|
+
* all-digit login, nobody picks their own numeric id) but a login to the
|
|
10
|
+
* Ready-queue order and the claim. So an operator whose GitHub login is all
|
|
11
|
+
* digits could not answer on the item, and the stranger whose numeric id
|
|
12
|
+
* equals that login could; switching the entry to the numeric id fixed the
|
|
13
|
+
* answers and broke the queue. A kind-keyed entry names one identity, and
|
|
14
|
+
* every reader matches it the same way:
|
|
15
|
+
*
|
|
16
|
+
* - `login:<v>` is a GitHub login and matches only a `login` field.
|
|
17
|
+
* - `id:<v>` is an account id (a GitHub numeric id, a Jira accountId, a
|
|
18
|
+
* Linear user id) and matches only an id field.
|
|
19
|
+
* - A plain entry (no prefix) keeps exactly the meaning each reader gave it
|
|
20
|
+
* before kind-keyed entries existed. Changing that is a later, breaking
|
|
21
|
+
* change.
|
|
22
|
+
*
|
|
23
|
+
* ## The prefix rule
|
|
24
|
+
*
|
|
25
|
+
* A prefix is one run of ASCII letters followed by `:` at the very start.
|
|
26
|
+
* Jira accountIds can hold a colon (`557058:<uuid>`), but their part before
|
|
27
|
+
* it is digits, so they stay plain. Jira Service Management portal customers
|
|
28
|
+
* have accountIds that start with letters (`qm:<id>`); `qm` is therefore not
|
|
29
|
+
* a prefix and such an id stays plain too. Any other letters-and-colon start
|
|
30
|
+
* is an unknown prefix, and an entry whose prefix is followed by nothing is
|
|
31
|
+
* an empty value. Both are invalid: a reader matches them against nobody and
|
|
32
|
+
* `validate-config.mjs` refuses them, naming the entry.
|
|
33
|
+
*
|
|
34
|
+
* The validator ships as a standalone payload script and keeps its own copy
|
|
35
|
+
* of this grammar; `tests/unit/scripts/operator-id-kinds.test.ts` pins the
|
|
36
|
+
* two together on a table of entries.
|
|
37
|
+
* @module operator-id-kinds
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/** The kinds a prefixed entry may name. */
|
|
41
|
+
export const ID_ENTRY_KINDS = Object.freeze(["login", "id"]);
|
|
42
|
+
|
|
43
|
+
/** A letters-only prefix at the start of an entry. */
|
|
44
|
+
const PREFIX = /^([A-Za-z]+):/;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Letters-and-colon starts that belong to a real tracker id, never a prefix:
|
|
48
|
+
* Jira Service Management portal customers' accountIds start `qm:`.
|
|
49
|
+
*/
|
|
50
|
+
const PLAIN_ID_STARTS = new Set(["qm"]);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @typedef {{ kind: "login" | "id" | "plain", value: string }
|
|
54
|
+
* | { kind: "invalid", problem: "unknown-prefix" | "empty-value", prefix: string }} IdEntry
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Parse one entry. A number (a hand-written numeric id) reads as its string,
|
|
59
|
+
* exactly as the readers have always taken it.
|
|
60
|
+
* @param {unknown} entry - One `operatorIds` / `trustedAuthorIds` entry
|
|
61
|
+
* @returns {IdEntry | null} The parsed entry; null for a non-string,
|
|
62
|
+
* non-number value
|
|
63
|
+
*/
|
|
64
|
+
export function parseIdEntry(entry) {
|
|
65
|
+
if (typeof entry === "number") return { kind: "plain", value: String(entry) };
|
|
66
|
+
if (typeof entry !== "string") return null;
|
|
67
|
+
const prefix = PREFIX.exec(entry)?.[1];
|
|
68
|
+
if (prefix === undefined || PLAIN_ID_STARTS.has(prefix)) {
|
|
69
|
+
return { kind: "plain", value: entry };
|
|
70
|
+
}
|
|
71
|
+
if (!ID_ENTRY_KINDS.includes(prefix)) {
|
|
72
|
+
return { kind: "invalid", problem: "unknown-prefix", prefix };
|
|
73
|
+
}
|
|
74
|
+
const value = entry.slice(prefix.length + 1).trim();
|
|
75
|
+
return value === ""
|
|
76
|
+
? { kind: "invalid", problem: "empty-value", prefix }
|
|
77
|
+
: { kind: prefix, value };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Parse a configured list, dropping values that are not entries at all.
|
|
82
|
+
* @param {unknown} entries - The configured list
|
|
83
|
+
* @returns {IdEntry[]} Parsed entries, invalid ones kept so a reader can
|
|
84
|
+
* count them (an invalid trusted entry still means a filter is set)
|
|
85
|
+
*/
|
|
86
|
+
export function parseIdEntries(entries) {
|
|
87
|
+
return (Array.isArray(entries) ? entries : [])
|
|
88
|
+
.map(parseIdEntry)
|
|
89
|
+
.filter(entry => entry !== null);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether one parsed entry names the identity whose fields are given. Each
|
|
94
|
+
* field is the reader's value for that kind: `plain` is what a plain entry
|
|
95
|
+
* has always been compared with there, `login` the GitHub login (null when
|
|
96
|
+
* the tracker has none), `id` the account id. A missing field never matches.
|
|
97
|
+
* @param {IdEntry} entry - Parsed entry
|
|
98
|
+
* @param {{ plain?: string | null, login?: string | null, id?: string | null }} fields
|
|
99
|
+
* @returns {boolean} Whether it matches
|
|
100
|
+
*/
|
|
101
|
+
export function entryMatches(entry, fields) {
|
|
102
|
+
if (entry.kind === "invalid") return false;
|
|
103
|
+
const actual = fields[entry.kind];
|
|
104
|
+
return typeof actual === "string" && actual !== "" && actual === entry.value;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The values an id-only comparator may hold, for a reader that compares
|
|
109
|
+
* account ids and nothing else (the hold-release check in
|
|
110
|
+
* `intake-blocker-reprobe.mjs`): plain entries as written and `id:` values.
|
|
111
|
+
* A `login:` entry names a login, which such a reader never sees, so it is
|
|
112
|
+
* dropped rather than compared with an id it could collide with.
|
|
113
|
+
* @param {unknown} entries - The configured list
|
|
114
|
+
* @returns {string[]} Values to compare as ids
|
|
115
|
+
*/
|
|
116
|
+
export function idComparableValues(entries) {
|
|
117
|
+
return parseIdEntries(entries)
|
|
118
|
+
.filter(entry => entry.kind === "plain" || entry.kind === "id")
|
|
119
|
+
.map(entry => entry.value);
|
|
120
|
+
}
|