Repository navigation
1013 lines (986 loc) · 49.6 KB
/
Copy pathnightly.yml
File metadata and controls
1013 lines (986 loc) · 49.6 KB
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: nightly
# The overnight seed sweep. Gate G1's second sentence in a cron entry: *a bug
# injected into any component is found by an overnight seed sweep and arrives as
# a reproduction command rather than as a symptom*.
#
# This file adds a schedule and changes no existing job. The pull-request gate in
# ci.yml stays exactly what it was — its `workload` job runs the corpus, which is
# seconds, and the million-trial sweep lives here where nobody is waiting for it.
#
# ## What it does when it finds something, which is the whole question
#
# A nightly job that nobody reads is a job that fails silently for a month, and
# a red cross on a schedule is the easiest thing in a repository to stop seeing.
# So a finding produces three things and not one:
#
# 1. **The job goes red.** `cargo xtask sweep` exits non-zero when it finds
# anything, and every finding in its report carries the one line that
# reproduces it.
# 2. **The report is an artifact**, kept for ninety days, so a failure two
# weeks old is still readable after the log has rotated.
# 3. **An issue is opened**, titled with the smallest reproduction the sweep
# found and containing the whole report. That is the part that reaches a
# person: an issue arrives in a notification and a scheduled workflow's red
# cross does not. It is opened once per finding-set — the title carries the
# signature and the scenario, so a sweep that finds the same thing on
# thirty consecutive nights adds thirty comments to one issue rather than
# opening thirty issues.
#
# 4. **The corpus grows.** The job sweeps with `--record`, so every finding is
# merged into `sim/corpus.txt` before the verdict comes back, and the file
# is uploaded as an artifact. A scheduled job cannot commit to the tree and
# should not try; what it can do is hand a person the exact file to merge,
# so that a seed which found something outlives the run that found it. The
# corpus is append-only, so the diff against the tree is what was added.
#
# The exit criterion says *with no human triage*. What arrives is therefore the
# report itself and not a summary of it: the first finding is the smallest
# reproduction the sweep has, it is spelled as a `--check` run that exits
# non-zero and names the property it broke, and reading it is the whole of the
# work.
#
# ## Why the base moves and the grid does not
#
# A sweep is a pure function of `(commit, base, seeds, scenarios)`. That is what
# makes a finding reproducible and it is also what would make a nightly on an
# unchanged commit reproduce the previous night's bytes exactly — a regression
# suite with a cron entry rather than a search. So the *base* walks a committed
# list by run number while everything else stays fixed: successive nights cover
# new seed space, and any single night is replayable from the base its own
# report prints. Nothing here reads a clock.
#
# ## The two other jobs, and why the sweep is not enough on its own
#
# `harness` is the half that says a clean sweep means anything. It arms the
# deliberate defect, requires the sweep and the corpus to find it, disarms it and
# requires both to go quiet — the same argument `cargo xtask mutate` makes about
# the boot suite. Without it, a sweep whose oracle had quietly stopped reading
# anything would print `clean` every night for a year. RFC 0017, RFC 0040.
#
# `join` re-runs the boot-to-workload join on a schedule, because the gap it
# declares (`JOIN_GAP`) closes by somebody else's work landing rather than by
# anything in this file changing. RFC 0036.
#
# ## And the floor under all of them, which took two post-mortems
#
# The four things above are what the *sweep* does when it finds something. Every
# other job in this file did one of them — go red — and the twelve paragraphs
# below arguing that a self-explanatory report needs no notification are all
# correct and all answer the wrong question. `docs/postmortem/0002`: five
# consecutive red nights, unread. `docs/postmortem/0003`: `rollback` red at 03:11
# UTC with the repair already on a branch, unread for a day. The `alarm` job at
# the bottom watches every job in this file and opens one issue when any of them
# fails; its own header carries the argument, and RFC 0122 is the reversal.
on:
schedule:
# 03:11 UTC. Not on the hour: GitHub's scheduler is busiest at exact hours
# and delays a job that asks for one, and a nightly that runs at an
# unpredictable time is a nightly whose duration nobody can read.
- cron: "11 3 * * *"
workflow_dispatch:
inputs:
seeds:
description: "How many seeds per scenario"
required: false
default: "65536"
# The half of the alarm a person can exercise without waiting for a night.
#
# A mechanism nobody can run is the one that is broken when it is needed,
# which is `docs/postmortem/0002` in one sentence. `dry-run` makes the
# `alarm` job compute the decision, the title and the whole issue body and
# write them to the run summary, and open nothing — so the thing a reviewer
# is being asked to trust can be read before it has ever run for real.
# `post` is the deliberate end-to-end test and will open a real issue in
# this repository; `off` is for a dispatch that wants neither.
#
# A `schedule` run ignores this and always posts. That is the whole point:
# the route that matters is the one nobody chose.
alarm:
description: "On a manual run: dry-run (default), post, or off"
required: false
type: choice
default: "dry-run"
options: ["dry-run", "post", "off"]
env:
REGISTRY: ghcr.io
IMAGE: ${{ github.repository_owner }}/f-dev
# 65 536 seeds against every shipped scenario. That was eighteen scenarios and
# 1 179 648 trials when it was measured, and it took 226 s on the four-core
# development container — measured, not estimated. The table grows: this
# comment is the one account of the scenario set with nothing keeping it in
# line, so read the total as a rate and ask `cargo xtask sweep --help` or
# `f-sim --list` for today's count. A GitHub runner has two cores, so the
# number to expect here is roughly twice that. It is a nightly: the budget is
# the night.
#
# It is also seven processes rather than one, and that is not a performance
# choice. Every trial leaks its clients' buffer regions — `sim/src/client.rs`
# grants a component's region for the life of the component, and a simulated
# component's life is the run — so one process holds a bounded number of
# trials and `f-sim` refuses a grid past that bound instead of being killed
# for memory half way through the night. `cargo xtask sweep` shards on the
# ceiling `f-sim --ceiling` states, which is 9 658 seeds here — so this is
# seven processes and the largest of them peaked at 941 268 kB, which is
# 0.90 GiB and fits the 7 GB runner class. Measured, polled through /proc
# every two seconds. Unsharded, the same sweep reached 6.06 GiB. RFC 0042.
SEEDS: ${{ github.event.inputs.seeds || '65536' }}
# The seeds successive nights derive from, committed rather than computed.
#
# The sweep is a pure function of (commit, base, seeds, scenarios), which is
# the property the whole apparatus rests on — so on an unchanged commit every
# night would otherwise reproduce the previous night's bytes exactly, and a
# nightly that re-runs one fixed grid is a regression suite with a cron entry
# rather than a search. Walking a committed list by run number covers new seed
# space each night while leaving any single night replayable from the base its
# own report prints. The list is here rather than derived from a clock because
# a base drawn from the time of day is a finding nobody can reproduce.
BASES: >-
0xf00dbeefcafe1234
0x9e3779b97f4a7c15
0x6a09e667f3bcc909
0xbb67ae8584caa73b
0x3c6ef372fe94f82b
0xa54ff53a5f1d36f1
0x510e527fade682d1
0x1f83d9abfb41bd6b
# Every `run:` below is bash, said once here rather than six times downstream.
#
# A step in a `container:` job gets `/bin/sh`, and this image's `/bin/sh` is
# dash. `set -o pipefail` is bash and not POSIX, so dash exits 2 on line 1 —
# before the command underneath it runs at all. Six of the nine jobs that run
# in the container open with that line, and all six have therefore failed every
# night since this file was written: five scheduled runs, five red crosses, and
# not one green night ever. What each of them reported was `No files were found
# with the provided path` from the artifact step, because the report the step
# would have written is downstream of the line that refused — so the visible
# failure named the artifact and not the shell.
#
# The cost landed exactly where this file's header says it would. `sweep` is
# the job that opens the issue, and `sweep` was one of the six: the one part of
# the apparatus built to reach a person was itself broken, so five nights of
# red produced no issue, no artifact and no reader. A nightly that fails
# silently for a month was the failure this file was written to prevent, and it
# is the failure this file had.
#
# Named here rather than on six steps, because the seventh occurrence is
# otherwise somebody writing `set -o pipefail` into a new job in six months and
# finding out the same way. A step that genuinely wants POSIX `sh` says so on
# itself; none does today.
defaults:
run:
shell: bash
jobs:
# The environment, computed and built exactly as ci.yml does it. Duplicated
# rather than shared, and the duplication is deliberate: a nightly that
# depended on a pull-request run having happened would be a nightly that fails
# at "Initialize containers" on any week nobody opened a pull request, which is
# the failure ci.yml's own header describes having had once already.
environment:
name: environment tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
image: ${{ steps.tag.outputs.image }}
image_full: ${{ steps.tag.outputs.image_full }}
steps:
- uses: actions/checkout@v7
- id: tag
run: |
hash=$(echo "${{ hashFiles('docker/Dockerfile', 'docker/entrypoint.sh', 'rust-toolchain.toml') }}" | cut -c1-16)
echo "tag=env-$hash" >> "$GITHUB_OUTPUT"
echo "image=${REGISTRY}/${IMAGE}:env-$hash-amd64" >> "$GITHUB_OUTPUT"
# The `full` image, which is the only one carrying Kani. It is a
# second tag off the same hash rather than a second hash: both are
# built from the same three files, so a commit that leaves the
# environment alone is a cache hit for both.
echo "image_full=${REGISTRY}/${IMAGE}:full-env-$hash-amd64" >> "$GITHUB_OUTPUT"
echo "environment tag: env-$hash"
# x86-64 only. The sweep runs above the frame, in a host crate with no
# architecture in it, so the AArch64 runner buys nothing here — what it buys is
# in ci.yml's litmus and test jobs, where the memory model is the subject.
image:
name: environment image
needs: environment
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
target: dev
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ needs.environment.outputs.tag }}-amd64
cache-from: type=gha,scope=dev-amd64
cache-to: type=gha,mode=max,scope=dev-amd64
# `full` adds Kani, which the `prove` job needs and which nothing else here
# does. It is a separate target for the reason docker/Dockerfile states at the
# layer — the checker's toolchain is about 1.4 GB and exactly one job pulls it
# — and it is a separate *job* for a reason worth stating, because it was a
# second step in `image` first and that was wrong:
#
# six jobs below carry `needs: [environment, image]`. A Kani layer inside
# `image` puts all six behind a `cargo install` from crates.io and a 483 MB
# download from GitHub releases, at image-build time, on every commit that
# misses the cache — which is precisely the commit that changes
# docker/Dockerfile. A network failure in the checker's own toolchain would
# then take down the sweep, the fuzzers and the Miri job, none of which have
# ever heard of it. docker/README.md records that exact download failing on
# one machine already. A check that does not run asserts nothing, so the
# blast radius of this layer is one job by construction rather than by luck.
image_full:
name: environment image, with the checker
needs: environment
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
target: full
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE }}:full-${{ needs.environment.outputs.tag }}-amd64
cache-from: type=gha,scope=full-amd64
cache-to: type=gha,mode=max,scope=full-amd64
# The half that says a clean sweep means something. It runs first and the sweep
# depends on it, so a night where the harness has broken reports *the harness
# is broken* rather than reporting a clean sweep nobody should believe.
harness:
name: the sweep can fail
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
- run: cargo xtask sweep --mutate
sweep:
name: overnight seed sweep
needs: [environment, image, harness]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
# A job that names `permissions:` *replaces* the default set rather than
# adding to it. Naming `issues: write` for the step at the bottom therefore
# dropped `packages: read`, which is what pulls the image named two lines
# above — so this job, alone among the nine, failed at `Initialize
# containers` with `Error response from daemon: denied`, before any step of
# its own ran. That is why the sweep's own report and corpus artifacts were
# missing rather than empty, and why the `open an issue for it` step below
# never fired on five consecutive red nights: `if: failure()` cannot run in
# a container that does not exist. The other eight container jobs name no
# permissions, inherit `packages: read`, and pull the same tag fine.
permissions:
contents: read
packages: read
issues: write
steps:
- uses: actions/checkout@v7
# `tee` and not a redirect: the log should carry the report as well as the
# artifact, because the commonest way to read a nightly failure is to click
# the red cross. `pipefail` so the sweep's own exit status survives the
# pipe — without it this job would be green on every finding, which is the
# exact shape of silently-broken this file's header is about.
- name: sweep
id: sweep
run: |
set -o pipefail
# The base this night sweeps from, walked by run number over a
# committed list. `github.run_number` is monotone and is not a clock:
# it selects which committed base is used and reaches nothing else,
# and the report prints the base it was given, so any night is
# replayable from its own artifact.
set -- $BASES
shift $(( GITHUB_RUN_NUMBER % $# ))
base="$1"
echo "base for this night: $base"
# `--record` and not `--sweep`: growing the corpus and going red are
# both this job's, and a second full pass to do the second of them
# would double the night. Entries are merged into sim/corpus.txt
# before the verdict is returned, and the file is uploaded below
# whether or not anything was found.
cargo xtask sweep --base "$base" --record "$SEEDS" 2>&1 | tee sweep-report.txt
# The corpus as this night left it. A nightly cannot commit to the tree
# and should not try: what it can do is hand a person the exact file to
# merge, so a seed that found something survives the run that found it.
# `sweep --record` is append-only, so the diff against the tree is what
# was added and nothing else.
- name: keep the corpus this night grew
if: always()
uses: actions/upload-artifact@v4
with:
name: corpus
path: sim/corpus.txt
retention-days: 90
if-no-files-found: error
- name: keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: sweep-report
path: sweep-report.txt
retention-days: 90
if-no-files-found: error
# The part that reaches a person. A scheduled workflow's red cross is a
# notification nobody has subscribed to; an issue is one everybody has.
- name: open an issue for it
if: failure() && github.event_name == 'schedule'
env:
GH_TOKEN: ${{ github.token }}
run: |
# The first finding is the smallest reproduction the sweep has —
# `f_sim::sweep` sorts by it — so the title names that one and the body
# carries the whole report. A title that carried a count instead would
# be a title somebody has to open the issue to understand.
# `-m1`: a sharded sweep prints one report per shard, so there is a
# `finding 1` per shard that found anything. The first is the one from
# the earliest seed range, which is the one to look at first — and it
# keeps the title stable across nights that find the same thing.
headline=$(grep -m1 -E '^finding 1 ' sweep-report.txt || echo "finding 1 (the report's shape moved)")
title="nightly sweep: ${headline#finding 1 }"
existing=$(gh issue list --state open --search "$title in:title" --json number --jq '.[0].number')
{
echo "The nightly seed sweep found something at commit \`${{ github.sha }}\`."
echo
echo "Every finding below carries the one line that reproduces it, and that"
echo "line judges itself: it runs \`--check\`, which exits non-zero and names"
echo "the property that broke. There is nothing to triage: paste the"
echo "\`smallest\` line of finding 1, which is the tightest reproduction this"
echo "sweep found. The run's \`corpus\` artifact holds sim/corpus.txt with this"
echo "night's entries already merged in."
echo
echo '```'
cat sweep-report.txt
echo '```'
echo
echo "Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
} > body.md
if [ -n "$existing" ]; then
# One issue per finding-set. A sweep that finds the same thing for
# thirty nights should produce one thread with thirty comments, not
# thirty issues nobody closes.
gh issue comment "$existing" --body-file body.md
else
gh issue create --title "$title" --body-file body.md --label nightly || \
gh issue create --title "$title" --body-file body.md
fi
# RFC 0036's declared gap closes when somebody else's work lands, so it is
# re-checked on a schedule as well as in the gate: `JOIN_GAP` still holding
# exactly is a statement about the tree that changes without this file
# changing.
join:
name: boot-to-workload join
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
- run: cargo xtask sim --join
# E1-P04, at the counts the gate cannot afford and at a base that moves.
#
# The pull-request gate already runs the exit's billion at the tree's own
# seed, which is a regression suite: same commit, same bytes, every time. What
# this adds is *search* — the base walks the same committed list the sweep
# uses, so successive nights cover new seed space, and any night is replayable
# from the base its own report prints. Nothing here reads a clock.
#
# And the Miri half at sixteen times the gate's count. Four thousand
# operations a commit is what an interpreter costing six orders of magnitude
# buys inside a pull request; sixty-five thousand is what a night buys, and
# both numbers are in claims/0008 rather than one of them being in prose.
# RFC 0046.
hostile:
name: the hostile peer, overnight
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
# The harness first, for the sweep's reason: a night where the fuzzer has
# broken should report that rather than report a clean billion nobody
# should believe.
- run: cargo xtask hostile --mutate
- name: a billion operations at tonight's base
run: |
set -o pipefail
# `github.run_number` is monotone and is not a clock: it selects which
# committed base is used and reaches nothing else. The same mechanism
# the sweep above uses, and the same list.
set -- $BASES
shift $(( GITHUB_RUN_NUMBER % $# ))
base="$1"
echo "base for this night: $base"
cargo xtask hostile --base "$base" --exit 2>&1 | tee hostile-report.txt
- name: keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: hostile-report
path: hostile-report.txt
retention-days: 90
if-no-files-found: error
# Gate G2's headline property, overnight: cut the power at every write
# boundary in a publish and never observe a state that was not one of the two
# intended ones. Beside the sweep rather than in ci.yml for the sweep's own
# reason — `cargo test --workspace` already runs the same binary at four seeds
# and the four publishes that matter, which is seconds, and the wide grid lives
# here where nobody is waiting for it.
#
# It does not vary its base by run number the way the sweep and the fuzzers do,
# and that is deliberate: this grid is *exhaustive* in the dimension that
# matters — every cut point of every publish, both granularities, both modes —
# so the seeds vary the workload rather than the search, and a night that
# covered new seed space would be covering new content and the same cuts. What
# a wider night buys here is more seeds, which is the `--seeds` argument.
cut:
name: every write boundary in a publish, cut
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
# The control first, for the sweep's reason: a night where the oracle has
# broken should report that rather than report a clean hundred thousand
# nobody should believe.
- run: cargo xtask cut --mutate
- name: every cut point of every publish
run: |
set -o pipefail
cargo xtask cut 2>&1 | tee cut-report.txt
- name: keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: cut-report
path: cut-report.txt
retention-days: 90
if-no-files-found: error
# The unsafety property at the count a night can afford. Separate from the job
# above because the two differ by six orders of magnitude in cost and by one
# in what they can see.
miri:
name: the ring under Miri, overnight
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
- run: cargo xtask hostile --miri --mutate
- name: sixty-five thousand operations under Miri
run: |
set -- $BASES
shift $(( GITHUB_RUN_NUMBER % $# ))
cargo xtask hostile --miri --base "$1" 65536
# And the corpus under the tool, which is the one thing the pull-request
# gate does not do: every run that has ever found something, re-run with
# the aliasing checker on.
- run: cargo xtask hostile --miri --corpus
# E1-P05 at a base the pull-request gate never uses, and at sixteen times its
# count. The gate is a quarter of a million cases at the tree's own seed, which
# is a fixed sample: what a night buys is *different* inputs, and the value of
# that is the same as the sweep's — the corpus in the tree was found at one
# base, and a family that only ever produces refusals at that base produces
# something else at another.
#
# It does not `--record`. Writing a corpus needs a commit and a night has no
# branch to put one on; what a red night says is *there is a case the corpus
# does not have*, and the reproduction is in the report. RFC 0048.
entries:
name: the entry fuzzer, overnight
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
# The oracles first, for the hostile job's reason.
- run: cargo xtask entries --mutate
- name: four million cases at tonight's base
run: |
set -o pipefail
set -- $BASES
shift $(( GITHUB_RUN_NUMBER % $# ))
base="$1"
echo "base for this night: $base"
cargo xtask entries --base "$base" 4194304 2>&1 | tee entries-report.txt
# And the committed corpus, replayed and measured, because a night is also
# where a coverage figure that has quietly fallen shows up.
- run: cargo xtask entries --corpus
- run: cargo xtask entries --coverage
- name: keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: entries-report
path: entries-report.txt
retention-days: 90
if-no-files-found: error
# E1-P07 and E1-P12. The five capability properties and the ring's validation
# paths, proved rather than sampled.
#
# ## Why one job and not two
#
# Because `lint-proofs` requires that exactly **one** job depend on
# `image_full`, and it is right to: that image carries Kani's own rustc, built
# by fetching a crate and a 483 MB release at image-build time, so every job
# waiting on it is a job the checker's toolchain can take down. E1-P12 wanted
# a second `prove` job and got the check firing correctly on the first thing
# that tried to do what it was written against. So `cargo xtask prove` runs
# both crates, prints how many, and this stays one job. RFC 0057.
#
# ## Why this is on a schedule and not in the gate
#
# Two reasons, and the smaller one is the time: `cargo xtask prove` is about
# twenty minutes on the four-core development container, which is a nightly's
# budget rather than a pull request's. That is context and not a claim — a
# container wall clock is the one number this tree refuses to publish, which
# is why `bench/src/lib.rs` will not record one and why there is no figure to
# the second here.
#
# The larger reason is what it needs. Kani ships a rustc of its own, so the
# image that carries it is 1.48 GB larger than the one every job in `ci.yml`
# pulls, and putting the checker in the gate's image would charge every
# pull-request job for a verb one of them runs. `E1-P07`'s exit says *on a
# schedule*, and this is the schedule it meant. RFC 0022 for the toolchain,
# RFC 0053 for the proofs.
#
# ## What checks that this job is still here
#
# Nothing in the repository can watch GitHub run it, so `cargo xtask
# lint-proofs` checks the half that is local: that this file still holds a
# schedule, still runs `cargo xtask prove`, still names the checker's image,
# and that exactly one job depends on that image. It is the difference between
# a clause somebody verified once and a clause the gate re-verifies.
#
# ## Why the run is a pair, like every other harness in this file
#
# `cargo xtask prove` verifies every harness in both crates — the count is on
# its own first line, so read it there rather than here — and then arms the
# deliberate defects, the same ones `cargo xtask mutate`, `hostile` and
# `entries` arm for a boot or a fuzzer, and requires each to *fail* the
# harness that states the property it breaks, where it breaks it. Their count
# is on the verb's own last line for the same reason the harness count is:
# a number written here is one nothing keeps true, and the last one was
# already wrong. A proof that
# passes on a build with a known defect in the code it is about is not a proof
# of anything, and it is the way this job would rot: a `#[path]` that stopped
# reaching `kernel/src/cap.rs`, or a `ring/proofs` that started proving a copy
# of `f-ring` rather than the crate, would leave green harnesses verifying
# code nobody runs. Every half is inside the one verb rather than in separate
# steps, because they have to fail together or the pair means nothing.
# RFC 0017, RFC 0053, RFC 0057.
#
# The ring's proofs also carry `kani::cover!` for every answer a harness can
# produce, and an unsatisfiable cover is a *failed* verification. That is the
# failure mode a proof over arbitrary bytes has and a proof over arbitrary
# handles does not: a fixture whose region is never adopted verifies instantly
# and proves nothing.
#
# The checker does not enforce that and this job would be green if it were
# left to: Kani prints `1 of 2 cover properties satisfied (1 unreachable)` and
# then `VERIFICATION:- SUCCESSFUL`, exit 0. `cargo xtask prove` reads the
# count out of every report and refuses on it, which is what makes the
# sentence above a property of this job rather than a hope about it. The
# satisfied count is printed beside each harness too, so a run that lost a
# cover is readable in this job's artifact and not only in its exit status.
#
# ## What it does *not* do
#
# It opens no issue *of its own*. The sweep above does, because a finding there
# is a seed nobody can reproduce from the log alone; a failed proof is a
# counterexample Kani prints in full, and `--concrete-playback` turns it into a
# test case. The report is kept as an artifact for ninety days and the job goes
# red, which is what a deterministic failure on a fixed input needs and no more.
#
# That paragraph is right about the *content* of a notification and was taken
# for three epochs as settling whether to send one. It does not: whether a
# report explains itself and whether anybody reads it are different questions,
# and this file answered the first three times while the second went unanswered
# twice — `docs/postmortem/0002` and `0003`. The `alarm` job at the bottom is
# the floor under every job here, including this one, and it changes nothing
# about this job. RFC 0122.
prove:
name: the capability properties, the ring's validation paths and the frame's
watermark, proved
needs: [environment, image_full]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image_full }}
steps:
- uses: actions/checkout@v7
- name: three crates, and the deliberate defects that must break them
run: |
set -o pipefail
cargo xtask prove 2>&1 | tee prove-report.txt
# The second checker, in this job and not in one of its own. `image_full`
# is the only image either of them exists in, it is built by fetching a
# crate and two releases at image-build time, and `xtask`'s
# `proof_schedule` refuses to let more than one job depend on it — every
# job waiting on that image is a job the checkers' toolchains can take
# down, and the sweep, the two fuzzers and the Miri job assert things that
# have nothing to do with a proof. Two checkers behind one image is one
# blast radius; two jobs would be two.
#
# What it adds that the step above cannot reach: `kernel/proofs/src/mem.rs`
# sets `FRAME_SIZE` to 256 and the harnesses run an eight-slot table, so a
# `u64` overflow is outside Kani's space and always will be. Both
# preconditions `kernel/src/watermark.rs` now states were found by a
# deductive checker and neither is reachable by a bounded one. RFC 0096.
- name: the frame's watermark over every u64, and the defect that must refute it
run: |
set -o pipefail
cargo xtask verus 2>&1 | tee verus-report.txt
- name: keep the reports
if: always()
uses: actions/upload-artifact@v4
with:
name: prove-report
path: |
prove-report.txt
verus-report.txt
retention-days: 90
if-no-files-found: error
# The re-chunking claim, and it is a job of its own rather than a step in
# `gating-claims` because it is the one gating claim that is neither
# boot-heavy nor quick: two 128 MiB objects and an 8 MiB one, five content
# mixtures, two seeds, both object kinds, and every edit on the extent kind
# submitted across a real objects ring. Minutes of hashing, and a red night
# should name it in the job rather than in the eleventh step of another one.
#
# ## Why this arrived on 2026-09-21 and not earlier
#
# `claims/0017` was `pending` for two epochs, on a denominator: the ratio is
# *per application byte written* and `intent/0006-state/spec.md` defines an
# application byte as one the client submitted **on the objects ring**, while
# the bench computed `edits * WRITE_BYTES` for itself. `E2-B09` closed that —
# both halves of the ratio now come off `f_objects::Served` — so the claim
# gates, and a gating claim no workflow compares is what
# `cargo xtask lint-claim-runs` exists to refuse.
#
# ## What a red night here means
#
# `claims/0017`'s `[diagnosis]` table names what each row implies, and the
# first sentence of it is the one to read: a bound moves only by an RFC
# carrying the measurement that moved it. Three have looked — RFC 0061, 0062
# and 0064 — and every one of them left the 786 432 where it was.
rechunk:
name: bytes re-chunked per application byte, on both object kinds
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
- name: both workloads, and every threshold compared
run: |
set -o pipefail
cargo xtask claim bytes-rechunked-per-byte 2>&1 | tee rechunk-report.txt
- name: keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: rechunk-report
path: rechunk-report.txt
retention-days: 90
if-no-files-found: error
# `claims/0030` is `gating`, and until this job existed nothing ran it.
#
# ## Why it is here rather than in `verify` or in `ci`
#
# Cost, and only cost. `cargo xtask rollback` is three generation builds and
# six boots — about five minutes in the development container — which is the
# reason the claim's own `[workload]` gives for keeping it out of the local
# loop, and the reason it is out of the pull-request gate too: neither is a
# place to spend five minutes on a property that changes when a *format*
# changes rather than when a line of code does. A schedule is where an
# expensive gating claim belongs, and `xtask/src/main.rs` states the rule this
# job answers: *a gating claim that nothing in the local loop runs is a claim
# that gates nothing*. Half of gate G2 rested on a command nobody ran.
#
# ## Why it runs the claim's command and not the workload
#
# `cargo xtask claim rollback-comparisons` is the reproduction line in the
# claim file, and it runs the workload *and compares every row against the
# `[threshold]` table*. `cargo xtask rollback` alone would go green on a run
# that made two comparisons instead of three, because the harness's own
# refusals and the claim's thresholds are two different checks — RFC 0064 is
# the entry that decides a threshold nobody compares against is not a
# threshold.
#
# ## What a red night here means
#
# Read `claims/0030`'s `[diagnosis]` before anything else: it names what each
# row going red implies, written while the system was understood. The report
# is kept as an artifact rather than opened as an issue *by this job*, for the
# `cut` job's reason — a failure here is deterministic on a fixed input and
# reproduces from the command in the claim, so there is nothing a notification
# would carry that the report does not.
#
# This is the job that proved that argument answers the wrong question. It went
# red at 03:11 UTC on 2026-09-23, nobody read it for a day, and the repair was
# already committed on a branch — `docs/postmortem/0003`, the second time a red
# schedule went unread. The report did carry everything; nobody opened it. The
# `alarm` job at the bottom of this file is what changed, and this job's own
# argument stands unedited above. RFC 0122.
rollback:
name: a generation broken, rolled back, and compared three ways
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
- name: three generation builds, six boots, and every threshold compared
run: |
set -o pipefail
cargo xtask claim rollback-comparisons 2>&1 | tee rollback-report.txt
- name: keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: rollback-report
path: rollback-report.txt
retention-days: 90
if-no-files-found: error
# The other four gating claims whose comparison needs a boot.
#
# The job above already made this argument for one claim and it generalises:
# *a gating claim that nothing in the local loop runs is a claim that gates
# nothing*, and RFC 0064 is the entry deciding that a threshold nobody
# compares against is not a threshold. What that argument had not been
# applied to is the rest of the registry.
#
# Sixteen of seventeen gating claims were compared to their bounds by nothing
# at all. Their workloads ran — `attest`, `swap`, `compare` and the two
# generation verbs all exist and all assert their own internal invariants —
# but the number the claim publishes was read by no job, so `gating` meant
# *fails the build on regression* about claims no build could fail on.
# `cargo xtask lint-claim-runs` is what makes that a red build rather than a
# thing somebody notices.
#
# Eleven went into the pull-request gate, where their comparison costs a host
# run or a workload the gate already pays for. These four are here for the
# rollback job's reason and no other: `attest` is five boots, `compare` is
# two, `swap` replaces every component under load, and the two generation
# comparisons build a generation each. A pull-request gate is not where five
# minutes go for a property that moves when a format moves.
#
# They are separate steps rather than one script so a red night names the
# claim in the step title, and `continue-on-error` is deliberately absent: a
# bound this tree publishes and does not meet should stop the night.
gating-claims:
name: every boot-heavy gating claim, against its own thresholds
needs: [environment, image]
runs-on: ubuntu-latest
container: ${{ needs.environment.outputs.image }}
steps:
- uses: actions/checkout@v7
- name: what this machine is running, five boots
run: cargo xtask claim frame-identities-across-boots
- name: two whole-system states, and the subtree they differ in
run: cargo xtask claim whole-system-divergences-localised
- name: every component replaced under sustained load
run: cargo xtask claim operations-across-a-place-swap
- name: one topology rendered from one root
run: cargo xtask claim topology-renderings-per-root
- name: the generation root across two checkout paths
run: cargo xtask claim generation-roots-across-paths
# A red schedule is loud, and until this job existed it was not.
#
# ## The incident this answers, which is the second of its kind
#
# The `rollback` job went red at 03:11 UTC on 2026-09-23 and nobody read it
# for a day. `docs/postmortem/0003` is the record, and the part that makes it
# worth a mechanism rather than an apology is what the day cost: the repair
# had already been committed — on a branch, the day *before* the run — so the
# schedule reported a defect nobody could connect to its fix. Before that,
# `docs/postmortem/0002`: five consecutive red nights, unread, in which the
# one job built to reach a person was itself the broken one. `CLAUDE.md`'s
# *Common mistakes* gained the line on 2026-09-24, and `TODO.md`'s **A-06**
# said in as many words that the mechanism was earned and not built. This is
# the mechanism.
#
# ## Why a job and not a step
#
# Because the failure this file has actually had was a job that never started.
# The `sweep` job's `open an issue for it` step could not run on five red
# nights: naming `permissions:` there dropped `packages: read`, the container
# could not be pulled, and `if: failure()` cannot run a step inside a job that
# does not exist. A step can only report the job it is in. This one is outside
# every job it watches, so a job that failed to *start* is `failure` in its
# `needs` context and is reported like any other.
#
# ## Why it is not in the container
#
# Same reason, one level down. The image is a thing that can fail, and a
# watcher that needs the image cannot report the image failing. `ubuntu-latest`
# carries `gh`, `jq`, `awk` and `sed`, which is everything below.
#
# ## Why these three permissions and not a broader set
#
# A job that names `permissions:` replaces the default set rather than adding
# to it, so this list is exhaustive and each row is here for one call:
#
# contents: read checkout, and one API read of the default branch's head
# actions: read the failing job's log, which is where the first line is
# issues: write open, comment, close — the whole point
#
# Deliberately absent: `packages:`, because this pulls no image;
# `contents: write`, because this commits nothing and a machine that can open
# an issue should not also be able to push; `pull-requests:`, for the same
# reason one level over. `maintain.yml` is the file in this repository that
# does hold `contents: write`, and it holds it to push a branch a person then
# reads — a different job with a different argument.
#
# ## What it says, and why that and not a summary
#
# `docs/postmortem/0003`'s finding was not *nobody was told*. It was *the fix
# already existed and the notification could not have said so*. So the body
# carries the job, the commit the run tested, the first failing line, a link —
# and, when the default branch has moved past the commit under test, the
# `git log --oneline <sha>..<branch>` that would have closed that incident in
# a minute. `ops/alarm.sh` builds all of it and is tested against fixtures in
# `cargo xtask test`; the three `gh` calls below are the half only a real
# failure can exercise, and that is stated rather than implied.
#
# ## The second consecutive failure, and what closes the issue
#
# Both are the question A-06 is really about, because both are how a
# mechanism becomes muted without anybody choosing to mute it.
#
# A second issue for the same failure is noise, and noise is what a reader
# learns to skip. So the title is a signature — the workflow and the sorted
# set of failing jobs — and a night that finds the same set again comments on
# the open thread. A *different* set is a different title and a different
# thread, which is right: two failures are two findings.
#
# And a green run closes what it opened. A stale issue is the same training in
# the other direction: a reader who learns that these issues outlive their
# defects has learned to ignore them. The close is a comment and a close on
# every open thread whose title this workflow could have written, and the
# comment says which run closed it, so the thread reads as a story rather than
# as a thing that went quiet.
#
# ## What this does not do
#
# It does not replace the two issue-opening steps above it. The `sweep` job
# opens an issue titled with the smallest reproduction it found, and that is a
# better title than this job can construct from a job name; same for the
# weekly comparison's named leaf. Those stay, and this is the floor under
# everything they do not cover — which, until today, was every other job in
# this file.
#
# It also cannot report itself. If this job fails, nothing opens an issue about
# that, and no job in a workflow can watch itself. What covers it instead is
# the local half: `cargo xtask lint-schedules` runs in `verify` and in the
# pull-request gate and refuses a scheduled workflow whose alarm does not name
# every other job in its file, so the way this rots — somebody adds a job and
# forgets this list — is a red pull request rather than a silence.
#
# And it reads `ops/alarm.sh` out of the commit under test, so a commit that
# breaks that script silences its own alarm. That is the residue, it is named
# here rather than discovered, and it is why the script has tests that run per
# commit.
alarm:
name: a red run says so in this repository
needs:
[
environment,
image,
image_full,
harness,
sweep,
join,
hostile,
cut,
miri,
entries,
prove,
rechunk,
rollback,
gating-claims,
]
# Not `failure()`. This job has to run on a green night too, because closing
# a stale issue is half of what it is for.
if: always()
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
issues: write
steps:
- uses: actions/checkout@v7
- name: what happened, and what to say about it
env:
GH_TOKEN: ${{ github.token }}
NEEDS: ${{ toJSON(needs) }}
ALARM_JOBS: alarm/jobs.tsv
ALARM_WORKFLOW: nightly
ALARM_SHA: ${{ github.sha }}
ALARM_BRANCH: ${{ github.event.repository.default_branch }}
ALARM_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
ALARM_LOG: alarm/log.txt
ALARM_OUT: alarm
run: |
mkdir -p alarm
# The `needs` context is the only place a job can read its siblings'
# conclusions, and it arrives as JSON with each job's outputs in it —
# `maintain.yml`'s `detect` puts a whole report in one — so this is jq
# and not sed. One expression, and the table it writes is the only
# thing ops/alarm.sh reads.
printf '%s' "$NEEDS" | jq -r 'to_entries[] | "\(.key)\t\(.value.result)"' > alarm/jobs.tsv
cat alarm/jobs.tsv
# The failing jobs' logs, per job rather than per run. The run-level
# archive `gh run view --log-failed` downloads is not served until the
# whole run has finished, and this job is part of the run — so asking
# for it here is asking for a 404. The per-job endpoint is served as
# soon as the job is, which is the property that makes this readable
# from inside the run it is about.
#
# Every line tagged with its job's name and id, tab-separated, so that
# ops/alarm.sh can quote a headline and an excerpt from one job and say
# which. Untagged, two failures were one undifferentiated log and the
# excerpt could be about the other job.
: > alarm/log.txt
gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/jobs?per_page=100" \
--jq '.jobs[] | select(.conclusion == "failure") | "\(.id)\t\(.name)"' \
> alarm/failed.tsv || true
while IFS=$'\t' read -r id name; do
gh api "repos/$GITHUB_REPOSITORY/actions/jobs/$id/logs" |
awk -v job="$name" -v id="$id" '{ print job "\t" id "\t" $0 }' >> alarm/log.txt || true
done < alarm/failed.tsv
# The head of the default branch, read now rather than at queue time.
# This is the one line post-mortem 0003 is about: when it differs from
# the commit under test, the repair may already be written, and the
# body says so with the range to read.
ALARM_HEAD=$(gh api "repos/$GITHUB_REPOSITORY/commits/$ALARM_BRANCH" --jq .sha || true) \
bash ops/alarm.sh
# The run summary carries the whole body whether or not anything is
# posted, which is what makes a `dry-run` dispatch worth running.