feat(admin-dashboard): keeper health and vault state panels - #626
Open
Mamavee001 wants to merge 1 commit into
Open
feat(admin-dashboard): keeper health and vault state panels#626Mamavee001 wants to merge 1 commit into
Mamavee001 wants to merge 1 commit into
Conversation
Adds the Keeper Health and Vault State read-only cards for the admin dashboard. Issue drydocs#615 depends on the (still open, separately-assigned) auth-gate issue drydocs#614, so this also adds a minimal admin route shell (/app/admin) with a placeholder client-side wallet gate for drydocs#614 to replace wholesale once it lands. - packages/stellar-sdk-helpers: new keeper-heartbeat.ts records/reads each keeper's last successful run (a signal keeper-state.ts's submission leases deliberately don't keep, since they clear on success). Adds fetchCoordinatorState to coordinator.ts for adapter/protocol, total shares/assets, and the pause flag. - api/v1/keepers/accrue.ts and rebalance.ts: record a heartbeat on a clean (zero-failure) run, best-effort, after the response status is already decided. - New public read endpoints: GET /api/v1/keepers/health and GET /api/v1/admin/vault-state, backed by packages/api-core/src/admin.ts and mirrored into the local Fastify server for dev parity. - apps/web: KeeperHealthPanel and VaultStatePanel components, their hooks, and the AdminDashboard page, matching VaultPanel's existing skeleton/error patterns. Tests added across the SDK, api-core, api, and web layers; existing suites still pass.
|
@Mamavee001 is attempting to deploy a commit to the Collins' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Mamavee001 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 #615
Note on the #614 dependency
This issue's acceptance criteria depend on #614 ("Admin dashboard: auth gate"), which is still open and assigned to someone else. Rather than block on it, this PR adds a minimal, explicitly-placeholder admin route shell (
/app/admin, gated client-side byuseIsAdminWalletagainst aVITE_ADMIN_ADDRESSESallow-list) so the two panels have somewhere to live.useIsAdminWalletis documented as a placeholder in its own comment and inAdminDashboard.tsx— #614 should replace it wholesale, not extend it. Nothing sensitive is actually gated by it: both new read endpoints are public, on-chain data, the same way/api/v1/vaultsalready is.Summary
PROTOCOL_LABELmapping, now shared out ofVaultPanel.tsx), total shares, total assets, and an Active/Paused badge.VaultPanel.tsx's existing loading-skeleton and error/retry patterns.Changes
SDK (
packages/stellar-sdk-helpers)keeper-heartbeat.ts: records/reads each keeper's last successful run. This is a genuinely new data source —keeper-state.ts's submission leases deliberately clear their record on success (they exist to dedup in-flight submissions, not to remember history), so "last successful run" wasn't recorded anywhere before. Backed by the same Upstash Redis REST APIkeeper-state.tsalready uses, with an in-memory fallback for local dev.coordinator.ts: newfetchCoordinatorStatereads the vault's active adapter/protocol, total shares, total assets, andis_paused().API
api/v1/keepers/accrue.ts/rebalance.ts: record a heartbeat on a clean (zero-failure) run only, best-effort, after the response status is already decided — a heartbeat-store hiccup never turns a successful run into a reported failure, and a failed run never reports healthy.GET /api/v1/keepers/healthandGET /api/v1/admin/vault-state, implemented inpackages/api-core/src/admin.tsand mirrored into the local Fastify server (apps/api-local) for dev parity.Frontend (
apps/web)KeeperHealthPanel.tsx,VaultStatePanel.tsx, their hooks (useKeeperHealth,useVaultState), andAdminDashboard.tsx(the page).App.tsxpicks between the main dashboard and/app/adminvia a plainpathnamecheck — no router dependency for one extra static route.PROTOCOL_LABELmoved out ofVaultPanel.tsxintolib/protocolLabels.tsso both panels share it without duplication.en.json/fr.json.Docs:
apps/docs/architecture/api.md(new endpoints),apps/docs/architecture/frontend.md(component structure),apps/docs/operations/environment-variables.mdand.env.example(VITE_ADMIN_ADDRESSES, documented as a placeholder).Test plan
packages/stellar-sdk-helpers: 296 tests pass (17 new, coveringkeeper-heartbeat.tsandfetchCoordinatorState).packages/api-core: 28 tests pass (10 new, coveringhandleGetKeeperHealth/handleGetVaultState).api(Vercel handlers): 50 tests pass (7 new/updated — heartbeat recorded on success and not on failure, plus the two new endpoints).apps/api-local: 24 tests pass (pre-existing, unaffected).apps/web: 101 tests pass (12 new, covering both panels and the dashboard's connect/unauthorized/authorized states).cargo testunaffected (no contract changes in this PR)./app/and/app/adminboth render correctly (disconnected states);eslintandtscclean across every touched package.Caveats
useIsAdminWalletwith real server-enforced auth.AdminDashboard.test.tsx).