Skip to content

Dampen repeated failed SDK queries#68

Open
Seranged wants to merge 1 commit into
mainfrom
fix/v3-query-failure-backoff
Open

Dampen repeated failed SDK queries#68
Seranged wants to merge 1 commit into
mainfrom
fix/v3-query-failure-backoff

Conversation

@Seranged

Copy link
Copy Markdown
Contributor

Summary

  • Add a short failure TTL to the SDK default query cache so repeated identical failed queries rethrow locally instead of hammering the underlying transport.
  • Document the new failureTtlMs cache option and the current V3 vault resolve path.

Changes

  • Extend QueryCacheConfig with failureTtlMs, defaulting to 5 seconds alongside the existing success TTL.
  • Preserve the old immediate-retry behavior when consumers set failureTtlMs: 0.
  • Cover cached failures, opt-out behavior, and cooldown expiry in the read-path infrastructure test.

Context

Test plan

  • pnpm --filter @eulerxyz/euler-v2-sdk test -- readPathInfra.test.ts
  • pnpm --filter @eulerxyz/euler-v2-sdk typecheck
  • pnpm --filter @eulerxyz/euler-v2-sdk build
  • pnpm --filter @eulerxyz/euler-v2-sdk lint (exits 0; reports existing unrelated warnings in src/utils/irm.ts, src/utils/oracle.ts, and src/utils/stateOverrides/*)

Cache failed query results briefly in the default SDK query cache to avoid repeated transport hits during upstream degradation.

@LeonardEulerXYZ LeonardEulerXYZ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leonard review — approved

Reviewed current head c4a7670159d98c022c0c0224c61218ea62f09999 for euler-xyz/euler-sdks PR #68.

Walkthrough

  • Adds failureTtlMs to the built-in QueryCacheConfig and default query cache implementation.
  • Failed decorated query* calls now rethrow from the local cache during a short cooldown instead of repeatedly hitting the underlying RPC/HTTP transport.
  • failureTtlMs: 0 preserves the prior immediate-retry behavior.
  • Documentation now describes the success/failure TTL split and the current V3 vault resolver path.
  • Tests cover cached failures, opt-out behavior, and cooldown expiry.

Validation performed

  • Inspected full diff and surrounding SDK query-cache/buildSDK context.
  • Reviewed package export/type surface: QueryCacheConfig.failureTtlMs appears in built declarations after build.
  • Security/supply-chain sweep: no package, lockfile, workflow, script, dependency, secret, telemetry, network-target, or executable-config changes in the PR diff.
  • Scalability / maintainability hygiene pass: traced the central resolvedBuildQuery/applyBuildQuery path across services, adapters, and plugins; this is correctly implemented once in the shared query-cache abstraction rather than duplicated per V3/RPC callsite. Similar query consumers inherit the behavior through the existing decorator wiring, while custom buildQuery consumers remain intentionally out of scope.
  • Active bot/reviewer feedback: no prior comments, formal reviews, or inline review comments were present to verify/refute.

Commands run locally:

  • pnpm install --frozen-lockfile
  • pnpm --filter @eulerxyz/euler-v2-sdk test -- readPathInfra.test.ts — passed; Vitest selected the package test suite, 26 files / 346 tests passed.
  • pnpm --filter @eulerxyz/euler-v2-sdk typecheck — passed.
  • pnpm --filter @eulerxyz/euler-v2-sdk build — passed.
  • pnpm --filter @eulerxyz/euler-v2-sdk lint — exited 0 with existing unrelated warnings in src/utils/irm.ts, src/utils/oracle.ts, and src/utils/stateOverrides/*, matching the PR test plan.

Verdict

Approved. I did not find blocking correctness, SDK API compatibility, generated-package, dependency, build, type-safety, protocol-integration, security, or downstream consumer risks.

Comment lifecycle: no prior Leonard walkthrough, formal review, or inline comments found; no cleanup needed.

Screenshots: not applicable — this PR changes SDK cache behavior and docs, not a user-visible UI.

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.

2 participants