CLI hardening: provider health checks, readable errors, incur 0.4.8#22
Merged
Conversation
… >=22 incur 0.4.x requires Node >=22; also removes the unused @remix-run/fs dependency.
The hardcoded version had drifted (0.0.4 vs 0.1.1), so --version reported the wrong number.
datasetLink, pieceLink, and dealbotLink were unused (flagged by knip); commands use the *ScannerUrl helpers.
Add mocks for provider-selection input + fetch health checks, piece hasMore, costs needsFwssMaxApproval, and createDataSet statusUrl (asserting statusUrl is forwarded). Drop the export keyword from fixtures only used in-file (flagged by knip).
OutputContext.fail passed a nested { error } object, but incur's c.error reads code/message off the top level, so every failure printed 'code: null, message: null'. Pass them at the top level; incur rebuilds the envelope. (incur's error path has no slot for processLog, so the step trail is surfaced on success only.)
summary emitted monthlyAccountRate and monthlyStorageRate with identical values; keep a single account rate. costs now surfaces needsFwssMaxApproval so callers can tell 'needs deposit' from 'needs approval only'.
Add --offset/--limit to dataset details and piece list; return hasMore/nextOffset and a CTA with the next-page command when more pieces remain (previously capped silently at 100).
The SDK's smartSelect requires an endorsed primary and pings with a 1s budget that excludes healthy-but-slow providers, so uploads failed even when providers were reachable. Pre-select reachable providers ourselves (endorsed first, falling back to a healthy approved provider; reduce copies if fewer are reachable) and pass explicit providerIds, bypassing smartSelect.
Document the pagination flags and needsFwssMaxApproval, replace the stale pricing minimum with the v1 model, sharpen triggering, and clarify the foc-cli vs foc-docs boundary.
Replace the seven duplicated `new Synapse({ client, source })` sites with a single `synapseClient(chainId)` helper returning { client, chain, synapse }. The source tag is resolved in one place — from the config store, defaulting to "foc-cli".
Persist `source` in the config store; `wallet init --source <name>` writes it (defaults to "foc-cli"). Document the setting in the README and skill.
The lint script only formatted src/, so test files drifted from biome's style and CI's `biome check src tests` failed. Format them and add tests/ to the lint script so local matches CI.
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 round of CLI hardening on top of the Synapse v1 bump:
code/messageinstead ofcode: null, message: null.incur→ 0.4.8 (requires Node ≥22), unused@remix-run/fsremoved,--versionnow read frompackage.json.dataset details/piece listgain--offset/--limitand a next-page CTA (previously capped silently at 100).wallet summary;wallet costsnow reportsneedsFwssMaxApproval.synapseClient(chainId)helper replaces seven duplicatednew Synapse(...)sites; thesourcetag is configurable viawallet init --source.foc-cli/foc-docsskill docs.Verification
tsc --noEmit+ biome clean, 40 tests pass.upload/multi-upload(2/3/4 copies) → dataset & piece lifecycle → withdraw, all verified live.