Commit 788669a
authored
improvement(ci): collect idle node_modules sticky disks at 3 days (#7513)
* improvement(ci): collect idle node_modules sticky disks at 3 days
node_modules sticky disks are keyed on hashFiles('bun.lock') by design, so a
lockfile bump orphans the old disk. Blacksmith already evicts after 7 days of
inactivity, so this is not a leak — it is a retention window far too generous for
a key that churns this fast.
Steady state is (new disks/day x GB/disk x retention). Measured on the live
account: 6.3 new disks/day at 13.7 GB each, which at 7 days predicts 606 GB
against 601 GB actually observed, so the model holds. At 3 days it predicts
260 GB, and 24 of the 44 current disks (348 GB) are already past that.
3 days rather than 2 because the data says 2 buys almost nothing: only 14 GB
more is idle at 2 days than at 3, while 3 clears a long weekend so a PR whose
last CI run was Friday afternoon still hits a warm disk on Monday.
Age-based, never PR-triggered. The key holds no PR identifier, so every open PR
whose checkout has the same bun.lock mounts the same disk, and there are far more
open PRs than distinct lockfile hashes — sharing is the common case. Deleting on
PR close would destroy a disk many other open PRs are using.
Guards, all exercised against real and crafted listings before shipping: a
server-side --search plus a local regex re-proving the full key shape; an
[a-z_]+ event segment rather than an enumerated push|pull_request, because the
key interpolates github.event_name and a workflow_dispatch disk already exists
that an enumerated list would have skipped forever; a refusal when every disk
looks idle, which means a listing or clock fault rather than genuine idleness;
and rejection of a non-numeric or zero retention. A turbo key injected into the
listing is not selected.
Runs on a GitHub-hosted runner so collection still works during a Blacksmith
outage or a CI_PROVIDER break-glass switch, which is exactly when disks idle and
still bill. The CLI is pinned by version and SHA256 checked against the vendor's
published sidecar rather than piped from a remote installer, since the job holds
an org-wide token, and auto-update is disabled so the pin holds. Deletes fail the
job rather than continue-on-error.
Requires a BLACKSMITH_CLI_TOKEN repository secret; run once with dry_run first.
* fix(ci): collect fork disks, and count like with like in the bulk guard
Two review findings, both real.
Fork PR disks were never collected. test-build.yml appends `-fork` after the
event name, so a fork key reads `pull_request-fork-<hash>`, and the `[a-z_]+`
event class cannot span that hyphen. `-fork` is now its own optional segment.
The live account has no fork disks right now, which is why testing the filter
against real data did not catch it.
The bulk-delete guard could never fire. It compared grouped deletion keys against
raw sticky-disk entries, so architecture variants — deliberately grouped into one
key — and entries the regex had already rejected both inflated the denominator.
The listing is now reduced to the deletable set once, and the staleness test and
the guard both count that same set.
Verified against the live listing and crafted ones: a stale fork key is selected;
a key with two arch variants collapses to a single delete; a key whose newest
variant is fresh is not selected; the guard fires when every eligible key is
stale even with an arch variant present; and an injected turbo key is still never
selected.1 parent 7cfd00a commit 788669a
1 file changed
Lines changed: 183 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
0 commit comments