closes #363 closes #378 closes #381: lifecycle manager, capability discovery, production guide#424
Open
JoyAdah wants to merge 4 commits into
Open
closes #363 closes #378 closes #381: lifecycle manager, capability discovery, production guide#424JoyAdah wants to merge 4 commits into
JoyAdah wants to merge 4 commits into
Conversation
…d boot and graceful shutdown
|
@JoyAdah Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
closes #363
closes #378
closes #381
Summary
closes #378 — Capability-aware metadata discovery layer
Adds
packages/sdk/src/capabilityDiscovery.tswithCapabilityDiscoveryand acreateCapabilityDiscoveryfactory. The class probes Horizon and the Soroban RPC on first use, resolvesContractVersions,FeatureFlags, andBackendLimitsinto a typedBackendCapabilitiessnapshot, and caches it for a configurable TTL.negotiate(req)lets clients declare minimum protocol versions, minimum API versions, and required feature flags; it returns{ compatible, reason, capabilities }so integrations can fail fast before attempting unsupported operations.Falls back gracefully: if Soroban RPC is unreachable
sorobanEnabled = falserather than throwing.invalidateCache()forces a fresh probe. Full unit tests inpackages/sdk/src/__tests__/capabilityDiscovery.test.ts.closes #363 — Production startup/shutdown lifecycle
Adds
src/lifecycle.tswithServerLifecycle— a class that replaces the inlineServerclass insrc/index.ts. Provides ordered startup (DB → background services → HTTP bind), graceful shutdown with a configurable drain timeout, bounded port-retry onEADDRINUSE, exponential back-off for background-service restarts, andSIGTERM/SIGINT/uncaughtException/unhandledRejectionhandlers.Key improvements over the original:
shutdown()is idempotent (guarded byisShuttingDown)registerService()/registerDataSource()fluent API decouples wiring from startup logiccloses #381 — Production-oriented integration guide
Adds
packages/sdk/examples/production-integration-guide.tscovering 5 real-world scenarios:Test plan
cd packages/sdk && npx jest capabilityDiscovery— all tests passnpx ts-node packages/sdk/examples/production-integration-guide.ts— runs to completionServerLifecycle, send SIGTERM — graceful shutdown logged, process exits 0maxPortRetries