git-watchtower 2.3.21 → 2.3.23
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 +1 -1
- package/src/casino/index.js +12 -3
- package/src/git/pr.js +13 -1
- package/src/server/coordinator.js +11 -2
package/package.json
CHANGED
package/src/casino/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* like hitting the jackpot.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
const { ansi, box } = require('../ui/ansi');
|
|
9
|
+
const { ansi, box, visibleLength } = require('../ui/ansi');
|
|
10
10
|
const sounds = require('./sounds');
|
|
11
11
|
|
|
12
12
|
// ============================================================================
|
|
@@ -537,7 +537,13 @@ function getWinDisplay(width) {
|
|
|
537
537
|
const label = currentWinLevel.label;
|
|
538
538
|
const color = flashOn ? currentWinLevel.color : ansi.dim + currentWinLevel.color;
|
|
539
539
|
|
|
540
|
-
|
|
540
|
+
// Use visibleLength so multi-codepoint emoji clusters (ZWJ family,
|
|
541
|
+
// flag emoji, variation selectors) are counted by display columns
|
|
542
|
+
// rather than UTF-16 code units. The current WIN_LEVELS labels happen
|
|
543
|
+
// to use 2-codepoint emoji whose .length matches column width, but a
|
|
544
|
+
// future label with a flag or family emoji would otherwise center
|
|
545
|
+
// off by one or more columns per glyph.
|
|
546
|
+
const padding = Math.max(0, Math.floor((width - visibleLength(label)) / 2));
|
|
541
547
|
|
|
542
548
|
return color + ' '.repeat(padding) + label + ' '.repeat(padding) + ansi.reset;
|
|
543
549
|
}
|
|
@@ -615,7 +621,10 @@ function getLossDisplay(width) {
|
|
|
615
621
|
const display = `${symbols}${lossMessage}${symbols}`;
|
|
616
622
|
const color = flashOn ? ansi.bgRed + ansi.white : ansi.bgBlack + ansi.red;
|
|
617
623
|
|
|
618
|
-
|
|
624
|
+
// Same reasoning as getWinDisplay: count terminal columns, not UTF-16
|
|
625
|
+
// code units. Untrusted lossMessage strings can also contain wide
|
|
626
|
+
// characters (e.g. CJK in error messages from a localised git build).
|
|
627
|
+
const padding = Math.max(0, Math.floor((width - visibleLength(display)) / 2));
|
|
619
628
|
|
|
620
629
|
return color + ' '.repeat(padding) + display + ' '.repeat(padding) + ansi.reset;
|
|
621
630
|
}
|
package/src/git/pr.js
CHANGED
|
@@ -8,12 +8,24 @@
|
|
|
8
8
|
* @param {Array} prs - Array of PR objects from gh CLI
|
|
9
9
|
* @returns {object|null} Normalized PR info
|
|
10
10
|
*/
|
|
11
|
+
// GitHub statusCheckRollup conclusions that mean "this check did not pass."
|
|
12
|
+
// FAILURE alone misses TIMED_OUT, CANCELLED, ACTION_REQUIRED, and STARTUP_FAILURE
|
|
13
|
+
// — a PR with any of those would render no CI badge in the action modal,
|
|
14
|
+
// leaving the user blind to a real CI break.
|
|
15
|
+
const FAILED_CONCLUSIONS = new Set([
|
|
16
|
+
'FAILURE',
|
|
17
|
+
'TIMED_OUT',
|
|
18
|
+
'CANCELLED',
|
|
19
|
+
'ACTION_REQUIRED',
|
|
20
|
+
'STARTUP_FAILURE',
|
|
21
|
+
]);
|
|
22
|
+
|
|
11
23
|
function parseGitHubPr(prs) {
|
|
12
24
|
if (!prs || prs.length === 0) return null;
|
|
13
25
|
const pr = prs[0];
|
|
14
26
|
const checks = pr.statusCheckRollup || [];
|
|
15
27
|
const checksPass = checks.length > 0 && checks.every(c => c.conclusion === 'SUCCESS');
|
|
16
|
-
const checksFail = checks.some(c => c.conclusion
|
|
28
|
+
const checksFail = checks.some(c => FAILED_CONCLUSIONS.has(c.conclusion));
|
|
17
29
|
return {
|
|
18
30
|
number: pr.number,
|
|
19
31
|
title: pr.title,
|
|
@@ -710,12 +710,21 @@ class Worker {
|
|
|
710
710
|
|
|
711
711
|
this.socket.on('error', (err) => {
|
|
712
712
|
this._connected = false;
|
|
713
|
-
settleReject
|
|
713
|
+
// Pre-registration: settleReject the connect-promise with the
|
|
714
|
+
// socket error. Post-registration: the promise has already
|
|
715
|
+
// resolved, so just maintain _connected. Without the `settled`
|
|
716
|
+
// guard we still passed the same Error into settleReject — a
|
|
717
|
+
// no-op on the already-settled promise, but the misleading
|
|
718
|
+
// "before registration" message would survive in any future
|
|
719
|
+
// change that logged it.
|
|
720
|
+
if (!settled) settleReject(err);
|
|
714
721
|
});
|
|
715
722
|
|
|
716
723
|
this.socket.on('close', () => {
|
|
717
724
|
this._connected = false;
|
|
718
|
-
|
|
725
|
+
if (!settled) {
|
|
726
|
+
settleReject(new Error('coordinator socket closed before registration'));
|
|
727
|
+
}
|
|
719
728
|
});
|
|
720
729
|
});
|
|
721
730
|
}
|