lobstah 0.7.3 → 0.7.4
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/main.js +189 -107
- package/dist/runner.js +13 -8
- package/package.json +1 -1
package/dist/runner.js
CHANGED
|
@@ -16,6 +16,10 @@ import * as path14 from "node:path";
|
|
|
16
16
|
import * as os from "node:os";
|
|
17
17
|
import * as path from "node:path";
|
|
18
18
|
import * as fs from "node:fs";
|
|
19
|
+
import { randomUUID } from "node:crypto";
|
|
20
|
+
function uniqueTempPath(file2) {
|
|
21
|
+
return `${file2}.tmp-${process.pid}-${randomUUID()}`;
|
|
22
|
+
}
|
|
19
23
|
function readDirIfPresent(dir) {
|
|
20
24
|
try {
|
|
21
25
|
return fs.readdirSync(dir);
|
|
@@ -283,7 +287,7 @@ function activityFromEvent(ev, root) {
|
|
|
283
287
|
}
|
|
284
288
|
}
|
|
285
289
|
function atomicWrite(file2, content) {
|
|
286
|
-
const tmp =
|
|
290
|
+
const tmp = uniqueTempPath(file2);
|
|
287
291
|
fs2.writeFileSync(tmp, content);
|
|
288
292
|
fs2.renameSync(tmp, file2);
|
|
289
293
|
}
|
|
@@ -495,7 +499,7 @@ function readEvidence(id, lane) {
|
|
|
495
499
|
}
|
|
496
500
|
function mergeEvidence(id, lane, patch) {
|
|
497
501
|
const file2 = evidencePath(id, lane);
|
|
498
|
-
const tmp =
|
|
502
|
+
const tmp = uniqueTempPath(file2);
|
|
499
503
|
fs5.writeFileSync(tmp, JSON.stringify({ ...readEvidence(id, lane), ...patch }, null, 2));
|
|
500
504
|
fs5.renameSync(tmp, file2);
|
|
501
505
|
}
|
|
@@ -1484,7 +1488,7 @@ function readPrs() {
|
|
|
1484
1488
|
}
|
|
1485
1489
|
|
|
1486
1490
|
// packages/core/dist/watch.js
|
|
1487
|
-
import
|
|
1491
|
+
import fs10 from "node:fs";
|
|
1488
1492
|
import * as path8 from "node:path";
|
|
1489
1493
|
|
|
1490
1494
|
// packages/core/dist/github-budget.js
|
|
@@ -1547,7 +1551,7 @@ function cachedPrView(ref) {
|
|
|
1547
1551
|
const cached = cycle.snapshots[ref.key];
|
|
1548
1552
|
if (cached?.error)
|
|
1549
1553
|
throw new Error(cached.error);
|
|
1550
|
-
return cached
|
|
1554
|
+
return cached ? { ...cached.view, fetchedAt: new Date(cached.at).toISOString() } : void 0;
|
|
1551
1555
|
}
|
|
1552
1556
|
|
|
1553
1557
|
// packages/core/dist/pr.js
|
|
@@ -1600,6 +1604,7 @@ function ghPrViewDirect(ref) {
|
|
|
1600
1604
|
if (threads !== void 0)
|
|
1601
1605
|
view.unresolvedThreads = threads;
|
|
1602
1606
|
}
|
|
1607
|
+
view.fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1603
1608
|
return view;
|
|
1604
1609
|
}
|
|
1605
1610
|
var THREADS_QUERY = "query($owner:String!,$repo:String!,$n:Int!){repository(owner:$owner,name:$repo){pullRequest(number:$n){reviewThreads(first:100){nodes{isResolved}}}}}";
|
|
@@ -1648,7 +1653,7 @@ function postNotice(n) {
|
|
|
1648
1653
|
...n.stateHash ? { stateHash: n.stateHash } : {}
|
|
1649
1654
|
};
|
|
1650
1655
|
const file2 = path10.join(dir, `${seq}.json`);
|
|
1651
|
-
const tmp =
|
|
1656
|
+
const tmp = uniqueTempPath(file2);
|
|
1652
1657
|
fs12.writeFileSync(tmp, JSON.stringify(notice, null, 2));
|
|
1653
1658
|
fs12.renameSync(tmp, file2);
|
|
1654
1659
|
return notice;
|
|
@@ -1892,7 +1897,7 @@ function readJson(file2) {
|
|
|
1892
1897
|
}
|
|
1893
1898
|
function writeJson(file2, value) {
|
|
1894
1899
|
fs15.mkdirSync(path12.dirname(file2), { recursive: true });
|
|
1895
|
-
const tmp =
|
|
1900
|
+
const tmp = uniqueTempPath(file2);
|
|
1896
1901
|
fs15.writeFileSync(tmp, JSON.stringify(value, null, 2));
|
|
1897
1902
|
fs15.renameSync(tmp, file2);
|
|
1898
1903
|
}
|
|
@@ -2199,7 +2204,7 @@ var complete2 = (s) => !!s && s.daily !== void 0;
|
|
|
2199
2204
|
function writeStore(store) {
|
|
2200
2205
|
const file2 = statsPath();
|
|
2201
2206
|
fs17.mkdirSync(path14.dirname(file2), { recursive: true });
|
|
2202
|
-
const tmp =
|
|
2207
|
+
const tmp = uniqueTempPath(file2);
|
|
2203
2208
|
fs17.writeFileSync(tmp, JSON.stringify(store));
|
|
2204
2209
|
fs17.renameSync(tmp, file2);
|
|
2205
2210
|
}
|
|
@@ -4478,7 +4483,7 @@ async function main(activeDir, lane, seams = {}) {
|
|
|
4478
4483
|
cfg.limits.maxWallClockSecs ?? (resolved.limits.wallClockSecs ?? 0) * 4
|
|
4479
4484
|
) * 1e3;
|
|
4480
4485
|
const persistWall = (elapsedMs, windowMs) => {
|
|
4481
|
-
const tmp =
|
|
4486
|
+
const tmp = uniqueTempPath(wallFile);
|
|
4482
4487
|
fs26.writeFileSync(tmp, JSON.stringify({ ...wallState, elapsedMs, windowMs }));
|
|
4483
4488
|
fs26.renameSync(tmp, wallFile);
|
|
4484
4489
|
};
|