@workit-dev/pi 1.2.1 → 1.3.0
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/worker.js +3 -0
- package/dist/workit.js +39 -5
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -8270,6 +8270,7 @@ var PR_ROW_TYPES = new Set([
|
|
|
8270
8270
|
"pr.merged",
|
|
8271
8271
|
"pr.linked"
|
|
8272
8272
|
]);
|
|
8273
|
+
var HOLD_ROW_TYPES = new Set(["branch.hold", "branch.hold.cleared"]);
|
|
8273
8274
|
var err = (code, error, unblock) => ({
|
|
8274
8275
|
ok: false,
|
|
8275
8276
|
code,
|
|
@@ -8589,6 +8590,8 @@ var OBSERVED_ONLY = new Set([
|
|
|
8589
8590
|
"check",
|
|
8590
8591
|
"merge.unverified",
|
|
8591
8592
|
"policy.judged",
|
|
8593
|
+
"verdict.voided",
|
|
8594
|
+
...HOLD_ROW_TYPES,
|
|
8592
8595
|
...PR_ROW_TYPES
|
|
8593
8596
|
]);
|
|
8594
8597
|
|
package/dist/workit.js
CHANGED
|
@@ -15604,6 +15604,19 @@ var PR_ROW_TYPES = new Set([
|
|
|
15604
15604
|
"pr.merged",
|
|
15605
15605
|
"pr.linked"
|
|
15606
15606
|
]);
|
|
15607
|
+
var HOLD_ROW_TYPES = new Set(["branch.hold", "branch.hold.cleared"]);
|
|
15608
|
+
function branchHold(rows, branch) {
|
|
15609
|
+
let hold = null;
|
|
15610
|
+
for (const row of rows) {
|
|
15611
|
+
if (row.branch !== branch || row.observer !== "workit_cli")
|
|
15612
|
+
continue;
|
|
15613
|
+
if (row.type === "branch.hold")
|
|
15614
|
+
hold = row;
|
|
15615
|
+
else if (row.type === "branch.hold.cleared" || row.type === "push.verified")
|
|
15616
|
+
hold = null;
|
|
15617
|
+
}
|
|
15618
|
+
return hold;
|
|
15619
|
+
}
|
|
15607
15620
|
var err = (code, error, unblock) => ({
|
|
15608
15621
|
ok: false,
|
|
15609
15622
|
code,
|
|
@@ -16114,6 +16127,19 @@ function verdictBasis(verdict, current) {
|
|
|
16114
16127
|
return "stale";
|
|
16115
16128
|
}
|
|
16116
16129
|
var isLiveVerdict = (row, retired) => row.type === "verdict" && typeof row.result === "string" && !retired.has(row.id);
|
|
16130
|
+
var VOID_TYPE = "verdict.voided";
|
|
16131
|
+
function verdictVoids(rows, options = {}) {
|
|
16132
|
+
const voids = new Map;
|
|
16133
|
+
for (const row of rows)
|
|
16134
|
+
if (row.type === VOID_TYPE && row.observer === "workit_cli" && typeof row.target === "string" && (options.chained ? row.integrity === "verified" : row.integrity !== "unverified") && !voids.has(row.target))
|
|
16135
|
+
voids.set(row.target, {
|
|
16136
|
+
id: row.id,
|
|
16137
|
+
at: row.at,
|
|
16138
|
+
reason: str2(row.reason) ?? "",
|
|
16139
|
+
by: row.actor.session
|
|
16140
|
+
});
|
|
16141
|
+
return voids;
|
|
16142
|
+
}
|
|
16117
16143
|
function trailerSessions(cwd, base, head) {
|
|
16118
16144
|
if (!base || !head || !safeRef2(base) || !safeRef2(head))
|
|
16119
16145
|
return [];
|
|
@@ -16452,6 +16478,8 @@ function checkVerdictsOnce(cwd, branch, ledgerRows) {
|
|
|
16452
16478
|
for (const row of rows)
|
|
16453
16479
|
if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && trustReasons(cwd, row).length === 0)
|
|
16454
16480
|
retired.add(row.supersedes);
|
|
16481
|
+
for (const id of verdictVoids(rows, { chained: true }).keys())
|
|
16482
|
+
retired.add(id);
|
|
16455
16483
|
const byKind = new Map;
|
|
16456
16484
|
for (const row of rows.toSorted(byRank))
|
|
16457
16485
|
if (isLiveVerdict(row, retired) && scope(row)) {
|
|
@@ -16585,7 +16613,7 @@ function importMirroredVerdicts(cwd, branch) {
|
|
|
16585
16613
|
const mirror = readLedgerAt(cwd, file, { integrity: true });
|
|
16586
16614
|
if (!mirror.ok)
|
|
16587
16615
|
return [];
|
|
16588
|
-
const candidates = mirror.value.rows.filter((row) => row.type === "verdict" && row.branch === branch && row.integrity === "verified");
|
|
16616
|
+
const candidates = mirror.value.rows.filter((row) => (row.type === "verdict" || row.type === VOID_TYPE) && row.branch === branch && row.integrity === "verified");
|
|
16589
16617
|
const added = new Set;
|
|
16590
16618
|
try {
|
|
16591
16619
|
fs15.mkdirSync(path19.dirname(local.value), { recursive: true });
|
|
@@ -16611,7 +16639,10 @@ function importMirroredVerdicts(cwd, branch) {
|
|
|
16611
16639
|
integrityReason: _reason,
|
|
16612
16640
|
...fields
|
|
16613
16641
|
} = row;
|
|
16614
|
-
const written = appendLine(local.value, (previous) => ({
|
|
16642
|
+
const written = appendLine(local.value, (previous) => ({
|
|
16643
|
+
ok: true,
|
|
16644
|
+
value: sealed(fields, id, at, previous).line
|
|
16645
|
+
}), { heldLock: true });
|
|
16615
16646
|
if (!written.ok)
|
|
16616
16647
|
return false;
|
|
16617
16648
|
ids.add(id);
|
|
@@ -16652,6 +16683,8 @@ var OBSERVED_ONLY = new Set([
|
|
|
16652
16683
|
"check",
|
|
16653
16684
|
"merge.unverified",
|
|
16654
16685
|
"policy.judged",
|
|
16686
|
+
"verdict.voided",
|
|
16687
|
+
...HOLD_ROW_TYPES,
|
|
16655
16688
|
...PR_ROW_TYPES
|
|
16656
16689
|
]);
|
|
16657
16690
|
|
|
@@ -24270,7 +24303,8 @@ var WORKIT_BYPASS_FLAGS = ["--unverified", "--overwrite-unintegrated"];
|
|
|
24270
24303
|
var WORKIT_USER_ONLY = [
|
|
24271
24304
|
["release", "notes", "approve"],
|
|
24272
24305
|
["grant", "set"],
|
|
24273
|
-
["grant", "raise"]
|
|
24306
|
+
["grant", "raise"],
|
|
24307
|
+
["ledger", "void"]
|
|
24274
24308
|
];
|
|
24275
24309
|
var ALLOWED = new Set(WORKIT_ALLOWED_VERBS);
|
|
24276
24310
|
var hasWordsInOrder = (words, needle) => {
|
|
@@ -26559,7 +26593,7 @@ var unpushed = (cwd, branch, endpoint, mine, merged) => {
|
|
|
26559
26593
|
return null;
|
|
26560
26594
|
return {
|
|
26561
26595
|
kind: "unpushed",
|
|
26562
|
-
reason: `${branch} has ${count} commit(s) of this session not on ${remote}, and this workspace's endpoint is \`${endpoint}\` (\`workit grant show\`): push them with \`workit git push\`${endpoint === "pr" ? ", then open or update the PR (`workit pr create --fill`)" : ""}.`
|
|
26596
|
+
reason: `${branch} has ${count} commit(s) of this session not on ${remote}, and this workspace's endpoint is \`${endpoint}\` (\`workit grant show\`): push them with \`workit git push\`${endpoint === "pr" ? ", then open or update the PR (`workit pr create --fill`)" : ""}. If the user said not yet, record it once with \`workit git hold --why "<their words>"\` and stop.`
|
|
26563
26597
|
};
|
|
26564
26598
|
};
|
|
26565
26599
|
var redChecks = (cwd, rows, pr, head, endpoint) => {
|
|
@@ -26638,7 +26672,7 @@ function stopObligation(input, descriptor) {
|
|
|
26638
26672
|
return null;
|
|
26639
26673
|
const autonomy = resolveAutonomy(input.cwd);
|
|
26640
26674
|
const endpoint = autonomy.effectiveEndpoint;
|
|
26641
|
-
if (endpoint !== "commit") {
|
|
26675
|
+
if (endpoint !== "commit" && !branchHold(rows, branch)) {
|
|
26642
26676
|
const left = unpushed(input.cwd, branch, endpoint, commits, mergedHeads(rows));
|
|
26643
26677
|
if (left)
|
|
26644
26678
|
return { ...left, head };
|