feat: indexer feature flag startup check, readiness latency, route-safe error mapping#1
Closed
davedumto wants to merge 1 commit into
Closed
feat: indexer feature flag startup check, readiness latency, route-safe error mapping#1davedumto wants to merge 1 commit into
davedumto wants to merge 1 commit into
Conversation
…fe error mapping - Add shared mapUnknownRouteError helper for the global error-middleware fallback path, embedding the request id for log correlation and hiding internals in production. Known-error branches (Zod, JWT, Prisma, ApiError, payload-too-large, malformed JSON) are unchanged. - Surface a top-level latencyMs field on GET /api/v1/health/ready measuring the total readiness probe duration. Per-check latency is preserved. - Introduce ENABLE_INDEXER_DEDUPE, ENABLE_INDEXER_DLQ and ENABLE_INDEXER_CURSOR_STALENESS_WARNING flags plus a centralized startup validator that aggregates every cross-field invariant breach into one actionable error and exits with code 1 on misconfiguration. - Add Jest tests for each helper and short docs covering the new envelope, the readiness metadata field and the indexer flag matrix.
Owner
Author
|
Superseded by upstream PR accesslayerorg#259. |
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.
Summary
Bundles three small, scoped server changes from the Stellar Wave queue:
Adds
mapUnknownRouteError()insrc/utils/route-error.utils.tsand wires it into the global error middleware fallback path. The helper embeds theX-Request-IDfor log correlation and hides internals (message/stack/raw error) in production. Existing dedicated branches for Zod, JWT, Prisma,ApiError, payload-too-large and malformed JSON are unchanged.GET /api/v1/health/readynow returns a top-levellatencyMsfield measuring the total readiness probe duration. Per-checklatencyMsis preserved. Payload remains public-safe.Adds
ENABLE_INDEXER_DEDUPE,ENABLE_INDEXER_DLQ,ENABLE_INDEXER_CURSOR_STALENESS_WARNINGenv flags and a centralized validator (runIndexerFeatureFlagsStartupCheck) called fromserver.tsbefore DB connect. Cross-field invariants (e.g. DLQ requires dedupe; staleness flag requires a sane threshold) are aggregated into a single actionable error and the process exits 1 on misconfiguration.Tests
route-error.utils.test.ts,health.controllers.test.tsandindexer-flags-startup-check.utils.test.ts— all green.tsc --noEmitclean. ESLint clean on changed files.Test plan
pnpm exec jest src/utils/route-error.utils.test.ts src/modules/health/health.controllers.test.ts src/utils/indexer-flags-startup-check.utils.test.tspassespnpm exec tsc --noEmitis cleancurl localhost:3000/api/v1/health/readyincludes a numeric top-levellatencyMsENABLE_INDEXER_DLQ=true ENABLE_INDEXER_DEDUPE=false pnpm devrefuses to start with a logged issues listCloses
closes accesslayerorg#245
closes accesslayerorg#242
closes accesslayerorg#213