Index of every page on this site: llms.txt
All skills
chainstacklabs avatar

/run-unit-and-surfpool-tests

@a32a60e
Run it yourself

Run pumpfun-cli test suites — unit tests and surfpool integration tests. Use this skill whenever the user says "run tests", "run unit tests", "run surfpool tests", "check if tests pass", "test the code", or after making code changes that should be verified. Also trigger when the user asks to validate changes, check for regressions, or verify something works. This skill covers ALL non-mainnet testing. For mainnet e2e testing with real funds, use the run-mainnet-e2e-tests skill instead.

  • 3 files
  • 6.5 KB
  • Updated last week
  • GitHub
Use this Skill: https://skilld.dev/gh/chainstacklabs/pumpfun-cli/run-unit-and-surfpool-tests

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈130 tokens for metadata: the name and description. ≈1.1k when used: this file. ≈118 more on demand in 1 file.

Description uses 6.5% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈519 characters, or 6.5%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Test Runner for pumpfun-cli

Run the project's automated test suites safely — no real funds, no mainnet transactions.

Project Context

  • Package manager: uv (always prefix python/pytest commands with uv run)
  • Architecture: Three-layer CLI — commands/ (Typer) -> core/ (business logic) -> protocol/ (Solana/pump.fun)
  • All commands below assume you are in the project root directory.

Prerequisites

Run the check-prereqs script from the skill directory before doing anything else:

.claude/skills/run-unit-and-surfpool-tests/scripts/check-prereqs.sh

If it exits non-zero, fix the FAIL items before proceeding. WARN items (e.g. surfpool missing) are fine for unit tests.

Two Test Suites

1. Unit Tests (fast, always safe)

Tests covering crypto, wallet, trade logic, protocol, output formatting, and CLI smoke tests. All mocked — no network calls. Run and report actual counts.

uv run pytest tests/ -q

Run this first every time. If unit tests fail, stop and report — no point running integration tests on broken code.

2. Surfpool Integration Tests (slower, needs surfpool + mainnet mints)

Tests that run against a local Surfpool fork of Solana mainnet. Surfpool replays mainnet state locally so transactions are free and reversible. Run and report actual counts.

How to run — use the helper script from the project root:

./scripts/surfpool-autodiscover.sh

This script automatically:

  1. Discovers a suitable active bonding-curve mint via tokens new
  2. Discovers a suitable graduated PumpSwap mint via tokens trending
  3. Starts surfpool, runs all tests, stops surfpool

Manual run (if you need specific mints):

./scripts/surfpool-test.sh \
  --mint <ACTIVE_BONDING_CURVE_MINT> \
  --graduated <GRADUATED_PUMPSWAP_MINT>

Execution Sequence

Follow this order:

  1. Check prerequisites — .claude/skills/run-unit-and-surfpool-tests/scripts/check-prereqs.sh
  2. Run unit tests — uv run pytest tests/ -q
  3. Check result — if any fail, report failures with file:line and stop
  4. Run surfpool tests (if surfpool available) — ./scripts/surfpool-autodiscover.sh
  5. Report results — use the template at .claude/skills/run-unit-and-surfpool-tests/references/results-template.md for consistent formatting

Failure Diagnosis

When tests fail, use this decision tree to diagnose:

  • Unit test assertion failure — Read the failing test to understand what it checks. Then read the production code it exercises. The assertion tells you what the expected behavior is; the code tells you what changed.

  • Import error / ModuleNotFoundError — Likely a missing or renamed dependency. Check pyproject.toml for the package. Run uv sync if a dependency was recently added.

  • Surfpool connection refused (ConnectionRefusedError, "Connection refused" on port 8899) — Surfpool is not running, or another process holds port 8899. Check with lsof -ti:8899. Kill stale processes if needed: lsof -ti:8899 | xargs kill -9, then retry.

  • Surfpool tests skipped — Missing environment variables for mint addresses. The autodiscover script should set these. If running manually, ensure --mint and --graduated are provided.

  • xfail (expected failure) — This is normal and not a problem. The test is marked as known-flaky or testing a known limitation.

  • Mint discovery failure — The pump.fun API may be down or no suitable tokens exist. Retry after a minute.

Known Behaviors

  • surfpool-test.sh uses uv run python3 (not bare python3) because solders/solana packages are in the uv venv.

Interpreting Results

Result Meaning
All unit tests pass Core logic is sound
Surfpool all pass + xfails only Full integration suite healthy
Surfpool skips Missing --mint or --graduated env vars (the auto script should prevent this)
Unit test failures Regression in core logic — fix before anything else
Surfpool failures (not xfail) Possible protocol change or instruction bug — investigate

Reporting

Use the template at .claude/skills/run-unit-and-surfpool-tests/references/results-template.md for a standardized report. Fill in actual counts from the test run. Include the failed-test table only when there are failures.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at a32a60e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated last week

README badge

README badge for chainstacklabs/pumpfun-cli/run-unit-and-surfpool-tests