forked from LOOHP/InteractionVisualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupstream-runtime-comparison.yml
More file actions
1657 lines (1587 loc) · 83.4 KB
/
Copy pathupstream-runtime-comparison.yml
File metadata and controls
1657 lines (1587 loc) · 83.4 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: Upstream Runtime Comparison
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: upstream-runtime-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
prepare-upstream-runtime:
name: Prepare immutable comparison stack
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.action != 'labeled' ||
github.event.label.name == 'upstream-runtime-formal'
runs-on: ubuntu-latest
timeout-minutes: 15
env:
UPSTREAM_BUILD_NUMBER: "163"
UPSTREAM_SOURCE_SHA: c7f9dd0457451537653bf4b4c0eb0e4298c51187
UPSTREAM_ARTIFACT_SIZE: "5799385"
UPSTREAM_ARTIFACT_SHA256: a7ffc2ba053c74681feabc698e9fdb959ebd4f8252206fedd8801979e3de30c0
PRODUCTION_CANDIDATE_SHA: c28db0146ec2f35eaf066b4202b33f08d06bbc4b
PAPER_BUILD: "74"
PAPER_SHA256: 1d70b1dab9cf4a6de615209a536f3a45a2186240253c428213ce2188ab95e5f7
PAPER_ARTIFACT_SIZE: "52893229"
PAPER_ARTIFACT_URL: https://fill-data.papermc.io/v1/objects/1d70b1dab9cf4a6de615209a536f3a45a2186240253c428213ce2188ab95e5f7/paper-26.1.2-74.jar
COMPARE_RUNTIME_PROFILE: optimized-candidate
EXPECTED_HARNESS_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
steps:
- name: Check out candidate head
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Set up Java 25
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "25"
- name: Set up Node 24
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Validate comparison harness sources
run: |
set -euo pipefail
bash -n tools/perf/prepare-phase2-protocol-client.sh
bash -n tools/perf/run-upstream-runtime-once.sh
node --check tools/perf/phase2-protocol-client.js
node --check tools/perf/analyze-phase2-protocol-trace.js
node tools/perf/analyze-phase2-protocol-trace.js --self-test
pwsh -NoProfile -File tools/perf/analyze-phase2-abba.ps1 -SelfTest
- name: Build and test comparison harness once
run: ./gradlew clean check runtimeComparisonJar --no-daemon --no-build-cache --rerun-tasks
- name: Build fixed production candidate once
run: |
set -euo pipefail
PRODUCTION_WORKTREE="$RUNNER_TEMP/interactionvisualizer-production-b3c2453"
printf 'PRODUCTION_WORKTREE=%s\n' "$PRODUCTION_WORKTREE" >> "$GITHUB_ENV"
git cat-file -e "$PRODUCTION_CANDIDATE_SHA^{commit}"
[[ ! -e "$PRODUCTION_WORKTREE" ]]
git worktree add --detach "$PRODUCTION_WORKTREE" "$PRODUCTION_CANDIDATE_SHA"
[[ "$(git -C "$PRODUCTION_WORKTREE" rev-parse HEAD)" == "$PRODUCTION_CANDIDATE_SHA" ]]
(
cd "$PRODUCTION_WORKTREE"
./gradlew clean shadowJar --no-daemon --no-build-cache --rerun-tasks
)
- name: Select candidate artifacts and canonical configuration
run: |
set -euo pipefail
[[ "$COMPARE_RUNTIME_PROFILE" == optimized-candidate ]]
mkdir -p compare-dependencies
mapfile -t candidate_jars < <(find "$PRODUCTION_WORKTREE/build/libs" -maxdepth 1 -type f \
-name 'InteractionVisualizer-*.jar' \
! -name '*-sources.jar' \
! -name '*-benchmark.jar' \
! -name '*-runtime-compare.jar' | sort)
mapfile -t driver_jars < <(find build/libs -maxdepth 1 -type f \
-name 'InteractionVisualizer-*-runtime-compare.jar' | sort)
[[ "${#candidate_jars[@]}" == 1 ]] || {
printf 'Expected one candidate JAR, found %s\n' "${#candidate_jars[@]}" >&2
printf '%s\n' "${candidate_jars[@]}" >&2
exit 1
}
[[ "${#driver_jars[@]}" == 1 ]] || {
printf 'Expected one runtime comparison driver, found %s\n' "${#driver_jars[@]}" >&2
printf '%s\n' "${driver_jars[@]}" >&2
exit 1
}
cp "${candidate_jars[0]}" compare-dependencies/rewrite.jar
cp "${driver_jars[0]}" compare-dependencies/runtime-comparison-driver.jar
unzip -p compare-dependencies/rewrite.jar config.yml \
> compare-dependencies/canonical-config.yml
python3 - compare-dependencies/canonical-config.yml <<'PY'
from pathlib import Path
import os
import re
import sys
path = Path(sys.argv[1])
text = path.read_text(encoding="utf-8")
for key in ("Updater", "DownloadLanguageFiles"):
pattern = rf"(?m)^(\s*{key}:\s*)true\s*$"
text, count = re.subn(pattern, rf"\1false", text)
if count != 1:
raise SystemExit(f"Expected exactly one true {key} setting, found {count}")
runtime_profile = os.environ["COMPARE_RUNTIME_PROFILE"]
if runtime_profile not in {"legacy-parity", "optimized-candidate"}:
raise SystemExit(f"Unsupported runtime profile: {runtime_profile!r}")
requested_value = "true" if runtime_profile == "optimized-candidate" else "false"
for key in ("PacketOnlyStatic", "EventDriven"):
pattern = rf"(?m)^(\s*{key}:\s*)(?:true|false)\s*$"
text, count = re.subn(pattern, rf"\g<1>{requested_value}", text)
if count != 1:
raise SystemExit(f"Expected exactly one {key} setting, found {count}")
path.write_text(text, encoding="utf-8", newline="\n")
PY
test -s compare-dependencies/canonical-config.yml
- name: Download and verify official upstream once
env:
JENKINS_BUILD_URL: https://ci.loohpjames.com/job/InteractionVisualizer/163
run: |
set -euo pipefail
api_url="$JENKINS_BUILD_URL/api/json?tree=number,result,actions[lastBuiltRevision[SHA1]],artifacts[fileName,relativePath]"
artifact_url="$JENKINS_BUILD_URL/artifact/common/target/InteractionVisualizer-2026.1.2.0.jar"
curl --globoff --fail --location --show-error --silent \
--retry 10 --retry-all-errors --retry-max-time 300 --connect-timeout 30 \
--output compare-dependencies/upstream-build-163.json "$api_url"
python3 - compare-dependencies/upstream-build-163.json \
"$UPSTREAM_BUILD_NUMBER" "$UPSTREAM_SOURCE_SHA" <<'PY'
import json
import sys
path, expected_number, expected_revision = sys.argv[1:]
data = json.load(open(path, encoding="utf-8"))
revisions = {
action.get("lastBuiltRevision", {}).get("SHA1")
for action in data.get("actions", [])
if isinstance(action, dict) and isinstance(action.get("lastBuiltRevision"), dict)
}
revisions.discard(None)
artifacts = {
(artifact.get("fileName"), artifact.get("relativePath"))
for artifact in data.get("artifacts", [])
if isinstance(artifact, dict)
}
expected_artifact = (
"InteractionVisualizer-2026.1.2.0.jar",
"common/target/InteractionVisualizer-2026.1.2.0.jar",
)
if data.get("number") != int(expected_number):
raise SystemExit(f"Jenkins build number mismatch: {data.get('number')!r}")
if data.get("result") != "SUCCESS":
raise SystemExit(f"Jenkins build is not successful: {data.get('result')!r}")
if revisions != {expected_revision}:
raise SystemExit(f"Jenkins source revision mismatch: {sorted(revisions)!r}")
if expected_artifact not in artifacts:
raise SystemExit(f"Jenkins artifact is absent: {sorted(artifacts)!r}")
PY
curl --fail --location --show-error \
--retry 10 --retry-all-errors --retry-max-time 300 --connect-timeout 30 \
--output compare-dependencies/upstream.jar "$artifact_url"
[[ "$(stat -c '%s' compare-dependencies/upstream.jar)" == "$UPSTREAM_ARTIFACT_SIZE" ]]
printf '%s %s\n' "$UPSTREAM_ARTIFACT_SHA256" compare-dependencies/upstream.jar \
| sha256sum --check --strict
unzip -p compare-dependencies/upstream.jar plugin.yml | tr -d '\r' \
> compare-dependencies/upstream-plugin.yml
grep -Fxq 'name: InteractionVisualizer' compare-dependencies/upstream-plugin.yml
grep -Fxq 'version: 2026.1.2.0' compare-dependencies/upstream-plugin.yml
grep -Fxq 'main: com.loohp.interactionvisualizer.InteractionVisualizer' \
compare-dependencies/upstream-plugin.yml
- name: Download and verify Paper once
env:
PAPER_USER_AGENT: InteractionVisualizer-Upstream-Comparison/1.0 (https://github.com/EllanServer/InteractionVisualizer)
run: |
set -euo pipefail
expected_url="https://fill-data.papermc.io/v1/objects/$PAPER_SHA256/paper-26.1.2-74.jar"
[[ "$PAPER_ARTIFACT_URL" == "$expected_url" ]]
[[ "$PAPER_ARTIFACT_SIZE" =~ ^[0-9]+$ ]] && (( PAPER_ARTIFACT_SIZE > 0 ))
python3 - compare-dependencies/paper-build-74.json \
"$PAPER_BUILD" "$PAPER_SHA256" "$PAPER_ARTIFACT_SIZE" \
"$PAPER_ARTIFACT_URL" <<'PY'
from pathlib import Path
import json
import sys
output, build, sha, size, url = sys.argv[1:]
Path(output).write_text(json.dumps({
"id": int(build),
"time": "2026-07-06T16:51:09Z",
"channel": "STABLE",
"commits": [],
"downloads": {
"server:default": {
"name": "paper-26.1.2-74.jar",
"checksums": {"sha256": sha},
"size": int(size),
"url": url,
}
},
"metadataSource": "pinned-from-verified-Paper-build-74-response",
}, indent=2) + "\n", encoding="utf-8")
PY
curl --fail --location --show-error \
--retry 10 --retry-all-errors --retry-max-time 300 --connect-timeout 30 \
-H "User-Agent: $PAPER_USER_AGENT" \
--output compare-dependencies/paper.jar "$PAPER_ARTIFACT_URL"
[[ "$(stat -c '%s' compare-dependencies/paper.jar)" == "$PAPER_ARTIFACT_SIZE" ]]
printf '%s %s\n' "$PAPER_SHA256" compare-dependencies/paper.jar \
| sha256sum --check --strict
- name: Prepare immutable protocol client once
run: bash tools/perf/prepare-phase2-protocol-client.sh compare-dependencies/protocol-client
- name: Seal prepared comparison stack
run: |
set -euo pipefail
harness_source_sha=$(git rev-parse HEAD)
candidate_source_sha=$(git -C "$PRODUCTION_WORKTREE" rev-parse HEAD)
[[ "$harness_source_sha" == "$EXPECTED_HARNESS_SHA" ]]
[[ "$candidate_source_sha" == "$PRODUCTION_CANDIDATE_SHA" ]]
sha256sum \
compare-dependencies/upstream.jar \
compare-dependencies/rewrite.jar \
compare-dependencies/runtime-comparison-driver.jar \
compare-dependencies/canonical-config.yml \
compare-dependencies/paper.jar \
compare-dependencies/protocol-client/client-build-manifest.json \
> compare-dependencies/prepared-files.sha256
python3 - compare-dependencies/prepared-stack.json \
"$harness_source_sha" "$candidate_source_sha" "$COMPARE_RUNTIME_PROFILE" \
"$UPSTREAM_SOURCE_SHA" "$UPSTREAM_ARTIFACT_SHA256" "$PAPER_SHA256" <<'PY'
from pathlib import Path
import json
import sys
output, harness, candidate, profile, upstream_source, upstream_sha, paper_sha = sys.argv[1:]
Path(output).write_text(json.dumps({
"schemaVersion": 1,
"harnessSourceSha": harness,
"candidateSourceSha": candidate,
"runtimeProfile": profile,
"upstreamSourceSha": upstream_source,
"upstreamArtifactSha256": upstream_sha,
"paperSha256": paper_sha,
"distribution": "single-build-artifact",
}, indent=2) + "\n", encoding="utf-8")
PY
- name: Package prepared comparison stack
run: |
set -euo pipefail
mkdir prepared-transfer
tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner \
-czf prepared-transfer/comparison-stack.tar.gz compare-dependencies
sha256sum prepared-transfer/comparison-stack.tar.gz \
> prepared-transfer/comparison-stack.sha256
- name: Upload prepared comparison stack
uses: actions/upload-artifact@v4
with:
name: upstream-runtime-prepared-${{ github.run_id }}
path: prepared-transfer
if-no-files-found: error
retention-days: 1
compare-upstream-runtime:
name: Paper 26.1.2-74 ${{ matrix.scenario }} run ${{ matrix.run_number }}
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.action != 'labeled' ||
github.event.label.name == 'upstream-runtime-formal'
runs-on: ubuntu-latest
needs: prepare-upstream-runtime
timeout-minutes: 20
strategy:
fail-fast: false
max-parallel: 24
matrix:
scenario: [dropped-items, block-active]
run_number: ${{ fromJSON((github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '[1,2,3,4,5,6,7,8,9,10,11,12]' || '[1,2,3,4]') }}
env:
UPSTREAM_BUILD_NUMBER: "163"
UPSTREAM_SOURCE_SHA: c7f9dd0457451537653bf4b4c0eb0e4298c51187
UPSTREAM_ARTIFACT_SIZE: "5799385"
UPSTREAM_ARTIFACT_SHA256: a7ffc2ba053c74681feabc698e9fdb959ebd4f8252206fedd8801979e3de30c0
PRODUCTION_CANDIDATE_SHA: c28db0146ec2f35eaf066b4202b33f08d06bbc4b
PAPER_BUILD: "74"
PAPER_SHA256: 1d70b1dab9cf4a6de615209a536f3a45a2186240253c428213ce2188ab95e5f7
COMPARE_RUNTIME_PROFILE: optimized-candidate
CAMPAIGN_KIND: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && 'formal' || 'smoke' }}
CAMPAIGN_RUNS: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '12' || '4' }}
CAMPAIGN_WARMUP_SECONDS: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '60' || '10' }}
CAMPAIGN_SETTLE_SECONDS: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '20' || '5' }}
CAMPAIGN_MEASURE_SECONDS: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '120' || '10' }}
CAMPAIGN_SCENARIO: ${{ matrix.scenario }}
# The 1024-block stress campaign is retained separately as stability
# evidence: official upstream lost its observer in 6/6 formal A runs.
# Use a still-heavy stable regime here so both sides produce valid CPU data.
CAMPAIGN_SCENE_SIZE: ${{ matrix.scenario == 'dropped-items' && '512' || '256' }}
CAMPAIGN_RUN_NUMBER: ${{ matrix.run_number }}
EXPECTED_HARNESS_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
steps:
- name: Check out candidate head
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Set up Java 25
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "25"
- name: Set up Node 24
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Distribute prepared comparison stack locally
uses: actions/download-artifact@v4
with:
name: upstream-runtime-prepared-${{ github.run_id }}
path: prepared-transfer
- name: Verify and unpack prepared comparison stack
run: |
set -euo pipefail
sha256sum --check --strict prepared-transfer/comparison-stack.sha256
tar -xzf prepared-transfer/comparison-stack.tar.gz
- name: Establish immutable campaign provenance
run: |
set -euo pipefail
sha256sum --check --strict compare-dependencies/prepared-files.sha256
(
cd compare-dependencies/protocol-client
sha256sum --check --strict client-files.sha256
)
python3 - compare-dependencies/prepared-stack.json \
"$EXPECTED_HARNESS_SHA" "$PRODUCTION_CANDIDATE_SHA" \
"$COMPARE_RUNTIME_PROFILE" "$UPSTREAM_SOURCE_SHA" \
"$UPSTREAM_ARTIFACT_SHA256" "$PAPER_SHA256" <<'PY'
import json
import sys
source, harness, candidate, profile, upstream_source, upstream_sha, paper_sha = sys.argv[1:]
data = json.load(open(source, encoding="utf-8"))
expected = {
"schemaVersion": 1,
"harnessSourceSha": harness,
"candidateSourceSha": candidate,
"runtimeProfile": profile,
"upstreamSourceSha": upstream_source,
"upstreamArtifactSha256": upstream_sha,
"paperSha256": paper_sha,
"distribution": "single-build-artifact",
}
if data != expected:
raise SystemExit(f"prepared comparison stack mismatch: {data!r} != {expected!r}")
PY
read -r available_cpu_count server_cpu_set client_cpu_set < <(
python3 - <<'PY'
import os
cpus = sorted(os.sched_getaffinity(0))
if len(cpus) < 3:
raise SystemExit(f"At least three logical CPUs are required; found {cpus!r}")
print(len(cpus), ",".join(map(str, cpus[:-1])), cpus[-1])
PY
)
harness_source_sha=$(git rev-parse HEAD)
[[ "$harness_source_sha" == "$EXPECTED_HARNESS_SHA" ]]
candidate_source_sha="$PRODUCTION_CANDIDATE_SHA"
[[ "$candidate_source_sha" == "$PRODUCTION_CANDIDATE_SHA" ]]
rewrite_sha=$(sha256sum compare-dependencies/rewrite.jar | awk '{print $1}')
driver_sha=$(sha256sum compare-dependencies/runtime-comparison-driver.jar | awk '{print $1}')
config_sha=$(sha256sum compare-dependencies/canonical-config.yml | awk '{print $1}')
client_sha=$(sha256sum compare-dependencies/protocol-client/client-build-manifest.json | awk '{print $1}')
runner_sha=$(sha256sum tools/perf/run-upstream-runtime-once.sh | awk '{print $1}')
protocol_source_sha=$(sha256sum tools/perf/phase2-protocol-client.js | awk '{print $1}')
protocol_analyzer_sha=$(sha256sum tools/perf/analyze-phase2-protocol-trace.js | awk '{print $1}')
jvm_fingerprint='-Xms4G -Xmx4G -XX:+UseG1GC -XX:+AlwaysPreTouch -Xlog:gc*=info,safepoint=info:file=jvm-gc-safepoint.log:time,uptime,level,tags:filecount=0 -Dfile.encoding=UTF-8'
jvm_sha=$(printf '%s' "$jvm_fingerprint" | sha256sum | awk '{print $1}')
stack_sha=$(
{
sha256sum \
compare-dependencies/paper.jar \
compare-dependencies/runtime-comparison-driver.jar \
compare-dependencies/canonical-config.yml \
compare-dependencies/protocol-client/client-build-manifest.json \
tools/perf/run-upstream-runtime-once.sh \
tools/perf/phase2-protocol-client.js \
tools/perf/analyze-phase2-protocol-trace.js \
tools/perf/analyze-phase2-abba.ps1
java -version 2>&1
node --version
printf '%s\n' \
"jvm=$jvm_fingerprint" \
"scenario=$CAMPAIGN_SCENARIO" \
"sceneSize=$CAMPAIGN_SCENE_SIZE" \
"warmup=$CAMPAIGN_WARMUP_SECONDS" \
"settle=$CAMPAIGN_SETTLE_SECONDS" \
"measure=$CAMPAIGN_MEASURE_SECONDS" \
'preflightWarmup=10' 'preflightSettle=5' 'preflightMeasure=10' \
'paper=26.1.2-74' 'client=26.1.2' \
'networkTimeoutSeconds=300' \
'protocolClientKeepAliveTimeoutMs=300000' \
"availableCpuCount=$available_cpu_count" \
"serverCpuSet=$server_cpu_set" \
"clientCpuSet=$client_cpu_set"
printf '%s\n' \
"runtimeProfile=$COMPARE_RUNTIME_PROFILE" \
'samplingMode=independent-runners' \
'dependencyDistribution=single-build-artifact' \
'requestedPacketOnlyStatic=true' \
'requestedEventDrivenBlockUpdates=true'
printf '%s\n' "harnessSourceSha=$harness_source_sha"
} | sha256sum | awk '{print $1}'
)
[[ "$rewrite_sha" != "$UPSTREAM_ARTIFACT_SHA256" ]]
{
printf 'CANDIDATE_SOURCE_SHA=%s\n' "$candidate_source_sha"
printf 'REWRITE_ARTIFACT_SHA256=%s\n' "$rewrite_sha"
printf 'DRIVER_SHA256=%s\n' "$driver_sha"
printf 'CANONICAL_CONFIG_SHA256=%s\n' "$config_sha"
printf 'CLIENT_MANIFEST_SHA256=%s\n' "$client_sha"
printf 'RUNNER_SHA256=%s\n' "$runner_sha"
printf 'PROTOCOL_SOURCE_SHA256=%s\n' "$protocol_source_sha"
printf 'PROTOCOL_ANALYZER_SHA256=%s\n' "$protocol_analyzer_sha"
printf 'JVM_ARGUMENTS_SHA256=%s\n' "$jvm_sha"
printf 'CAMPAIGN_STACK_SHA256=%s\n' "$stack_sha"
printf 'AVAILABLE_CPU_COUNT=%s\n' "$available_cpu_count"
printf 'SERVER_CPU_SET=%s\n' "$server_cpu_set"
printf 'CLIENT_CPU_SET=%s\n' "$client_cpu_set"
} >> "$GITHUB_ENV"
python3 - compare-dependencies/campaign-provenance.json \
"$candidate_source_sha" "$rewrite_sha" "$driver_sha" "$config_sha" \
"$client_sha" "$runner_sha" "$protocol_source_sha" \
"$protocol_analyzer_sha" "$jvm_sha" "$stack_sha" \
"$CAMPAIGN_SCENARIO" "$CAMPAIGN_SCENE_SIZE" "$CAMPAIGN_KIND" \
"$CAMPAIGN_RUNS" "$CAMPAIGN_WARMUP_SECONDS" \
"$CAMPAIGN_SETTLE_SECONDS" "$CAMPAIGN_MEASURE_SECONDS" \
"$UPSTREAM_BUILD_NUMBER" "$UPSTREAM_SOURCE_SHA" \
"$UPSTREAM_ARTIFACT_SHA256" "$PAPER_BUILD" "$PAPER_SHA256" \
"$available_cpu_count" "$server_cpu_set" "$client_cpu_set" \
"$harness_source_sha" "$COMPARE_RUNTIME_PROFILE" <<'PY'
from pathlib import Path
import json
import sys
(
output, candidate_source, rewrite_sha, driver_sha, config_sha,
client_sha, runner_sha, protocol_source_sha, protocol_analyzer_sha,
jvm_sha, stack_sha, scenario, scene_size, kind, runs, warmup,
settle, measure, upstream_build, upstream_source, upstream_sha,
paper_build, paper_sha, available_cpu_count, server_cpu_set,
client_cpu_set, harness_source_sha, runtime_profile,
) = sys.argv[1:]
Path(output).write_text(json.dumps({
"schemaVersion": 1,
"campaignKind": kind,
"scenario": scenario,
"sceneSize": int(scene_size),
"runs": int(runs),
"warmupSeconds": int(warmup),
"settleSeconds": int(settle),
"measureSeconds": int(measure),
"networkTimeoutSeconds": 300,
"protocolClientKeepAliveTimeoutMs": 300000,
"runtimeProfile": runtime_profile,
"samplingMode": "independent-runners",
"dependencyDistribution": "single-build-artifact",
"requestedFlags": {
"packetOnlyStatic": runtime_profile == "optimized-candidate",
"eventDrivenBlockUpdates": runtime_profile == "optimized-candidate",
},
"preflight": {"runs": 2, "warmupSeconds": 10, "settleSeconds": 5,
"measureSeconds": 10, "protocolTraceEnabled": True},
"variantA": {"meaning": "official-upstream", "jenkinsBuild": int(upstream_build),
"sourceSha": upstream_source, "artifactSha256": upstream_sha},
"variantB": {"meaning": "rewritten-candidate", "sourceSha": candidate_source,
"artifactSha256": rewrite_sha},
"harnessSourceSha": harness_source_sha,
"paper": {"version": "26.1.2", "build": int(paper_build),
"sha256": paper_sha},
"driverSha256": driver_sha,
"canonicalConfigSha256": config_sha,
"protocolClientManifestSha256": client_sha,
"runnerSha256": runner_sha,
"protocolClientSourceSha256": protocol_source_sha,
"protocolTraceAnalyzerSha256": protocol_analyzer_sha,
"jvmArgumentsSha256": jvm_sha,
"stackSha256": stack_sha,
"cpuIsolation": {
"availableCpuCount": int(available_cpu_count),
"serverCpuSet": [int(value) for value in server_cpu_set.split(",")],
"clientCpuSet": [int(client_cpu_set)],
"disjoint": True,
},
}, indent=2) + "\n", encoding="utf-8")
PY
sha256sum \
compare-dependencies/upstream.jar \
compare-dependencies/rewrite.jar \
compare-dependencies/runtime-comparison-driver.jar \
compare-dependencies/canonical-config.yml \
compare-dependencies/paper.jar \
compare-dependencies/protocol-client/client-build-manifest.json \
> compare-dependencies/campaign-files.sha256
- name: Run full-scene protocol preflight for both artifacts
if: matrix.run_number == 1
run: |
set -euo pipefail
preflight_root="compare-results/$CAMPAIGN_SCENARIO/preflight"
mkdir -p "$preflight_root"
for variant in A B; do
if [[ "$variant" == A ]]; then
target=compare-dependencies/upstream.jar
expected_artifact_sha="$UPSTREAM_ARTIFACT_SHA256"
else
target=compare-dependencies/rewrite.jar
expected_artifact_sha="$REWRITE_ARTIFACT_SHA256"
fi
run_id=$(printf '%s_preflight_%s' "${CAMPAIGN_SCENARIO//-/_}" "$variant")
COMPARE_PLUGIN_JAR="$target" \
COMPARE_DRIVER_JAR=compare-dependencies/runtime-comparison-driver.jar \
COMPARE_CONFIG_FILE=compare-dependencies/canonical-config.yml \
COMPARE_PAPER_JAR=compare-dependencies/paper.jar \
COMPARE_CLIENT_ROOT=compare-dependencies/protocol-client \
COMPARE_OUTPUT_ROOT="$preflight_root" \
COMPARE_RUN_ID="$run_id" \
COMPARE_SCENARIO="$CAMPAIGN_SCENARIO" \
COMPARE_VARIANT="$variant" \
COMPARE_RUNTIME_PROFILE="$COMPARE_RUNTIME_PROFILE" \
COMPARE_CAMPAIGN_KIND=preflight \
COMPARE_SCENE_SIZE="$CAMPAIGN_SCENE_SIZE" \
COMPARE_WARMUP_SECONDS=10 \
COMPARE_SETTLE_SECONDS=5 \
COMPARE_MEASURE_SECONDS=10 \
COMPARE_PROTOCOL_TRACE_ENABLED=1 \
COMPARE_PROTOCOL_TRACE_MAX_EVENTS=500000 \
COMPARE_PROTOCOL_TRACE_PACKET_ALLOWLIST=bundle_delimiter,entity_destroy,spawn_entity \
COMPARE_PROTOCOL_TRACE_AGGREGATE_PACKET_ALLOWLIST=entity_metadata \
bash tools/perf/run-upstream-runtime-once.sh
python3 - \
"$preflight_root/$run_id/iv-compare.json" \
"$preflight_root/$run_id/run-manifest.json" \
"$preflight_root/$run_id/$run_id.protocol-trace-analysis.json" \
"$run_id" "$variant" "$CAMPAIGN_SCENARIO" "$CAMPAIGN_SCENE_SIZE" \
"$expected_artifact_sha" "$CANONICAL_CONFIG_SHA256" \
"$AVAILABLE_CPU_COUNT" "$SERVER_CPU_SET" "$CLIENT_CPU_SET" <<'PY'
import json
from pathlib import Path
import sys
(metrics_path, manifest_path, trace_path, run_id, variant, scenario,
scene_size_text, artifact_sha, config_sha, available_cpu_count,
server_cpu_set, client_cpu_set) = sys.argv[1:]
scene_size = int(scene_size_text)
metrics = json.load(open(metrics_path, encoding="utf-8"))
manifest = json.load(open(manifest_path, encoding="utf-8"))
trace = json.load(open(trace_path, encoding="utf-8"))
affinity = json.loads(
Path(manifest_path).with_name("cpu-affinity.json").read_text(encoding="utf-8"))
expected_cpu = {
"availableCpuCount": int(available_cpu_count),
"serverCpuSet": [int(value) for value in server_cpu_set.split(",")],
"clientCpuSet": [int(client_cpu_set)],
}
expected_metrics = {
"label": run_id,
"variant": variant,
"scenario": scenario,
"expectedSceneSize": scene_size,
"actualSceneSize": scene_size,
"observer": "IVBench",
"observerOnline": True,
"targetEnabled": True,
"targetVersion": "2026.1.2.0",
"boundaryTickSamplesDiscarded": 1,
"droppedTickSamples": 0,
}
for field, expected in expected_metrics.items():
if metrics.get(field) != expected:
raise SystemExit(f"preflight metrics mismatch {field}: {metrics.get(field)!r} != {expected!r}")
expected_requested_flags = {
"packetOnlyStatic": True,
"eventDrivenBlockUpdates": True,
}
expected_effective_flags = {
"packetOnlyStatic": {
"status": "unsupported-legacy" if variant == "A" else "runtime-field",
"value": None if variant == "A" else True,
"field": "packetOnlyStaticVirtualItems",
},
"eventDrivenBlockUpdates": {
"status": "unsupported-legacy" if variant == "A" else "runtime-field",
"value": None if variant == "A" else True,
"field": "eventDrivenBlockUpdates",
},
}
if metrics.get("requestedFlags") != expected_requested_flags:
raise SystemExit("preflight requested optimization flags mismatch")
if metrics.get("effectiveFlags") != expected_effective_flags:
raise SystemExit("preflight effective optimization flags mismatch")
if manifest.get("artifactSha256") != artifact_sha:
raise SystemExit("preflight artifact SHA mismatch")
if manifest.get("canonicalConfigSha256") != config_sha:
raise SystemExit("preflight canonical config SHA mismatch")
if manifest.get("runtimeProfile") != "optimized-candidate":
raise SystemExit("preflight runtime profile mismatch")
if manifest.get("campaignKind") != "preflight":
raise SystemExit("preflight campaign kind mismatch")
if manifest.get("serverHeapGiB") != 4:
raise SystemExit("preflight server heap mismatch")
expected_shutdown = {
"mode": "clean",
"stopGraceSeconds": 120,
"termGraceSeconds": 10,
"forcedAllowed": False,
}
if manifest.get("serverShutdown") != expected_shutdown:
raise SystemExit(
f"preflight server shutdown mismatch: {manifest.get('serverShutdown')!r}")
if manifest.get("requestedFlags") != expected_requested_flags:
raise SystemExit("preflight manifest requested flags mismatch")
if manifest.get("effectiveFlags") != expected_effective_flags:
raise SystemExit("preflight manifest effective flags mismatch")
expected_packet_allowlist = [
"bundle_delimiter", "entity_destroy", "spawn_entity"
]
expected_aggregate_packet_allowlist = ["entity_metadata"]
if manifest.get("protocolTracePacketAllowlist") != expected_packet_allowlist:
raise SystemExit("preflight manifest protocol packet allowlist mismatch")
if (manifest.get("protocolTraceAggregatePacketAllowlist")
!= expected_aggregate_packet_allowlist):
raise SystemExit("preflight manifest aggregate packet allowlist mismatch")
if trace.get("input", {}).get("capturePacketAllowlist") != expected_packet_allowlist:
raise SystemExit("preflight analysis protocol packet allowlist mismatch")
if (trace.get("input", {}).get("aggregatePacketAllowlist")
!= expected_aggregate_packet_allowlist):
raise SystemExit("preflight analysis aggregate packet allowlist mismatch")
for field, expected in expected_cpu.items():
if manifest.get(field) != expected:
raise SystemExit(
f"preflight manifest CPU mismatch {field}: {manifest.get(field)!r} != {expected!r}")
if affinity.get(field) != expected:
raise SystemExit(
f"preflight affinity mismatch {field}: {affinity.get(field)!r} != {expected!r}")
if affinity.get("disjoint") is not True:
raise SystemExit("preflight server/client CPU sets overlap")
status = trace.get("status", {})
if (status.get("formalEvidenceReady") is not True
or status.get("traceComplete") is not True
or status.get("sourceExitCodeOk") is not True
or status.get("windowCovered") is not True
or status.get("parse", {}).get("ok") is not True
or status.get("drop", {}).get("ok") is not True
or status.get("bundleBalanced") is not True):
raise SystemExit(f"protocol trace is not complete: {status!r}")
spawn_observations = trace.get("identity", {}).get("spawn", {}).get("observations")
if not isinstance(spawn_observations, int):
raise SystemExit(f"protocol spawn observations are invalid: {spawn_observations!r}")
metadata_observations = trace.get("counts", {}).get("byPacket", {}).get("entity_metadata", 0)
if not isinstance(metadata_observations, int) or metadata_observations <= 0:
raise SystemExit(
f"preflight observed no entity metadata: {metadata_observations!r}")
aggregated_metadata = trace.get("counts", {}).get(
"byPacketAggregated", {}).get("entity_metadata", 0)
window_aggregated = trace.get("traceCoverage", {}).get(
"windowAggregatedEventCount")
if (aggregated_metadata != metadata_observations
or window_aggregated != metadata_observations):
raise SystemExit(
"preflight aggregate metadata count mismatch: "
f"combined={metadata_observations!r}, "
f"aggregate={aggregated_metadata!r}, window={window_aggregated!r}")
if scenario == "dropped-items" and spawn_observations < scene_size:
raise SystemExit(
f"dropped-item preflight observed only {spawn_observations} spawns for {scene_size} items")
if scenario == "dropped-items" and metadata_observations < 5 * scene_size:
raise SystemExit(
"dropped-item preflight observed too little visual metadata: "
f"{metadata_observations} < {5 * scene_size}")
if scenario == "dropped-items" and variant == "B" and spawn_observations <= scene_size:
raise SystemExit(
"rewritten dropped-item preflight produced no visual spawns beyond source items")
if scenario == "block-active":
block_fields = (
"furnaceBlocks", "blastFurnaceBlocks", "smokerBlocks",
"beehiveBlocks", "beeNestBlocks",
)
block_guards = {field: 0 for field in block_fields}
for index in range(scene_size):
block_guards[block_fields[index % len(block_fields)]] += 1
block_guards["activeFurnaces"] = sum(
block_guards[field] for field in block_fields[:3])
for field, expected in block_guards.items():
if metrics.get(field) != expected:
raise SystemExit(
f"block preflight mismatch {field}: {metrics.get(field)!r} != {expected!r}")
minimum_visual_spawns = 2 * (
metrics["beehiveBlocks"] + metrics["beeNestBlocks"]
)
if spawn_observations < minimum_visual_spawns:
raise SystemExit(
f"block-active preflight observed only {spawn_observations} spawns; "
f"expected at least {minimum_visual_spawns} for two TextDisplays per bee block")
PY
done
- name: Run one restart-isolated independent sample
run: |
set -euo pipefail
result_root="compare-results/$CAMPAIGN_SCENARIO/$CAMPAIGN_KIND"
mkdir -p "$result_root"
manifest="$result_root/abba-manifest.csv"
printf 'Scenario,Block,Position,Variant,RunId,StackSha256,ArtifactSha256,CaptureMethod,SourcePath\n' \
> "$manifest"
run_number="$CAMPAIGN_RUN_NUMBER"
block=$(( (run_number - 1) / 4 + 1 ))
position=$(( (run_number - 1) % 4 + 1 ))
if (( block % 2 == 1 )); then pattern=ABBA; else pattern=BAAB; fi
variant=${pattern:$((position - 1)):1}
run_id=$(printf '%s_%s_%02d' "${CAMPAIGN_SCENARIO//-/_}" "$variant" "$run_number")
if [[ "$variant" == A ]]; then
target=compare-dependencies/upstream.jar
expected_artifact_sha="$UPSTREAM_ARTIFACT_SHA256"
else
target=compare-dependencies/rewrite.jar
expected_artifact_sha="$REWRITE_ARTIFACT_SHA256"
fi
COMPARE_PLUGIN_JAR="$target" \
COMPARE_DRIVER_JAR=compare-dependencies/runtime-comparison-driver.jar \
COMPARE_CONFIG_FILE=compare-dependencies/canonical-config.yml \
COMPARE_PAPER_JAR=compare-dependencies/paper.jar \
COMPARE_CLIENT_ROOT=compare-dependencies/protocol-client \
COMPARE_OUTPUT_ROOT="$result_root" \
COMPARE_RUN_ID="$run_id" \
COMPARE_SCENARIO="$CAMPAIGN_SCENARIO" \
COMPARE_VARIANT="$variant" \
COMPARE_RUNTIME_PROFILE="$COMPARE_RUNTIME_PROFILE" \
COMPARE_CAMPAIGN_KIND="$CAMPAIGN_KIND" \
COMPARE_SCENE_SIZE="$CAMPAIGN_SCENE_SIZE" \
COMPARE_WARMUP_SECONDS="$CAMPAIGN_WARMUP_SECONDS" \
COMPARE_SETTLE_SECONDS="$CAMPAIGN_SETTLE_SECONDS" \
COMPARE_MEASURE_SECONDS="$CAMPAIGN_MEASURE_SECONDS" \
COMPARE_PROTOCOL_TRACE_ENABLED=0 \
bash tools/perf/run-upstream-runtime-once.sh
python3 - "$manifest" "$result_root" "$run_id" "$CAMPAIGN_SCENARIO" \
"$block" "$position" "$variant" "$CAMPAIGN_SCENE_SIZE" \
"$CAMPAIGN_STACK_SHA256" "$expected_artifact_sha" \
"$CANONICAL_CONFIG_SHA256" "$DRIVER_SHA256" "$PAPER_SHA256" \
"$CLIENT_MANIFEST_SHA256" "$RUNNER_SHA256" "$JVM_ARGUMENTS_SHA256" \
"$AVAILABLE_CPU_COUNT" "$SERVER_CPU_SET" "$CLIENT_CPU_SET" \
"$COMPARE_RUNTIME_PROFILE" "$CAMPAIGN_KIND" <<'PY'
import csv
import json
from pathlib import Path
import sys
(manifest_text, root_text, run_id, scenario, block, position, variant,
scene_size_text, stack_sha, artifact_sha, config_sha, driver_sha,
paper_sha, client_sha, runner_sha, jvm_sha, available_cpu_count,
server_cpu_set, client_cpu_set, runtime_profile, campaign_kind) = sys.argv[1:]
root = Path(root_text)
metrics_path = root / run_id / "iv-compare.json"
run_manifest_path = root / run_id / "run-manifest.json"
metrics = json.loads(metrics_path.read_text(encoding="utf-8"))
run_manifest = json.loads(run_manifest_path.read_text(encoding="utf-8"))
affinity = json.loads(
(root / run_id / "cpu-affinity.json").read_text(encoding="utf-8"))
scene_size = int(scene_size_text)
expected_server_cpu_set = [int(value) for value in server_cpu_set.split(",")]
expected_client_cpu_set = [int(client_cpu_set)]
expected_metrics = {
"schemaVersion": 1,
"label": run_id,
"variant": variant,
"scenario": scenario,
"expectedSceneSize": scene_size,
"actualSceneSize": scene_size,
"observer": "IVBench",
"observerOnline": True,
"targetEnabled": True,
"targetVersion": "2026.1.2.0",
"boundaryTickSamplesDiscarded": 1,
"droppedTickSamples": 0,
}
for field, expected in expected_metrics.items():
if metrics.get(field) != expected:
raise SystemExit(f"metrics mismatch {run_id}/{field}: {metrics.get(field)!r} != {expected!r}")
expected_requested_flags = {
"packetOnlyStatic": True,
"eventDrivenBlockUpdates": True,
}
expected_effective_flags = {
"packetOnlyStatic": {
"status": "unsupported-legacy" if variant == "A" else "runtime-field",
"value": None if variant == "A" else True,
"field": "packetOnlyStaticVirtualItems",
},
"eventDrivenBlockUpdates": {
"status": "unsupported-legacy" if variant == "A" else "runtime-field",
"value": None if variant == "A" else True,
"field": "eventDrivenBlockUpdates",
},
}
if runtime_profile != "optimized-candidate":
raise SystemExit(f"unexpected runtime profile: {runtime_profile!r}")
if metrics.get("requestedFlags") != expected_requested_flags:
raise SystemExit(f"metrics requested flags mismatch for {run_id}")
if metrics.get("effectiveFlags") != expected_effective_flags:
raise SystemExit(f"metrics effective flags mismatch for {run_id}")
expected_manifest = {
"runId": run_id,
"scenario": scenario,
"variant": variant,
"sceneSize": scene_size,
"artifactSha256": artifact_sha,
"driverSha256": driver_sha,
"paperSha256": paper_sha,
"canonicalConfigSha256": config_sha,
"protocolClientManifestSha256": client_sha,
"runnerScriptSha256": runner_sha,
"jvmArgumentsSha256": jvm_sha,
"availableCpuCount": int(available_cpu_count),
"serverCpuSet": expected_server_cpu_set,
"clientCpuSet": expected_client_cpu_set,
"runtimeProfile": runtime_profile,
"campaignKind": campaign_kind,
"serverHeapGiB": 4,
"requestedFlags": expected_requested_flags,
"effectiveFlags": expected_effective_flags,
}
for field, expected in expected_manifest.items():
if run_manifest.get(field) != expected:
raise SystemExit(
f"run manifest mismatch {run_id}/{field}: {run_manifest.get(field)!r} != {expected!r}")
expected_forced_shutdown = (
campaign_kind == "formal" and scenario == "block-active"
and variant == "A" and scene_size >= 1024)
expected_shutdown = {
"stopGraceSeconds": 120,
"termGraceSeconds": 10,
"forcedAllowed": expected_forced_shutdown,
}
shutdown = run_manifest.get("serverShutdown")
if not isinstance(shutdown, dict):
raise SystemExit(f"server shutdown evidence missing for {run_id}")
for field, expected in expected_shutdown.items():
if shutdown.get(field) != expected:
raise SystemExit(
f"server shutdown mismatch {run_id}/{field}: "
f"{shutdown.get(field)!r} != {expected!r}")
if shutdown.get("mode") not in {"clean", "forced-after-stop-timeout"}:
raise SystemExit(f"invalid server shutdown mode for {run_id}: {shutdown.get('mode')!r}")
if shutdown.get("mode") != "clean" and not expected_forced_shutdown:
raise SystemExit(f"unexpected forced server shutdown for {run_id}")
expected_affinity = {
"availableCpuCount": int(available_cpu_count),
"serverCpuSet": expected_server_cpu_set,
"clientCpuSet": expected_client_cpu_set,
"disjoint": True,
}
for field, expected in expected_affinity.items():
if affinity.get(field) != expected:
raise SystemExit(
f"CPU affinity mismatch {run_id}/{field}: {affinity.get(field)!r} != {expected!r}")
if metrics.get("tickSamples", 0) <= 0:
raise SystemExit(f"{run_id} has no tick samples")
with open(manifest_text, "a", encoding="utf-8", newline="") as stream:
csv.writer(stream, lineterminator="\n").writerow([
scenario, block, position, variant, run_id, stack_sha, artifact_sha,
"paper-server-tick-end-event", f"{run_id}/iv-compare.json",
])
PY
- name: Upload independent run evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: upstream-runtime-run-${{ matrix.scenario }}-${{ env.CAMPAIGN_KIND }}-${{ github.run_id }}-${{ matrix.run_number }}
path: |
compare-results/${{ matrix.scenario }}
compare-dependencies/campaign-provenance.json
compare-dependencies/campaign-files.sha256
compare-dependencies/upstream-build-163.json
compare-dependencies/upstream-plugin.yml
compare-dependencies/paper-build-74.json
compare-dependencies/canonical-config.yml
compare-dependencies/protocol-client/client-build-manifest.json
compare-dependencies/protocol-client/client-files.sha256
compare-dependencies/protocol-client/node-minecraft-protocol/package-lock.json
compare-dependencies/protocol-client/node-minecraft-protocol/production-lock-inventory.json
if-no-files-found: warn
retention-days: 3
aggregate-upstream-runtime:
name: Aggregate ${{ matrix.scenario }} independent samples
needs: [compare-upstream-runtime]
if: ${{ needs.compare-upstream-runtime.result == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
scenario: [dropped-items, block-active]
env:
UPSTREAM_BUILD_NUMBER: "163"
UPSTREAM_SOURCE_SHA: c7f9dd0457451537653bf4b4c0eb0e4298c51187
UPSTREAM_ARTIFACT_SHA256: a7ffc2ba053c74681feabc698e9fdb959ebd4f8252206fedd8801979e3de30c0
PAPER_BUILD: "74"
PAPER_SHA256: 1d70b1dab9cf4a6de615209a536f3a45a2186240253c428213ce2188ab95e5f7
COMPARE_RUNTIME_PROFILE: optimized-candidate
CAMPAIGN_KIND: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && 'formal' || 'smoke' }}
CAMPAIGN_RUNS: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '12' || '4' }}
CAMPAIGN_WARMUP_SECONDS: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '60' || '10' }}
CAMPAIGN_SETTLE_SECONDS: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '20' || '5' }}
CAMPAIGN_MEASURE_SECONDS: ${{ (github.event_name == 'workflow_dispatch' || (github.event.action == 'labeled' && github.event.label.name == 'upstream-runtime-formal')) && '120' || '10' }}
CAMPAIGN_SCENARIO: ${{ matrix.scenario }}
CAMPAIGN_SCENE_SIZE: ${{ matrix.scenario == 'dropped-items' && '512' || '256' }}
steps:
- name: Check out harness source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 1
persist-credentials: false
- name: Download all independent run artifacts
uses: actions/download-artifact@v4
with:
pattern: upstream-runtime-run-${{ matrix.scenario }}-${{ env.CAMPAIGN_KIND }}-${{ github.run_id }}-*
path: parallel-runs
- name: Assemble and verify independent campaign
run: |
set -euo pipefail
result_root="compare-results/$CAMPAIGN_SCENARIO/$CAMPAIGN_KIND"
mkdir -p "$result_root" compare-dependencies
manifest="$result_root/abba-manifest.csv"
printf 'Scenario,Block,Position,Variant,RunId,StackSha256,ArtifactSha256,CaptureMethod,SourcePath\n' \
> "$manifest"
mapfile -t manifests < <(find parallel-runs -type f \
-path "*/compare-results/$CAMPAIGN_SCENARIO/$CAMPAIGN_KIND/abba-manifest.csv" | sort)
[[ "${#manifests[@]}" == "$CAMPAIGN_RUNS" ]]
for source_manifest in "${manifests[@]}"; do
run_id=$(python3 - "$source_manifest" <<'PY'
import csv
import sys
rows = list(csv.DictReader(open(sys.argv[1], encoding="utf-8", newline="")))
if len(rows) != 1:
raise SystemExit(f"per-run manifest must have one row: {sys.argv[1]}")
print(rows[0]["RunId"])
PY
)
source_root=$(dirname "$source_manifest")
[[ -d "$source_root/$run_id" ]]
[[ ! -e "$result_root/$run_id" ]]
cp -a "$source_root/$run_id" "$result_root/$run_id"
tail -n +2 "$source_manifest" >> "$manifest"
done
mapfile -t preflight_roots < <(find parallel-runs -type d \
-path "*/compare-results/$CAMPAIGN_SCENARIO/preflight" | sort)
[[ "${#preflight_roots[@]}" == 1 ]]
cp -a "${preflight_roots[0]}" "compare-results/$CAMPAIGN_SCENARIO/preflight"