@biffo/cli 0.302.2 → 0.302.3

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.
@@ -76,6 +76,27 @@ if ! command -v jq >/dev/null 2>&1; then
76
76
  exit 1
77
77
  fi
78
78
 
79
+ # `timeout` bounds each `pnpm audit` call (#1878). Without it, a registry that
80
+ # TCP-hangs rather than erroring makes a single attempt block for however long
81
+ # pnpm's own internal retry/timeout budget takes — observed at ~4 minutes per
82
+ # attempt against a healthy-run baseline of ~2 seconds for all discovered
83
+ # trees combined. Multiplied by this script's own 3-attempt retry loop across
84
+ # every discovered lockfile tree, that reaches ~36 minutes worst case, blowing
85
+ # through the CI job's 20-minute cap and getting the job CANCELLED — a worse
86
+ # outcome than this script's own designed INCONCLUSIVE-and-block (exit 2),
87
+ # because a cancelled job prints no actionable error. Missing `timeout` is a
88
+ # deterministic environment defect like missing jq above, not a transient
89
+ # hiccup, so it fails loudly rather than silently reverting to unbounded waits.
90
+ if ! command -v timeout >/dev/null 2>&1; then
91
+ echo "::error::timeout (coreutils) is not installed on this runner. The dependency audit cannot bound a hung registry call without it. Install coreutils."
92
+ exit 1
93
+ fi
94
+
95
+ # Generous relative to a healthy run (~2s for every tree combined) but short
96
+ # enough that 3 attempts × every discovered tree stays well inside the job's
97
+ # budget. Overridable for local debugging against a known-slow network.
98
+ AUDIT_TIMEOUT_SECS="${AUDIT_TIMEOUT_SECS:-20}"
99
+
79
100
  attempts=3
80
101
  inconclusive=0
81
102
  failed=0
@@ -121,7 +142,8 @@ audit_dir() {
121
142
  # forever while scanning nothing. (Caught by running this script before
122
143
  # trusting it — the workspace audit had silently stopped working.)
123
144
  # shellcheck disable=SC2086
124
- out="$(cd "$dir" 2>/dev/null && pnpm audit --json $extra 2>/dev/null)"
145
+ out="$(cd "$dir" 2>/dev/null && timeout "$AUDIT_TIMEOUT_SECS" pnpm audit --json $extra 2>/dev/null)"
146
+ audit_status=$?
125
147
  # Stamped the instant the registry answered, not when the run started.
126
148
  # `pnpm audit` asks the LIVE registry, so its verdict is a function of what
127
149
  # had been ingested at this moment — two runs of the same tree minutes apart
@@ -130,6 +152,19 @@ audit_dir() {
130
152
  # broke dev" when nothing in the tree moved.
131
153
  seen_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
132
154
 
155
+ # `timeout` exits 124 when it had to kill the process rather than the
156
+ # process exiting on its own. Handled before the jq parse below: a killed
157
+ # `pnpm audit` produces empty/partial output that would already fall
158
+ # through to "could not run", but naming the timeout explicitly here keeps
159
+ # that failure distinguishable from a genuine registry parse error rather
160
+ # than silently blank, and — same contract as any other "could not run" —
161
+ # it is never treated as a clean/success result.
162
+ if [ "$audit_status" -eq 124 ]; then
163
+ echo "${label}: attempt ${attempt}/${attempts} could not run: timed out after ${AUDIT_TIMEOUT_SECS}s waiting on the registry"
164
+ [ "$attempt" -lt "$attempts" ] && sleep "$((attempt * 3))"
165
+ continue
166
+ fi
167
+
133
168
  if printf '%s' "$out" | jq -e '.metadata.vulnerabilities' >/dev/null 2>&1; then
134
169
  high="$(printf '%s' "$out" | jq '.metadata.vulnerabilities.high // 0')"
135
170
  crit="$(printf '%s' "$out" | jq '.metadata.vulnerabilities.critical // 0')"
@@ -76,6 +76,27 @@ if ! command -v jq >/dev/null 2>&1; then
76
76
  exit 1
77
77
  fi
78
78
 
79
+ # `timeout` bounds each `pnpm audit` call (#1878). Without it, a registry that
80
+ # TCP-hangs rather than erroring makes a single attempt block for however long
81
+ # pnpm's own internal retry/timeout budget takes — observed at ~4 minutes per
82
+ # attempt against a healthy-run baseline of ~2 seconds for all discovered
83
+ # trees combined. Multiplied by this script's own 3-attempt retry loop across
84
+ # every discovered lockfile tree, that reaches ~36 minutes worst case, blowing
85
+ # through the CI job's 20-minute cap and getting the job CANCELLED — a worse
86
+ # outcome than this script's own designed INCONCLUSIVE-and-block (exit 2),
87
+ # because a cancelled job prints no actionable error. Missing `timeout` is a
88
+ # deterministic environment defect like missing jq above, not a transient
89
+ # hiccup, so it fails loudly rather than silently reverting to unbounded waits.
90
+ if ! command -v timeout >/dev/null 2>&1; then
91
+ echo "::error::timeout (coreutils) is not installed on this runner. The dependency audit cannot bound a hung registry call without it. Install coreutils."
92
+ exit 1
93
+ fi
94
+
95
+ # Generous relative to a healthy run (~2s for every tree combined) but short
96
+ # enough that 3 attempts × every discovered tree stays well inside the job's
97
+ # budget. Overridable for local debugging against a known-slow network.
98
+ AUDIT_TIMEOUT_SECS="${AUDIT_TIMEOUT_SECS:-20}"
99
+
79
100
  attempts=3
80
101
  inconclusive=0
81
102
  failed=0
@@ -121,7 +142,8 @@ audit_dir() {
121
142
  # forever while scanning nothing. (Caught by running this script before
122
143
  # trusting it — the workspace audit had silently stopped working.)
123
144
  # shellcheck disable=SC2086
124
- out="$(cd "$dir" 2>/dev/null && pnpm audit --json $extra 2>/dev/null)"
145
+ out="$(cd "$dir" 2>/dev/null && timeout "$AUDIT_TIMEOUT_SECS" pnpm audit --json $extra 2>/dev/null)"
146
+ audit_status=$?
125
147
  # Stamped the instant the registry answered, not when the run started.
126
148
  # `pnpm audit` asks the LIVE registry, so its verdict is a function of what
127
149
  # had been ingested at this moment — two runs of the same tree minutes apart
@@ -130,6 +152,19 @@ audit_dir() {
130
152
  # broke dev" when nothing in the tree moved.
131
153
  seen_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
132
154
 
155
+ # `timeout` exits 124 when it had to kill the process rather than the
156
+ # process exiting on its own. Handled before the jq parse below: a killed
157
+ # `pnpm audit` produces empty/partial output that would already fall
158
+ # through to "could not run", but naming the timeout explicitly here keeps
159
+ # that failure distinguishable from a genuine registry parse error rather
160
+ # than silently blank, and — same contract as any other "could not run" —
161
+ # it is never treated as a clean/success result.
162
+ if [ "$audit_status" -eq 124 ]; then
163
+ echo "${label}: attempt ${attempt}/${attempts} could not run: timed out after ${AUDIT_TIMEOUT_SECS}s waiting on the registry"
164
+ [ "$attempt" -lt "$attempts" ] && sleep "$((attempt * 3))"
165
+ continue
166
+ fi
167
+
133
168
  if printf '%s' "$out" | jq -e '.metadata.vulnerabilities' >/dev/null 2>&1; then
134
169
  high="$(printf '%s' "$out" | jq '.metadata.vulnerabilities.high // 0')"
135
170
  crit="$(printf '%s' "$out" | jq '.metadata.vulnerabilities.critical // 0')"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.302.2",
3
+ "version": "0.302.3",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",