Conversation
A blank or whitespace-only --base-url / --rpc-url (or the matching env var) previously became an empty string, because the explicit || env || default chain treats whitespace as truthy. That silently broke every subsequent API or RPC call in the invocation. Resolve each candidate by trimming and only continue to the next one when the value is empty, so a blank candidate falls through to the env/default fallback. Added test/config.test.ts to pin down the fallback precedence for both resolveBaseUrl and resolveRpcUrl. Verified: npm run test:cli (67/67), CLI typecheck, prettier, cli build.
This branch was successfully deployed
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.
Summary
A blank or whitespace-only
--base-url/--rpc-url(or the matchingAGENTVOUCH_BASE_URL/AGENTVOUCH_RPC_URL/ANCHOR_PROVIDER_URLenv vars) was being passed straight through as an empty string, breaking every API and RPC call in that CLI invocation.Every CLI command routes through
resolveBaseUrl/resolveRpcUrlinpackages/agentvouch-cli/src/lib/config.ts. Those used anexplicit || env || defaultchain that treats whitespace as truthy, so a value of" "short-circuited the fallback and resolved to""instead of the protocol default.Added a
firstNonBlankhelper that trims each candidate and only advances the chain when the value is empty, so blank/whitespace candidates fall through to the next candidate (env, then the protocol default).resolveBaseUrlkeeps its trailing-slash normalization;resolveRpcUrlkeeps its env-chain ordering.Behavior
resolveBaseUrl("")/resolveBaseUrl(" ")→ nowhttps://agentvouch.xyz(was"")resolveRpcUrl("")/resolveRpcUrl("\n\r\t")→ nowhttps://api.devnet.solana.com(was"")AGENTVOUCH_RPC_URLthenANCHOR_PROVIDER_URL) preserved.Test plan
packages/agentvouch-cli/test/config.test.tspins fallback precedence for both resolvers (default, env, explicit, blank, whitespace-only, trailing-slash, env ordering).npm run test:cli→ 12 files / 67 tests all pass.npm run typecheck --workspace @agentvouch/cli→ clean.npx prettier --checkon both changed files → clean.npm run build --workspace @agentvouch/cli→ build success.