main
1name: nightly
3# Deep fuzz against main with a seed that rotates daily (the UTC date as YYYYMMDD), the full `npm test`, the full
4# limit sweep, and the pack-cut space with git's oracle on every cut (PACK_SPACE=full). No Stryker: mutate.yml runs the
5# full src/ mutation run, in 16 shards, on every push to main, and a mutation run of unchanged code is the same run
6# (unsharded it is ~8 h of test time and never fit this job's 300 min: nightly 1, 4 and 5 were cancelled at it).
7# A failure prints the seed, the failing case and a one-line reproduce command (NIGHTLY-FAIL lines), and the report
8# job opens or comments on the issue "nightly fuzz failure <date>".
9on:
10 schedule:
11 - cron: "23 7 * * *"
12 workflow_dispatch:
13 inputs:
14 seed:
15 description: "fuzz seed (digits); empty = today's UTC date as YYYYMMDD"
16 required: false
17 default: ""
19permissions: {}
21concurrency:
22 group: nightly
23 cancel-in-progress: false
25jobs:
26 seed:
27 name: seed
28 runs-on: ubuntu-latest
29 permissions: {}
30 outputs:
31 seed: ${{ steps.seed.outputs.seed }}
32 date: ${{ steps.seed.outputs.date }}
33 sha: ${{ steps.seed.outputs.sha }}
34 steps:
35 - id: seed
36 env:
37 SEED_INPUT: ${{ inputs.seed }}
38 run: |
39 set -euo pipefail
40 date=$(date -u +%Y-%m-%d)
41 seed="${SEED_INPUT:-$(date -u +%Y%m%d)}"
42 [[ "$seed" =~ ^[0-9]{1,9}$ ]] || { echo "::error::seed must be 1-9 digits, got '$seed'"; exit 1; }
43 echo "seed=$seed" >> "$GITHUB_OUTPUT"
44 echo "date=$date" >> "$GITHUB_OUTPUT"
45 # One commit for the whole run. Every job checks out this sha, never `main`: the shard plan is a pure
46 # function of one commit's file list and test/durations.json, so shards that each resolved main on
47 # their own could run a file twice or not at all when main moved between their checkouts, and gate c
48 # would judge records from mixed commits. A re-run of failed jobs keeps this output, so it stays pinned.
49 sha=$(git ls-remote "https://github.com/${GITHUB_REPOSITORY}.git" refs/heads/main | cut -f1)
50 [[ "$sha" =~ ^[0-9a-f]{40}$ ]] || { echo "::error::could not resolve main to one commit, got '$sha'"; exit 1; }
51 echo "sha=$sha" >> "$GITHUB_OUTPUT"
52 echo "nightly seed $seed ($date) at $sha"
54 fuzz:
55 name: fuzz ${{ matrix.fuzzer }} ${{ matrix.args }}
56 needs: seed
57 runs-on: ubuntu-latest
58 timeout-minutes: 120
59 permissions:
60 contents: read
61 strategy:
62 fail-fast: false
63 matrix:
64 include:
65 - { fuzzer: run.mjs, args: "--n 1000" }
66 - { fuzzer: hostile.mjs, args: "--n 3000" }
67 - { fuzzer: liar.mjs, args: "--n 2000" }
68 - { fuzzer: protocol.mjs, args: "--n 5000" }
69 - { fuzzer: packs.mjs, args: "--n 1000" }
70 - { fuzzer: packgen.mjs, args: "--n 2000" }
71 - { fuzzer: codec.mjs, args: "--n 300000" }
72 - { fuzzer: attributes.mjs, args: "--n 2000" }
73 - { fuzzer: below-hash.mjs, args: "--n 2000" }
74 - { fuzzer: git-semantic.mjs, args: "--n 5000" }
75 - { fuzzer: linemerge.mjs, args: "--n 20000" }
76 - { fuzzer: linemerge.mjs, args: "--n 5000 --runs" }
77 - { fuzzer: linemerge.mjs, args: "--n 5000 --driver union" }
78 - { fuzzer: diffscript.mjs, args: "--n 5000" }
79 - { fuzzer: diffscript.mjs, args: "--n 2000 --snake" }
80 - { fuzzer: diffscript.mjs, args: "--n 200 --huge" }
81 env:
82 GIT_AUTHOR_NAME: ply
83 GIT_AUTHOR_EMAIL: ply@example.com
84 GIT_COMMITTER_NAME: ply
85 GIT_COMMITTER_EMAIL: ply@example.com
86 steps:
87 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
88 with:
89 ref: ${{ needs.seed.outputs.sha }}
90 persist-credentials: false
91 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
92 with:
93 node-version: 22
94 - name: git identity
95 run: git config --global user.name ply && git config --global user.email ply@example.com
96 - run: npm ci
97 - name: fuzz
98 env:
99 SEED: ${{ needs.seed.outputs.seed }}
100 FUZZER: ${{ matrix.fuzzer }}
101 ARGS: ${{ matrix.args }}
102 run: |
103 # ARGS is word-split on purpose: it is a fixed list from the matrix above
104 # shellcheck disable=SC2086
105 node scripts/nightly-fuzz.mjs "$SEED" "$FUZZER" $ARGS
107 # `npm test`, split across 4 runners the way ci.yml's test-shard is (the weighted sequencer in vitest.config.ts over
108 # test/durations.json): on one runner every heavy file ran beside the others, and the push-outcome boundary space
109 # passed its 30 min bound there (#263). Job `test` then judges gate c over every shard's records and runs the
110 # pinned fuzz lines, which is the rest of `npm test`.
111 test-shard:
112 name: npm test shard (${{ matrix.shard }})
113 needs: seed
114 runs-on: ubuntu-latest
115 timeout-minutes: 90
116 permissions:
117 contents: read
118 strategy:
119 fail-fast: false
120 matrix:
121 shard: [1, 2, 3, 4]
122 env:
123 GIT_AUTHOR_NAME: ply
124 GIT_AUTHOR_EMAIL: ply@example.com
125 GIT_COMMITTER_NAME: ply
126 GIT_COMMITTER_EMAIL: ply@example.com
127 steps:
128 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
129 with:
130 ref: ${{ needs.seed.outputs.sha }}
131 persist-credentials: false
132 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
133 with:
134 node-version: 22
135 - name: git identity
136 run: git config --global user.name ply && git config --global user.email ply@example.com
137 - run: npm ci
138 - name: vitest
139 env:
140 INDEX: ${{ strategy.job-index }}
141 TOTAL: ${{ strategy.job-total }}
142 PLY_FAILSITES: .failsites
143 NODE_OPTIONS: --import ${{ github.workspace }}/test/space/failsite-hook.mjs
144 run: |
145 shard="$((INDEX + 1))/${TOTAL}"
146 npx vitest run --shard "$shard" || { echo "NIGHTLY-FAIL npm-test shard $shard reproduce: npx vitest run --shard $shard (the failing files are the FAIL lines above)"; exit 1; }
147 - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
148 if: success() || failure()
149 with:
150 name: failsites-${{ matrix.shard }}
151 path: .failsites
152 include-hidden-files: true
153 if-no-files-found: error
154 retention-days: 14
156 test:
157 name: npm test
158 needs: [seed, test-shard]
159 if: always()
160 runs-on: ubuntu-latest
161 timeout-minutes: 60
162 permissions:
163 contents: read
164 actions: read # the shards' fail-site records
165 env:
166 GIT_AUTHOR_NAME: ply
167 GIT_AUTHOR_EMAIL: ply@example.com
168 GIT_COMMITTER_NAME: ply
169 GIT_COMMITTER_EMAIL: ply@example.com
170 steps:
171 - name: every shard succeeded
172 env:
173 SHARDS: ${{ needs.test-shard.result }}
174 run: |
175 if [ "$SHARDS" != success ]; then
176 echo "NIGHTLY-FAIL npm-test shards: $SHARDS (see the npm test shard jobs)"
177 exit 1
178 fi
179 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
180 with:
181 ref: ${{ needs.seed.outputs.sha }}
182 persist-credentials: false
183 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
184 with:
185 node-version: 22
186 - name: git identity
187 run: git config --global user.name ply && git config --global user.email ply@example.com
188 - run: npm ci
189 - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
190 with:
191 pattern: failsites-*
192 path: .failsites
193 merge-multiple: true
194 - name: gate c (fail sites)
195 env:
196 PLY_FAILSITES: .failsites
197 PLY_FAILSITES_GATE: 1
198 run: |
199 npx vitest run test/space/failsites.test.js || { echo "NIGHTLY-FAIL gate-c reproduce: npm test (gate c runs after the full vitest run)"; exit 1; }
200 - name: pinned fuzz lines
201 run: |
202 # the gate's list: every seed and case is a constant in test/fuzz/pinned.mjs, which prints
203 # `FUZZ-PINNED FAIL <fuzzer> seed=<n>` and a `replay:` command on a failure or a hang
204 npm run test:fuzz-pinned || { echo "NIGHTLY-FAIL npm-test fuzz reproduce: npm run test:fuzz-pinned (see the FUZZ-PINNED FAIL and replay: lines above)"; exit 1; }
205 - name: pinned fuzz lines, fresh seed (discovery)
206 run: |
207 # the same list with one seed drawn for this run; the first line printed is the seed and
208 # `replay: node test/fuzz/pinned.mjs --seed <n>`, and a failure repeats it
209 npm run test:fuzz-random || { echo "NIGHTLY-FAIL fuzz-random reproduce: node test/fuzz/pinned.mjs --seed <n> (the seed is on the 'fuzz-pinned: random mode' lines above)"; exit 1; }
211 pack-cut-full:
212 # every ply path already runs every cut on each PR; this adds git index-pack --strict on every cut (~9,600 runs,
213 # ~90 s), where the PR run judges field boundaries and every 8th offset (~1,400 runs)
214 name: pack-cut (git oracle on every cut)
215 needs: seed
216 runs-on: ubuntu-latest
217 timeout-minutes: 30
218 permissions:
219 contents: read
220 steps:
221 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
222 with:
223 ref: ${{ needs.seed.outputs.sha }}
224 persist-credentials: false
225 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
226 with:
227 node-version: 22
228 - name: git identity
229 run: git config --global user.name ply && git config --global user.email ply@example.com
230 - run: npm ci
231 - name: pack-cut, full oracle
232 env:
233 PACK_SPACE: full
234 run: |
235 npx vitest run test/space/pack-cut.test.js || { echo "NIGHTLY-FAIL pack-cut reproduce: PACK_SPACE=full npx vitest run test/space/pack-cut.test.js"; exit 1; }
237 sweep:
238 name: limit sweep (full)
239 needs: seed
240 runs-on: ubuntu-latest
241 timeout-minutes: 180
242 permissions:
243 contents: read
244 env:
245 GIT_AUTHOR_NAME: ply
246 GIT_AUTHOR_EMAIL: ply@example.com
247 GIT_COMMITTER_NAME: ply
248 GIT_COMMITTER_EMAIL: ply@example.com
249 steps:
250 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
251 with:
252 ref: ${{ needs.seed.outputs.sha }}
253 persist-credentials: false
254 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
255 with:
256 node-version: 22
257 - name: git identity
258 run: git config --global user.name ply && git config --global user.email ply@example.com
259 - run: npm ci
260 - name: sweep (full matrix)
261 run: |
262 node --import ./test/ts-resolve.mjs test/sweep/run.mjs --full || { echo "NIGHTLY-FAIL sweep reproduce: npm run sweep -- --full"; exit 1; }
264 report:
265 name: report failure
266 needs: [seed, fuzz, test-shard, test, pack-cut-full, sweep]
267 # a job that hits its timeout-minutes ends cancelled, not failed: report that too, or a timeout is silent
268 if: failure() || cancelled()
269 runs-on: ubuntu-latest
270 permissions:
271 issues: write
272 actions: read # the failed jobs' logs, for their NIGHTLY-FAIL lines
273 steps:
274 - name: open or update the issue
275 env:
276 GH_TOKEN: ${{ github.token }}
277 GH_REPO: ${{ github.repository }}
278 RUN_ID: ${{ github.run_id }}
279 RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
280 SEED: ${{ needs.seed.outputs.seed }}
281 DATE: ${{ needs.seed.outputs.date }}
282 SHA: ${{ needs.seed.outputs.sha }}
283 run: |
284 set -euo pipefail
285 date="${DATE:-$(date -u +%Y-%m-%d)}"
286 title="nightly fuzz failure $date"
287 body=$(mktemp)
288 {
289 echo "Nightly run $RUN_URL failed or timed out on main at ${SHA:-unknown} (seed \`${SEED:-unknown}\`)."
290 echo
291 gh api --paginate "repos/$GH_REPO/actions/runs/$RUN_ID/jobs" --jq '.jobs[] | select(.conclusion == "failure" or .conclusion == "cancelled") | "\(.id)\t\(.name)"' |
292 while IFS=$'\t' read -r id name; do
293 echo "### $name"
294 echo '```'
295 # A job's log is not served for a while after the job ends: this step started 9 s after npm test
296 # failed on 2026-11-10 and got nothing, so the issue had an empty excerpt (#263). Retry until the log
297 # carries its NIGHTLY-FAIL line, and say so when it never does instead of posting an empty block.
298 log=""
299 for _ in 1 2 3 4 5 6 7 8; do
300 log=$(gh api "repos/$GH_REPO/actions/jobs/$id/logs" 2>/dev/null || true)
301 if printf '%s\n' "$log" | grep -qE '^[0-9TZ:.-]+ NIGHTLY-FAIL '; then break; fi
302 sleep 15
303 done
304 # a log line is "<timestamp> <text>": anchoring skips the echoed script and the ##[error] copies;
305 # vitest's FAIL and timeout lines name the failing file and test (colour codes stripped)
306 excerpt=$(printf '%s\n' "$log" | sed -E 's/\x1b\[[0-9;]*m//g' |
307 grep -E '^[0-9TZ:.-]+ (NIGHTLY-FAIL | FAIL |Error: Test timed out|##\[error\]The job running on runner .* has exceeded)' |
308 cut -d' ' -f2- | awk '!seen[$0]++' | head -20 || true)
309 if [ -n "$excerpt" ]; then
310 printf '%s\n' "$excerpt"
311 elif [ -z "$log" ]; then
312 echo "(job log not available after 8 tries over 2 min; open the run above)"
313 else
314 echo "(no NIGHTLY-FAIL or FAIL line in the job log: it was likely cancelled or timed out; open the run above)"
315 fi
316 echo '```'
317 done
318 } > "$body"
319 cat "$body"
320 num=$(gh issue list --state open --search "\"$title\" in:title" --json number,title --jq ".[] | select(.title == \"$title\") | .number" | head -1)
321 if [ -n "$num" ]; then
322 gh issue comment "$num" --body-file "$body"
323 else
324 gh issue create --title "$title" --body-file "$body"
325 fi
Diagnostics4 git calls · 229 ms
CallStatusSizeTime0229 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200145 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=145 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=145 git.pkt.payload.max=76 git.ls_refs.count=2 git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020038 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=38434 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=6 git.pkt.data=4 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=38434 git.pkt.payload.max=38339 git.sideband.band1.bytes=38338 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=63 git.pack.bytes=38338 git.pack.ofs_delta=0 git.pack.ref_delta=8 git.pack.chain.max=8 git.pack.trailer=0bc36ab7adf82d3109177f11f1ea93f1ce071f77 git.pack.full=55Open pack map
fetch2004.3 KiB224 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=224 git.response.bytes=4403 git.response.cache=MISS git.response.duration_ms=224 git.fetch.wants=90c3b7f25791772fbdfe1f1721a82b5b2b3656b9 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=4403 git.pkt.payload.max=4382 git.sideband.band1.bytes=4381 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/ply.git
- Ref
- refs/heads/main
- Commit
- 19912563f540228593df0c489082e5e2508e21e4
- cf-ray
- a5e2cbb27bc57929
- Request
- 8f4cdb98…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format