Surfpool Anchor Smoke
Use this folder as a reusable playbook for running Anchor's reusable smoke matrix against a local Surfpool build.
Inputs
- Ask for both repo roots unless they are already explicit:
- Surfpool repo root
- Anchor repo root
- If the agent cannot do interactive prompts, pass them explicitly:
python3 .claude/skills/surfpool-anchor-smoke/scripts/run_smoke_suite.py \
--surfpool-dir <path-to-surfpool-repo> \
--anchor-dir <path-to-anchor-repo>
- The runner also accepts
SURFPOOL_DIRandANCHOR_DIRenvironment variables.
Workflow
- Install Surfpool locally with
cargo surfpool-install-devin the Surfpool repo. - Locate the Surfpool process spawn inside the Anchor repo's
cli/src/lib.rsby searching thestart_surfpool_validatorfunction body forCommand::new(...surfpool...). - Update that command to use the local cargo-installed Surfpool binary, usually
~/.cargo/bin/surfpool. - Build the Anchor CLI with
cd cli && cargo build --releasein the Anchor repo. - Reproduce the local TS
yarn linksetup from the Anchor repo's.github/actions/setup-ts/action.yaml. - Parse the enabled
- cmd:entries from the Anchor repo's.github/workflows/reusable-tests.yamland drop entries in the runner's built-in skip list (currentlytests/anchor-cli-idl). - Run those tests serially with Anchor's repo-local release binary. Rewrite direct
anchor ...invocations totarget/release/anchorrelative to each test directory, and prepend<anchor-dir>/target/releasetoPATHso shell scripts also pick up the local build. - Write per-step logs and a Markdown report that highlights failed suites, hangs, and setup problems.
Runner
Run from the Surfpool repo root:
python3 .claude/skills/surfpool-anchor-smoke/scripts/run_smoke_suite.py
Useful flags:
--match <text>: run only commands whose original workflow command contains the text. Pass more than once to keep multiple subsets.--skip <text>: drop commands whose original workflow command contains the text. Stacks with the built-in skip list (tests/anchor-cli-idl).--no-default-skips: disable the built-in skip list. Only use this if you want to debug the skipped suite in isolation; it will poison subsequent suites.--max-tests <n>: stop after the firstnselected tests.--dry-run: print and report the planned commands without executing them.--list-tests: print the extracted workflow commands and exit.--local-surfpool-bin <path>: override the path used when patching Anchor's Surfpool spawn command.--skip-anchor-patch: skip the automatic Anchor CLI patch step.--skip-surfpool-build,--skip-anchor-build,--skip-link-setup: reuse prior setup artifacts while iterating.--test-timeout <seconds>(default 900): hard ceiling per test. When hit, the whole process group is SIGTERMed then SIGKILLed.--idle-timeout <seconds>(default 300): kill a test that has produced no output for this long. Catches mocha hangs waiting on never-fired signature/logs subscriptions.
Example:
python3 .claude/skills/surfpool-anchor-smoke/scripts/run_smoke_suite.py \
--surfpool-dir <path-to-surfpool-repo> \
--anchor-dir <path-to-anchor-repo> \
--match tests/sysvars \
--match tests/errors
Guardrails
- Do not hardcode user-specific repo paths in the skill body or in the runner defaults.
- Do not hardcode a line number in
cli/src/lib.rs; always find the Surfpool command call by search. - Patch only the located
Command::new(...surfpool...)string literal insidestart_surfpool_validator. - Do not use the Anchor repo's
setup-tests.shfor this workflow. It installs a debuganchorinto~/.cargo/bin, while this smoke test is supposed to exercisetarget/release/anchor. - Keep user worktree changes unless they directly block the smoke run.
- If setup fails before the test phase starts, stop and report that setup failure rather than guessing about test outcomes.
tests/anchor-cli-idl/test.shis skipped by default. It spawnssolana-test-validator --reset ... &bound tolocalhost:8899and only kills it via a trailingkill $(jobs -p)that never runs becauseset -euo pipefailexits earlier when the in-scriptanchor testfails. The orphaned validator survives the runner's process-group SIGTERM on darwin, and every subsequent Surfpool-spawned suite then routes traffic to it — manifesting asTransaction simulation failed: This program may not be used for executing instructions(no programs deployed) andRPC response error -32601: Method not found(missing Surfpool extension RPCs). Keep it skipped unless you are debugging that suite in isolation.- Other test scripts may also background their own validators. If a similar pattern shows up later, add it to
DEFAULT_SKIP_PATTERNSinrun_smoke_suite.pyrather than leaving it to poison the run.
Resource
scripts/run_smoke_suite.py
- prompts for repo roots when needed
- patches Anchor's Surfpool spawn command by search, not by line number
- executes setup and serial test runs
- rewrites top-level
anchorinvocations to the repo-local release binary - preserves per-step and per-test logs
- produces a Markdown failure report