Skip to content

CLI hardening: provider health checks, readable errors, incur 0.4.8#22

Merged
nijoe1 merged 12 commits into
mainfrom
chore/cli-hardening
Jun 16, 2026
Merged

CLI hardening: provider health checks, readable errors, incur 0.4.8#22
nijoe1 merged 12 commits into
mainfrom
chore/cli-hardening

Conversation

@nijoe1

@nijoe1 nijoe1 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

A round of CLI hardening on top of the Synapse v1 bump:

  • Uploads survive provider hiccups — a pre-flight provider health check (outside the SDK's strict 1s ping) selects reachable providers (endorsed first, with fallback to a healthy approved one) and reduces copies gracefully instead of failing the whole upload.
  • Readable errors — fixed the output envelope so failures show the real code/message instead of code: null, message: null.
  • incur → 0.4.8 (requires Node ≥22), unused @remix-run/fs removed, --version now read from package.json.
  • Paginationdataset details / piece list gain --offset/--limit and a next-page CTA (previously capped silently at 100).
  • Wallet output fixes — deduped the monthly rate in wallet summary; wallet costs now reports needsFwssMaxApproval.
  • Centralized Synapse setup — one synapseClient(chainId) helper replaces seven duplicated new Synapse(...) sites; the source tag is configurable via wallet init --source.
  • Dead-code / knip cleanup and refreshed foc-cli / foc-docs skill docs.

Verification

  • tsc --noEmit + biome clean, 40 tests pass.
  • End-to-end on Calibration testnet: init → fund → deposit → upload / multi-upload (2/3/4 copies) → dataset & piece lifecycle → withdraw, all verified live.

nijoe1 added 12 commits June 16, 2026 15:35
… >=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.
@nijoe1 nijoe1 merged commit ed50ca6 into main Jun 16, 2026
1 check passed
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