fix(playground): standardize RPC env and post-rename demo/tooling fixes#195
Open
EfeDurmaz16 wants to merge 3 commits into
Open
fix(playground): standardize RPC env and post-rename demo/tooling fixes#195EfeDurmaz16 wants to merge 3 commits into
EfeDurmaz16 wants to merge 3 commits into
Conversation
Greptile SummaryThis PR fixes several playground demo and tooling issues.
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (4): Last reviewed commit: "fix(playground): scope the sessions dev ..." | Re-trigger Greptile |
Collaborator
|
Hmm, let's do this the other way, and get rid of |
The Python and Ruby playgrounds read PAY_KIT_RPC_URL, but the TS and Go playgrounds read the bare RPC_URL. A generic RPC_URL set for an unrelated service or cluster would silently redirect the backend's RPC and settle on a different fork. Move the TS and Go backends (and the Go CI step that feeds them) onto the namespaced PAY_KIT_RPC_URL so every language's playground reads one knob and the ambient bare RPC_URL is gone. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
EfeDurmaz16
force-pushed
the
fix/python-playground-rpc-env
branch
from
June 29, 2026 11:58
24f18d9 to
cbfe7cb
Compare
Collaborator
Author
|
Good call. Flipped it the other way: the TS and Go backends (and the Go CI step that fed |
…arget Three issues found while testing the playground, all post-solana-foundation#193 leftovers or demo gaps: - flow.ts polled /__402/payment-channels/receipt/:id, but both servers serve /sessions/receipt/:id and the Vite proxy only forwarded /__402, so the session demo never surfaced its on-chain settle signature. Point the client back at /sessions/receipt and add the /sessions proxy entry. - The endpoint workbench sent no request body, so the x402 upto summarize gate always metered 0 bytes and settled the 1-token minimum, hiding the usage-based billing. Send a sample text body for POST endpoints (summarize is the only one), so the demo shows real per-byte metering. - python/Justfile ran pytest --cov=pay_kit after the package was renamed to solana_pay_kit, measuring 0% and tripping the 90% gate. Point it at solana_pay_kit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
'/sessions' as a prefix proxy shadowed the SPA's own /sessions page: in vite dev a refresh or deep-link on /sessions was forwarded to the API, which has no GET /sessions handler, returning a 404 JSON blob instead of the page whose receipt poll this branch fixes. Scope the rule to '^/sessions/' so only the receipt poll (/sessions/receipt/:channelId) hits the API, matching the '^/x402/' pattern above it. Also update the last stale RPC_URL row in playground/README.md to PAY_KIT_RPC_URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Cross-language playground fixes, grouped because they all surfaced while getting the playground demo working end to end.
1. Standardize the RPC override on
PAY_KIT_RPC_URLPython and Ruby read
PAY_KIT_RPC_URL; TS and Go read the bareRPC_URL. A genericRPC_URLset for another service could silently redirect the backend's RPC and settle on a different fork. Move the TS and Go backends (and the Go CI step) onto the namespacedPAY_KIT_RPC_URLso every backend reads one knob. Per @lgalabru's review.2. Restore the session receipt route (post-#193 leftover)
flow.tspolled/__402/payment-channels/receipt/:id, but both servers serve/sessions/receipt/:idand the Vite proxy only forwarded/__402, so the session demo never surfaced its on-chain settle signature. Point the client back at/sessions/receiptand add the/sessionsproxy entry.3. Send a metered POST body so the upto demo shows real billing
The endpoint workbench sent no request body, so the x402
uptosummarize gate always metered 0 bytes (summarizedBytes: 0) and settled the 1-token minimum, makinguptolook like a flat charge. Send a sample text body for POST endpoints (summarize is the only one), so the demo shows per-byte usage-based billing.4. Fix the Python coverage target (post-#193 leftover)
python/Justfileranpytest --cov=pay_kitafter the package was renamed tosolana_pay_kit, measuring 0% and tripping the 90% gate. Point it atsolana_pay_kit.Test
Go playground builds; Python tests green; the rest verified against the running playground.
Read order
typescript/examples/playground-api/index.ts, the env rename at the reference implementationgo/examples/playground-api/main.go, same rename mirrored in Go.github/workflows/go.yml, CI boot env renamed in lockstepplayground/app/src/lib/flow.ts, receipt poll repointed to the live/sessions/receipt/:channelIdrouteplayground/app/vite.config.ts, the dev proxy enabling that poll (scoped to^/sessions/)playground/app/src/components/EndpointWorkbench.tsx, sample POST body so the summarize demo meters real bytespython/Justfile, coverage target renamed to the actualsolana_pay_kitpackageGenerated vs handwritten
No generated files; ~30 handwritten changed lines across 10 files, all reviewable in one pass.
Reviewer note
Everything cross-checks against all three playground server implementations, and the response shape of the receipt route (
{settledSignature, finalized}) was verified in TS, Go, and Python. The one place that bit us was the vite proxy: a bare/sessionsprefix shadowed the SPA's own Sessions page on refresh; fixed in 050ca12 by scoping to^/sessions/.Fable 5 self-review
The env rename and receipt-route fix are done properly, CI updated in the same commit. But the first cut shipped a proxy rule that broke refresh on the very page whose poll it fixes, despite the
^/x402/precedent on the adjacent line: a copy-the-pattern miss, caught in re-check and fixed (050ca12) along with the last staleRPC_URLrow inplayground/README.md.SAMPLE_POST_BODYquietly assumes every POST endpoint wants prose; true today across all three APIs, worth gating on the endpoint id if a JSON POST endpoint ever lands.