Skip to content

feat: draft surfpool-sdk#600

Draft
lgalabru wants to merge 8 commits intomainfrom
feat/sdk
Draft

feat: draft surfpool-sdk#600
lgalabru wants to merge 8 commits intomainfrom
feat/sdk

Conversation

@lgalabru
Copy link
Copy Markdown
Collaborator

No description provided.

- Add report module: collect transaction profiles from each Surfnet
  instance, consolidate across parallel tests, and generate a
  self-contained HTML report with transaction inspection
- Report triggered via SURFPOOL_REPORT=1 env var or .report(true) builder
- Auto-detect test function names from thread names
- Rich HTML report: Surfpool-branded UI with inline transaction tables,
  per-instruction CU breakdown, parsed JSON + hex byte comparison with
  diff highlighting, account state diffs
- Add SurfpoolReport::from_directory() / generate_html() / write_html()
- Add uuid, chrono, serde dependencies to SDK
Native Node.js bindings using napi-rs, following the same pattern
as litesvm's node-litesvm crate.

Exposes:
- Surfnet.start() / Surfnet.startWithConfig() — spin up embedded surfpool
- surfnet.rpcUrl / wsUrl / payer / payerSecretKey — accessors
- surfnet.fundSol() / fundToken() / setAccount() / getAta() — cheatcodes
- Surfnet.newKeypair() — generate random keypair

TypeScript wrapper in surfpool-sdk/index.ts provides clean DX.
Build: npx napi build --platform surfpool-sdk
Two composite actions for use by any repo:

.github/actions/report — Surfpool Test Report
  - Upload report HTML as artifact
  - Deploy to GitHub Pages under configurable path (per-PR by default)
  - Post sticky PR comment with direct link
  Inputs: report-dir, output-path, generate-command, pages-path

.github/actions/coverage — Coverage Report
  - Accept cargo-llvm-cov JSON and/or vitest coverage-summary.json
  - Render unified table with color badges (green ≥90%, yellow ≥80%, red <80%)
  - Post as sticky PR comment
  Inputs: rust-coverage-json, ts-coverage-json, thresholds

Usage:
  uses: solana-foundation/surfpool/.github/actions/report@feat/sdk
  uses: solana-foundation/surfpool/.github/actions/coverage@feat/sdk
One-liner for test files:
  surfpool_sdk::report::SurfpoolReport::generate(None, None);

Uses default paths (target/surfpool-reports → target/surfpool-report.html)
and handles missing data gracefully with eprintln.
Avoids needing a tsc build step — 'import { Surfnet } from surfpool-sdk'
now resolves directly to the napi-generated internal.js binding.
Merges the two separate actions into one that posts a single PR comment:
- Coverage table (Rust + TS) at the top
- Surfpool test report link below (separated by ----)
- GitHub Pages deploy for the HTML report
- Artifact upload

Usage:
  uses: solana-foundation/surfpool/.github/actions/test-report@feat/sdk
  with:
    rust-coverage-json: rust-cov/coverage.json
    ts-coverage-json: ts-cov/coverage-summary.json
    report-path: surfpool-report.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant