From dd1caeda96b85f9667f3bf5e64e05628e5e18d1b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 22 Sep 2026 22:35:19 +0000 Subject: [PATCH] ci: skip the validator in anchor test for the LiteSVM projects built without an IDL Surfpool 1.6, which the Anchor v2 workflow installs as `latest`, deploys each program at startup through a generated runbook that calls svm::get_program_from_anchor_project, and that reads target/idl/.json. The nine projects built with --no-idl (the anchor#4947 workaround) have no IDL, so `anchor test` died before any test ran: function 'svm::get_program_from_anchor_project': invalid anchor idl location ./target/idl/order_book.json: No such file or directory Error: Surfpool startup failed: Runbook execution failed That has turned main's Anchor v2 runs red since the 2026-09-21 scheduled run (betting-market on the push for #140, order-book on #148). Each of those nine projects runs `test = "cargo test"`, which tests against LiteSVM in-process and never talks to a validator, so `anchor test` now passes --skip-local-validator for exactly them. Every other project still gets a validator as before. Reproduced with anchor-cli 2.0.0-rc.1 and surfpool 1.6.0: order-book fails as in CI without the flag and passes 27/27 with it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011VUvZT5384GaSBhhgJwFp3 --- .github/workflows/anchor.yml | 16 +++++++++++++--- CHANGELOG.md | 12 ++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/anchor.yml b/.github/workflows/anchor.yml index 1925ccee..899cc0c5 100644 --- a/.github/workflows/anchor.yml +++ b/.github/workflows/anchor.yml @@ -275,8 +275,8 @@ jobs: done fi - # TEMPORARY WORKAROUND - delete this block and the `$idl_flag` - # below once an Anchor release after 2.0.0-rc.1 is out. + # TEMPORARY WORKAROUND - delete this block and the `$idl_flag` and + # `$test_flag` below once an Anchor release after 2.0.0-rc.1 is out. # # anchor-derive-accounts 2.0.0-rc.1 emits enum type definitions with # the JSON key "fields" where the IDL spec requires "variants", so @@ -297,6 +297,14 @@ jobs: # projects consumes a generated IDL (no `idls/` directory, no # `declare_program!`). The program is still compiled and its tests # still run. + # + # The skip also means `anchor test` must not start a validator for + # these projects. Surfpool 1.6 deploys the program at startup + # through a runbook that reads `target/idl/.json`, and with + # no IDL it exits with `Runbook execution failed` before any test + # runs. None of these projects needs a validator: each one's + # Anchor.toml runs `cargo test`, which tests against LiteSVM + # in-process. case "$project" in ./basics/pyth/anchor \ |./finance/betting-market/anchor \ @@ -309,9 +317,11 @@ jobs: |./tokens/token-extensions/transfer-hook/allow-block-list-token/anchor) echo "::notice::skipping IDL generation for $project (anchor#4947)" idl_flag="--no-idl" + test_flag="--skip-local-validator" ;; *) idl_flag="" + test_flag="" ;; esac @@ -327,7 +337,7 @@ jobs: # Run anchor test. It regenerates the IDL too, so the skip above # has to apply here as well or the projects it exempts fail at the # test step instead of the build step. - if ! anchor test $idl_flag; then + if ! anchor test $idl_flag $test_flag; then echo "::error::anchor test failed for $project" echo "$project: anchor test failed" >> $GITHUB_WORKSPACE/failed_projects.txt rm -rf target node_modules diff --git a/CHANGELOG.md b/CHANGELOG.md index 2097ad36..af189ab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ All notable changes to this repository are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [2026-09-22] - Anchor v2 CI no longer starts a validator for LiteSVM-only projects + +Surfpool 1.6, which the Anchor v2 workflow installs as `latest`, deploys each +program at startup through a runbook that reads `target/idl/.json`. +The nine projects built with `--no-idl` (the anchor#4947 workaround) have no +IDL, so `anchor test` died with `Surfpool startup failed: Runbook execution +failed` before any test ran, turning main's Anchor v2 runs red. + +- `anchor test` runs with `--skip-local-validator` for exactly those nine + projects. Each one's Anchor.toml runs `cargo test` against LiteSVM, so none + of them ever used the validator. Every other project is tested as before. + ## [2026-09-14] - Token fundraiser contributors can close their accounts A successful raise exits through `check_contributions`, which closes the vault