@tablation/crew 0.53.1 → 0.53.2
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/cli.js +24 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9134,6 +9134,17 @@ ${shipName2 ? `Ship: ${shipName2}
|
|
|
9134
9134
|
|
|
9135
9135
|
${v.reason[0].toUpperCase()}${v.reason.slice(1)}. Set back to \`in_progress\`, still held by this ship; push with a plain \`git push --set-upstream ${v.remote} <branch>\` (never \`--force\`) and set \`fixed\` again.`;
|
|
9136
9136
|
}
|
|
9137
|
+
async function takenOverSince(i, ticketRow) {
|
|
9138
|
+
if (!i.since || !i.writer.events) return false;
|
|
9139
|
+
const from = Date.parse(i.since);
|
|
9140
|
+
const evs = await i.writer.events("taken_over");
|
|
9141
|
+
return evs.some((e) => {
|
|
9142
|
+
if (e.record_id !== ticketRow) return false;
|
|
9143
|
+
if (Date.parse(e.occurred_at ?? e.created_at ?? "") < from) return false;
|
|
9144
|
+
const by = / by (.+?); /.exec(e.message ?? "")?.[1];
|
|
9145
|
+
return !!by && by !== i.shipName;
|
|
9146
|
+
});
|
|
9147
|
+
}
|
|
9137
9148
|
async function enforceHandoff(i) {
|
|
9138
9149
|
try {
|
|
9139
9150
|
const t = await i.writer.ticket(i.ticketId);
|
|
@@ -9159,6 +9170,18 @@ async function enforceHandoff(i) {
|
|
|
9159
9170
|
return { kind: "failed", why: v.reason };
|
|
9160
9171
|
}
|
|
9161
9172
|
const heldBy = i.hold ? t[i.hold.column] : void 0;
|
|
9173
|
+
if (i.hold && heldBy && heldBy !== i.hold.shipId) {
|
|
9174
|
+
i.log.warn(`${t.issue_id} is held by another ship now \u2014 this run's hand-off check is stale, left alone`, log);
|
|
9175
|
+
return { kind: "unverified", why: "ticket is held by another ship" };
|
|
9176
|
+
}
|
|
9177
|
+
if (await takenOverSince(i, t.id)) {
|
|
9178
|
+
i.log.warn(`${t.issue_id} was taken over by another ship during this run \u2014 left alone`, log);
|
|
9179
|
+
return { kind: "unverified", why: "ticket was taken over during this run" };
|
|
9180
|
+
}
|
|
9181
|
+
if (!v.local) {
|
|
9182
|
+
i.log.warn(`${t.issue_id} has no local branch on this ship, so it is not this ship's hand-off to bounce: ${v.reason}`, log);
|
|
9183
|
+
return { kind: "unverified", why: "no local branch on this ship" };
|
|
9184
|
+
}
|
|
9162
9185
|
await i.writer.updateTicket(t.id, {
|
|
9163
9186
|
status: i.contract.statuses.building,
|
|
9164
9187
|
...t.assignee_id ? {} : { assignee_id: i.seatId },
|
|
@@ -9198,6 +9221,7 @@ async function guardRunHandoff(route, ship, tracker, role, workingId, log, since
|
|
|
9198
9221
|
seatId,
|
|
9199
9222
|
shipName: ship.name,
|
|
9200
9223
|
hold: affinity ? { column: affinity.column, shipId: affinity.shipId } : void 0,
|
|
9224
|
+
since: since2,
|
|
9201
9225
|
log
|
|
9202
9226
|
});
|
|
9203
9227
|
if (outcome.kind === "pushed") await retireRunWorktree(tracker, target.dir, cfg, t, role, seatId, ship.name, log);
|
package/package.json
CHANGED