Skip to content

feat: RPC provider pool with health/failover/replay-pin and --plan dry-run - #1

Closed
Hovibby wants to merge 1 commit into
mainfrom
feat/rpc-provider-pool-and-plan-dry-run
Closed

feat: RPC provider pool with health/failover/replay-pin and --plan dry-run#1
Hovibby wants to merge 1 commit into
mainfrom
feat/rpc-provider-pool-and-plan-dry-run

Conversation

@Hovibby

@Hovibby Hovibby commented Jul 24, 2026

Copy link
Copy Markdown
Owner

closes pugsley76#518

closes pugsley76#515

Summary

Two features implemented per spec.

Feature A — RPC Provider Pool

  • ProviderPool with ordered endpoint selection, Healthy/Degraded/Down health states
  • Per-attempt context deadlines independent of parent context
  • Retryable (429/5xx/transport errors) trigger failover; non-retryable (4xx) return immediately — no duplicate requests
  • AttemptDiagnostics exposes every endpoint tried, latency, HTTP status; printed when failover occurs
  • WithReplayPinProvider locks pool to one endpoint for replay determinism; failure is explicit, no silent fallback
  • New builder options: WithPoolConfig, WithMaxRetries, WithRequestDeadline, WithReplayPinProvider
  • 11 tests: timeout, rate-limit, all-fail, no-duplicate, pinned, state transitions, context cancellation

Feature B — --plan dry-run

  • ExecutionPlan model listing network requests, files, simulator, signing provider, output destinations
  • RenderText() and RenderJSON() both deterministic and secret-safe (URL tokens, hex keys, PEM blocks redacted)
  • --plan flag added to: debug, audit:sign, export, session save
  • Plans built after validation, before all side effects — zero network/signing/file/process mutations
  • 17 tests: determinism, redaction, JSON schema, pinned provider, builder helpers, dry-run disclaimer

…y-run

Feature A - RPC provider pool (internal/rpc)
- Add ProviderPool with ordered endpoint selection, per-endpoint health
  state (Healthy/Degraded/Down), configurable failure thresholds and
  recovery interval
- Per-request context deadlines applied independently per attempt so a
  slow provider does not consume the parent deadline
- Classify retryable errors (429, 5xx, transport timeouts, connection
  resets) vs non-retryable (4xx) - non-retryable errors return
  immediately without consuming further provider attempts
- AttemptDiagnostics records every endpoint tried, latency, HTTP status,
  and retryability; exposed via Client.PoolDiagnostics() and printed to
  stdout when failover occurred during debug
- Replay pinning: WithReplayPinProvider(url) locks the pool to one
  endpoint and disables silent switching; failure returns an explicit
  error mentioning replay pinning - wired to --pin-endpoint in debug cmd
- New builder options: WithPoolConfig, WithMaxRetries, WithRequestDeadline,
  WithReplayPinProvider
- SimulateTransaction and GetHealth route through pool when configured;
  legacy selector path retained as fallback
- 11 tests: timeout failover, rate-limit retryable, all-providers-fail,
  non-retryable no-duplicate, pinned success/fail, state transitions,
  diagnostics formatting, context cancellation, live HTTP servers

Feature B - Execution plan model and --plan dry-run (internal/plan)
- ExecutionPlan model: NetworkRequests, Files, Simulator, Signing,
  Outputs, PinnedProvider, Notes
- RenderText() deterministic human-readable output with dry-run
  disclaimer; RenderJSON() stable JSON output
- redactURL strips token/key/secret query params from endpoint URLs
- redactKeyIdentifier redacts raw hex private keys (>=64 chars) and PEM
  blocks; passes through safe labels (PKCS11 CKA_LABEL, KMS ARN)
- Builder helpers: BuildDebugPlan, BuildAuditPlan, BuildExportPlan,
  BuildSessionSavePlan - use same resolved config as execution
- --plan flag added to: debug, audit:sign, export, session save
- Plans built after validation but before all side effects; no network
  calls, signing, simulator invocations, or file writes performed
- session.DefaultDBPath() added (no side effects, safe for plan use)
- 17 tests: determinism, redaction cases, JSON schema validation,
  pinned provider in output, builder helpers, dry-run disclaimer
@Hovibby Hovibby closed this in a0dce25 Aug 27, 2026
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.

Issue 11: Implement a resilient RPC provider pool Issue 8: Add a dry-run plan renderer for destructive or networked actions

1 participant