Skip to content

feat(core,cli,action): wasit run, config file and GitHub Action for read-only checks; stellar-sdk 16.4.1 - #23

Merged
dzakwannajmi merged 8 commits into
mainfrom
sow2/s1-action
Nov 20, 2026
Merged

dzakwannajmi merged 8 commits into
mainfrom
sow2/s1-action

Conversation

@dzakwannajmi

Copy link
Copy Markdown
Collaborator

What

  • wasit.config.json (version 1): endpoints, methods, request bodies and environments in one file. The loader is strict: an unknown key is an error, and secrets, the mainnet opt-in and per-payment caps have no place in the file.
  • wasit run --read-only: runs the checks X402-01 to X402-05 for every endpoint of the config and writes one report (--json, --out). It can start the service itself (--start, --start-if-local) and compare with the report of the default branch (--baseline).
  • A service Wasit cannot grade (x402 v1, or a network it does not support) is reported as "unsupported", not as a FAIL. A run where nothing could be graded exits 2.
  • wasit ci-report: renders the pull request comment and the job summary from a report. One sanitiser covers everything a service sent.
  • action/: a composite GitHub Action for Linux runners with Node 22. It starts the service in the job, runs the read-only checks, comments on the pull request (one comment, updated on each push) and compares with the last successful run on the default branch.
  • Payment checks run on test networks only: every entry point in core that signs refuses any other network before a key is read.
  • A channel commitment is signed only when it names the run's channel, amount and network.
  • @stellar/stellar-sdk 16.4.1 in the lockfile: the test network is on protocol 30, and 16.1.0 cannot read its ledger headers.

Behaviour changes

  • An x402 v1 challenge is "unsupported" and the run exits 2 when nothing else was graded.
  • Payment checks refuse networks that are not test networks.

Not in this pull request

The payment tier of the Action, the mainnet opt-in, and documentation for these features, which stays off main until a release.

Tests

npm run build && npm test: cli 173, core 609, server 10. npm run test:action: 149. No failures (local run). The Action has also run on pull requests of a separate example repository.

A fixed table of networks (core/src/guard/networks.ts) decides before any
request is sent or any key is read: the four test networks pass;
stellar:pubnet and any network not in the table are refused as a
configuration error. The guard runs in every core entry point that signs
(the x402 preflight and preparePayment, the MPP charge run and payCharge,
the channel suite, each channel check and the channel credential), so the
CLI, the MCP server, the dashboard and direct users of @wasit-dev/core get
the same refusal from one place. It is the first layer of the network
guard; the mainnet opt-in is not part of it.

Tests: core (the table and every entry point), the CLI's built binary, the
dashboard's runAction, and the MCP server over stdio (new test and
typecheck scripts, both run in CI). Help and tool texts no longer offer
stellar:pubnet.
…one sanitiser

Groundwork for the read-only GitHub Action (SOW 2, Deliverable 1).

- config: a loader for wasit.config.json version 1. Unknown keys, secrets, the
  mainnet opt-in, anything that enables MPP-13, header names that look like
  secrets and paths that could leave the origin are refused. An error never
  repeats a value from the file.
- report: a run report with one outcome per endpoint (conformant,
  non-conformant, no-verdict, unsupported), skipKind on skipped checks,
  expected and actual values on every X402-01..05 FAIL, and the Wasit and SDK
  versions read from the installed packages. A comment renderer, a baseline
  and a history to compare a pull request with main.
- unsupported: an x402 v1 body challenge and a network no payment adapter pays
  on are SKIP unsupported, not a FAIL or a preflight error. A service that was
  never graded exits 2, and so does a run that asked for payment checks when
  none could be graded: nothing is green that was not tested.
- sanitize: one module for everything printed, written to a report or put in
  a comment: control characters, workflow commands, secrets, links, mentions.
- redirects: the read checks follow one redirect inside the origin and never
  leave it. Paid requests keep today's behaviour.
- denied-env: the variables a service started by wasit must not see (keys,
  header values, the job's tokens and command files).
- server: the MCP output carries skipKind, expected and actual.
wasit run reads wasit.config.json and runs the read-only checks of each
endpoint, one after another, into one report (--json, --out). The payment tier
is not in this version: without --read-only it exits 2 before it reads the
config, and no flag that pays, signs or opts into mainnet exists.

- --start runs service.start, waits for service.ready, runs, and stops the
  service on a normal end, on an error and on SIGINT, SIGTERM and SIGHUP. The
  service does not receive Wasit's key variables, header variables, RPC url or
  the job's tokens. --start-if-local does the same only when service.start is
  set and the environment is on this machine, so a deployed endpoint is read as
  it is.
- --baseline compares with the report of the default branch: an endpoint graded
  there that is unsupported or without a verdict now is a regression, exit 1.
  Nothing graded is exit 2.
- .env is not read by wasit run when CI or GITHUB_ACTIONS is set.
- wasit ci-report writes the pull request comment, the job summary and the next
  baseline from the report. With no usable report it still writes a fixed "no
  verdict" comment, so the comment of the push before does not stay next to a
  red check, and it writes no baseline.
- wasit test and the MCP tool exit 2 for a service that was never graded
  (x402 v1) and for payment checks that could not be graded on the network.
  Terminal output goes through the one sanitiser.
A composite action (wasit-dev/wasit/action@<ref>) that a builder adds to a
workflow. On a pull request it builds Wasit from its own ref with the locked
dependencies, starts the service the config names, runs the read-only checks
(X402-01 to 05), and shows the result as the job result and as one comment that
is updated on each push, with what changed since main.

- The job result is the exit code of wasit run. The report step always runs; a
  run that left no report replaces the comment with "no verdict".
- The token reaches only the two steps that call gh, never the step that starts
  the service. Inputs reach the scripts as environment variables, never as text
  inside a run block. pull_request_target is refused.
- The baseline is the artifact of the latest successful push run of this
  workflow on the default branch, from this repository, chosen by run id. A run
  from a pull request or a fork is never used.
- The comment is found by its marker and by github-actions[bot]; a 403 on a
  fork's token is logged and does not fail the job.
- tier: payment is refused in this version. Linux runners only.
- Offline tests for the scripts (gh injected) and the YAML, wired into npm test
  and CI. A real workflow run is not part of this commit.
- yaml is an explicit devDependency at the version the lockfile already had.
…work

A channel commitment is the bytes that prepare_commitment returns from an RPC
the caller chooses, and the contract writes the network it runs on into them.
Before the key signs them, they are now decoded and must name the run's channel,
the amount the run means to sign, the commitment domain and the run's network,
the same rule the MPP SDK's own client applies. Anything else is refused as a
configuration error and nothing is signed. So the network the guard allowed is
also the network the signature is valid on, whatever the RPC returns.

Tests: a commitment for another network, channel, amount or domain, and bytes
that are not a commitment, are refused; a good one signs and verifies; the RPC
step never receives the key.
Testnet runs protocol 30. stellar-sdk 16.1.0 cannot decode its ledger header
("XDR Read Error: unknown StellarValueType member for value 3"), so every call
that reads one fails: getLatestLedger and getLedgers, and with them the MPP
channel server's on-chain state check, which then refuses every voucher.
16.4.1 decodes them.

16.4.1 is inside the range core declares (^16.1.0), so no package.json
changes; only the lockfile moves, with the SDK's own pins (axios 1.20.0,
follow-redirects 1.16.3). The separate 16.3.1 copy under @x402/stellar now
resolves to the same 16.4.1.
@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wasit Ready Ready Preview Nov 20, 2026 10:22pm UTC

…n refs

A pull request comment named "Wasit 0.7.0" for a build of an unreleased commit,
because the packages still declare 0.7.0. The Action now passes its ref to the
steps that run Wasit and write the report. When the ref is a full commit id, the
result names it ("built from commit 0123456"); a tag or a branch name says
nothing, since a pinned tag already names the version. The report parser accepts
the new optional field only as seven lower-case hex characters, and so does the
comment, whatever a report claims.

The reason under "Not graded" starts with a capital letter, as it follows a full
stop.

actions/upload-artifact in action.yml, and checkout and setup-node in the
template workflow, are pinned to full commit SHAs instead of version tags.
@dzakwannajmi dzakwannajmi changed the title feat: wasit run, wasit.config.json and a GitHub Action for the read-only checks feat(core,cli,action): wasit run, config file and GitHub Action for read-only checks; stellar-sdk 16.4.1 Nov 15, 2026
@dzakwannajmi
dzakwannajmi marked this pull request as ready for review November 20, 2026 22:25
@dzakwannajmi
dzakwannajmi merged commit 6c97b25 into main Nov 20, 2026
5 checks passed
@dzakwannajmi
dzakwannajmi deleted the sow2/s1-action branch November 21, 2026 09:55

This branch was successfully deployed

1 active deployment
Preview — f291358c Deployed Nov 20, 2026 by vercel[bot]
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