feat: inline ci3 YAML annotations for test resource metadata#20934
feat: inline ci3 YAML annotations for test resource metadata#20934
Conversation
Tests that create multiple sequencer nodes need more libuv threads than the default 8. Each sequencer needs ~4 threads. This sets per-test UV_THREADPOOL_SIZE in test_cmds for both yarn-project unit tests and end-to-end tests based on the number of nodes each test creates. Also scales LMDB MAX_READERS with UV_THREADPOOL_SIZE since each libuv thread accessing the database needs a reader slot.
e2e_epochs tests also create multiple validator nodes: - epochs_first_slot (8 nodes) -> UV_THREADPOOL_SIZE=32 - epochs_invalidate_block (5 nodes) -> UV_THREADPOOL_SIZE=24 - epochs_mbps, epochs_simple, epochs_high_tps (3-4 nodes) -> UV_THREADPOOL_SIZE=16
Introduce a `// ci3: KEY=val` first-line comment annotation for test files that declares CI resource requirements (ISOLATE, CPUS, MEM, UV_THREADPOOL_SIZE, etc.) directly in the test file instead of via pattern matching in bootstrap.sh. - New helper: yarn-project/scripts/parse_ci3_annotation.sh - yarn-project/bootstrap.sh test_cmds now reads annotations - yarn-project/end-to-end/bootstrap.sh test_cmds now reads annotations - 148 test files annotated with their CI metadata
…ations Changes: - Switch annotation format from `// ci3: KEY=val` to XML syntax: `// <ci3:meta isolate cpus="10" mem="16g" uv_threadpool_size="32" />` - Update parser (parse_ci3_annotation.sh) to handle XML attribute syntax with case-insensitive attribute names (uppercased on emit) - Add missing ISOLATE annotations to 13 test files that were matched by the old `^aztec` regex pattern but weren't annotated: - aztec-node/ (4 files) - aztec.js/ (6 files) - p2p/ bench tests (3 files) - Behavioral parity verified: all 161 annotated files match old bootstrap.sh pattern-matching behavior
- Rename annotation tag from ci3:meta to ci3: `// <ci3 isolate cpus="10" />` - Add timeout="15m" annotation to e2e_block_building.test.ts, read by bootstrap.sh instead of hardcoding - Add ci3 annotation to p2p_client.proposal_tx_collector.bench.test.ts documenting its bench_cmds resource settings (isolate cpus="16" mem="32g" timeout="1200") - 163 total annotated test files
Add check_ci3_annotations.sh that verifies:
- Tests in isolation-required packages (p2p, ethereum, prover-node,
aztec-node, aztec.js, prover-client/src/test, stdlib/src/l1-contracts,
ivc-integration/src/chonk_browser) have '// <ci3 isolate ... />'
- All existing ci3 annotations use valid syntax ('// <ci3 ... />')
Runs automatically at the start of test_cmds in bootstrap.sh, failing
early if any test file is missing a required annotation or has a
malformed one.
Replace XML-style `// <ci3 isolate cpus="10" />` with inline YAML:
`// ci3: { isolate: true, cpus: 10, mem: "16g" }`
- Parser now uses yq to parse YAML, avoiding shell quoting issues
that caused `export: not a valid identifier` errors in
source_test_params
- Precheck validates YAML syntax with yq instead of regex
- 163 test files converted
Code Review: Inline ci3 test annotationsBugs FoundBUG 1 (Critical):
The script uses Consequences:
Verified: Created a test file missing isolate annotation. Script printed one ERROR line then exited without printing the summary. Fix: Replace BUG 2 (Low): eval-unsafe output for values containing single quotes
The output format BUG 3 (Low): PR description format mismatch The PR description's "Annotation format" section shows XML format ( BUG 4 (Minor, pre-existing): Duplicate CPUS/MEM for prover-client testbench in CI_FULL mode
Observations
Verified Correct
|
((errors++)) when errors=0 evaluates to falsy (exit code 1), causing immediate script termination under set -e. Only the first error would be reported.
Summary
UV_THREADPOOL_SIZEper test based on sequencer count (~4 libuv threads per sequencer)MAX_READERSand AVM simulator concurrency withUV_THREADPOOL_SIZEtest_cmdstimeAnnotation format
First line of
.test.tsfiles, parsed byyarn-project/scripts/parse_ci3_annotation.shusingyq:// ci3: { isolate: true, cpus: 10, mem: "16g", timeout: "15m", uv_threadpool_size: 32 }Prefix fields (ci3 infrastructure — colon-separated, used for docker isolation / scheduling):
isolate,cpus,mem,timeout,net,only_term_parentEnv vars (space-separated, passed to the test process):
uv_threadpool_size,log_level,bb_verbose,hardware_concurrency, etc.Keys are lowercase YAML, uppercased on emit (e.g.
cpus: 8→CPUS=8).163 annotated test files
{ isolate: true }or{ isolate: true, uv_threadpool_size: 16 }{ isolate: true }{ uv_threadpool_size: 16 }or{ timeout: \"15m\" }{ cpus: 16, mem: \"16g\" }{ isolate: true }{ isolate: true, net: true, cpus: 8 }{ isolate: true }{ isolate: true }{ isolate: true }{ isolate: true }{ isolate: true, cpus: 16, mem: \"32g\", timeout: 1200 }Precheck
check_ci3_annotations.shruns attest_cmdsstart and verifies:isolate: trueyq)LMDB / AVM scaling
MAX_READERS = Math.max(16, UV_THREADPOOL_SIZE * 2)— each libuv thread needs a reader slotMath.max(1, Math.floor(UV_THREADPOOL_SIZE / 2))Test plan
test_cmdsoutput matches old behaviorcd yarn-project && bash scripts/check_ci3_annotations.sh"