@feigi/fleet-ctl 3.24.13 → 3.24.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.24.13",
3
+ "version": "3.24.14",
4
4
  "description": "Agent fleet: run-team controller, merge bot, PR reviewer, and the ticket pipeline they share",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,23 +42,31 @@
42
42
  // Only the refusal of conflicting ticket-features rows names a session and an
43
43
  // agent, and it prints nothing on stdout.
44
44
  //
45
- // STOPPING RULE (exported as `stoppingRule`, not printed by this CLI). For a
46
- // cell X other than slow-high whose definition is live, a VERDICT is a ticket
47
- // with an admissible Pull at X dated on or after the day X's
48
- // `fleet-implementer-<cell>` definition was most recently added, ruled by its
49
- // last tier-outcomes.tsv row (a `+`-joined `ticket` field rules each ticket
50
- // it names) dated on or after the ticket's last such Pull: a ruling never
51
- // predates the Pull it rules, and a row with both verdict columns blank was
52
- // never ruled, so it is skipped. A ticket with no such row is no verdict.
53
- // A ticket counts once however many Pulls it took. A verdict FAILS
54
- // the quality floor on `minted_false_claim=yes` or `closed_own_ticket=no`; a
55
- // counted ruling holding anything but `yes` or `no` in either column, one
56
- // blank included, is refused rather than read as a pass. So is a non-blank
57
- // ruling row of such a ticket whose `run_date` is not `YYYY-MM-DD`: it cannot
58
- // be placed against the Pull, and dropping it would uncount the ticket. So is
59
- // an admissible Pull at X whose `run_date` is not `YYYY-MM-DD`: it cannot be
60
- // placed against the day X's definition was added, and dropping it would
61
- // uncount its ruling.
45
+ // STOPPING RULE (exported as `stoppingRule`, not printed by this CLI). A
46
+ // ticket's RULING is its last tier-outcomes.tsv row in file order (a
47
+ // `+`-joined `ticket` field rules each ticket it names); a row with both
48
+ // verdict columns blank was never ruled, so it is skipped. Its CARRIER is
49
+ // the ticket's last Pull in file order, at any cell, slow-high included,
50
+ // dated on or before the ruling. Dates only set that floor: a ruling counts
51
+ // for a Pull only when dated on or after it, and neither pick is the
52
+ // latest-dated row. A Pull at X is
53
+ // COUNTABLE when X is a cell other than slow-high whose definition is live
54
+ // and the Pull is admissible and dated on or after the day X's
55
+ // `fleet-implementer-<cell>` definition was most recently added. The ruling
56
+ // is a VERDICT for the carrier's cell only, and only when the carrier is
57
+ // countable. Otherwise it is no verdict for any cell, never one for an
58
+ // earlier Pull of the ticket. A ticket with no ruling, or no Pull dated on or
59
+ // before it, is no verdict. A ticket counts once however many Pulls it took,
60
+ // at however many cells. A verdict FAILS the quality floor on
61
+ // `minted_false_claim=yes` or `closed_own_ticket=no`. For a ticket with a
62
+ // countable Pull, a ruling holding anything but `yes` or `no` in either
63
+ // column, one blank included, is refused rather than read as a pass. So is a
64
+ // non-blank ruling row of such a ticket whose `run_date` is not `YYYY-MM-DD`,
65
+ // and, once it is ruled, a Pull of it at any cell whose `run_date` is not
66
+ // `YYYY-MM-DD`: either cannot be placed to find the carrier, and dropping it
67
+ // could move the verdict to another cell or uncount it. So is an admissible
68
+ // Pull at X whose `run_date` is not `YYYY-MM-DD`: it cannot be placed against
69
+ // the day X's definition was added, and dropping it would uncount its ruling.
62
70
  // X is to be withdrawn once it has at least STOP.verdicts verdicts and
63
71
  // floor failures ÷ verdicts is at least STOP.failRate.
64
72
  //
@@ -169,35 +177,50 @@ export function readout({ features, members }) {
169
177
  * `[{ ticket, pr, run_date, closed_own_ticket, minted_false_claim, failed }]`
170
178
  * sorted by ticket, `run_date` the ruling's; `stop` is whether the stopping
171
179
  * rule withdraws the cell. `verdicts` are parsed tier-outcomes.tsv rows.
172
- * Throws on a counted ruling whose `closed_own_ticket` or `minted_false_claim`
173
- * is not `yes` or `no`, on a non-blank ruling row of a Pulled ticket whose
174
- * `run_date` is not `YYYY-MM-DD`, on an admissible Pull at a cell named in
175
- * `added` whose `run_date` is not `YYYY-MM-DD`, and on a member-outcomes
176
- * session+agent repeated with different fields.
180
+ * A ticket's ruling is its last ruling row in file order, charged to the cell
181
+ * of its carrier, the ticket's last Pull in file order at any cell dated on or
182
+ * before the ruling, and only when that Pull is
183
+ * countable: admissible, at a cell named in `added` other than the policy
184
+ * cell, and dated on or after the day that cell's definition was added.
185
+ * Throws on the ruling of a ticket with a countable Pull whose
186
+ * `closed_own_ticket` or `minted_false_claim` is not `yes` or `no`, on a
187
+ * non-blank ruling row of such a ticket whose `run_date` is not `YYYY-MM-DD`,
188
+ * on an admissible Pull at a cell named in `added` whose `run_date` is not
189
+ * `YYYY-MM-DD`, on any Pull of a ruled ticket with a countable Pull whose
190
+ * `run_date` is not `YYYY-MM-DD`, and on a member-outcomes session+agent
191
+ * repeated with different fields.
177
192
  */
178
193
  export function stoppingRule({ features, members, verdicts, added }) {
179
194
  const byKey = indexMembers(members);
180
195
  const rulings = rulingsByTicket(verdicts);
181
- // Per cell, each ticket's last admissible Pull: the one its ruling must follow.
182
- const charged = new Map(Object.keys(added).filter((c) => c !== POLICY_CELL).map((c) => [c, new Map()]));
183
- for (const p of features) {
184
- const pulls = charged.get(p.chosen_cell);
185
- if (!pulls || !admissibleMember(p, byKey)) continue;
196
+ const charged = new Map(Object.keys(added).filter((c) => c !== POLICY_CELL).map((c) => [c, []]));
197
+ const dated = (p) => {
186
198
  if (!DATE.test(p.run_date)) throw new Error(`ticket #${p.ticket} (Pull ${p.agent} at ${p.chosen_cell}): run_date is '${p.run_date}', expected YYYY-MM-DD`);
187
- if (p.run_date < added[p.chosen_cell]) continue;
188
- pulls.set(p.ticket, p);
199
+ return p.run_date;
200
+ };
201
+ const countable = new Set();
202
+ const pullsByTicket = new Map();
203
+ for (const p of features) {
204
+ (pullsByTicket.get(p.ticket) ?? pullsByTicket.set(p.ticket, []).get(p.ticket)).push(p);
205
+ if (!charged.has(p.chosen_cell) || !admissibleMember(p, byKey)) continue;
206
+ if (dated(p) >= added[p.chosen_cell]) countable.add(p);
189
207
  }
190
- return [...charged].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([cell, pulls]) => {
191
- const list = [];
192
- for (const p of pulls.values()) {
193
- const v = rulingFor(rulings, p.ticket, p.run_date);
194
- if (!v) continue;
195
- list.push({
196
- ticket: p.ticket, pr: v.pr, run_date: v.run_date,
197
- closed_own_ticket: v.closed_own_ticket, minted_false_claim: v.minted_false_claim,
198
- failed: v.minted_false_claim === "yes" || v.closed_own_ticket === "no",
199
- });
200
- }
208
+ for (const [ticket, pulls] of pullsByTicket) {
209
+ if (!pulls.some((p) => countable.has(p))) continue;
210
+ // The ticket's ruling: its last ruling row in file order (every date clears a "" floor).
211
+ const v = rulingFor(rulings, ticket, "");
212
+ if (!v) continue;
213
+ // Its carrier: the ticket's last Pull in file order dated on or before the ruling.
214
+ let carrier = null;
215
+ for (const p of pulls) if (dated(p) <= v.run_date) carrier = p;
216
+ if (!carrier || !countable.has(carrier)) continue;
217
+ charged.get(carrier.chosen_cell).push({
218
+ ticket: carrier.ticket, pr: v.pr, run_date: v.run_date,
219
+ closed_own_ticket: v.closed_own_ticket, minted_false_claim: v.minted_false_claim,
220
+ failed: v.minted_false_claim === "yes" || v.closed_own_ticket === "no",
221
+ });
222
+ }
223
+ return [...charged].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([cell, list]) => {
201
224
  list.sort((a, b) => Number(a.ticket) - Number(b.ticket));
202
225
  const failures = list.filter((v) => v.failed).length;
203
226
  const stop = list.length >= STOP.verdicts && failures / list.length >= STOP.failRate;