Skip to content

Add request correlation IDs and Kubernetes deployment manifests.#179

Merged
robertocarlous merged 1 commit into
mainfrom
feat/correlation-id-and-k8s-deploy
Jun 18, 2026
Merged

Add request correlation IDs and Kubernetes deployment manifests.#179
robertocarlous merged 1 commit into
mainfrom
feat/correlation-id-and-k8s-deploy

Conversation

@Abidoyesimze

Copy link
Copy Markdown
Contributor

Summary

Closes #168
Closes #167

#168 — Correlation ID details

Area Change
Middleware correlationIdMiddleware validates incoming IDs (alphanumeric/hyphen/underscore, max 128 chars), attaches to req.correlationId and res.locals, returns X-Request-ID header
Logging Winston injects correlationId via AsyncLocalStorage; request and error logs include it
On-chain ops transaction-controller logs before/after deposit/withdraw submission with correlationId
Stellar events Per-event correlation ID in handleEvent; failed events retain ID in DLQ payload._metadata
Agent jobs Job-scoped IDs for rebalance, snapshot, and daily scan; stored in agent_logs.inputData
Errors 500 responses include "requestId" in JSON body
Docs readme.md documents header convention for client integrators

#167 — Kubernetes details

Manifest Purpose
deployment.yaml App container (node dist/index.js), initContainer migration, liveness /health/live, readiness /health/ready
service.yaml ClusterIP on port 3001
ingress.yaml TLS termination
configmap.yaml Non-secret env (CORS, rate limits, RPC URLs, log level)
secret.yaml.example Template for DATABASE_URL, JWT_SEED, WALLET_ENCRYPTION_KEY, STELLAR_AGENT_SECRET_KEY, ANTHROPIC_API_KEY, ADMIN_API_TOKEN, TWILIO_AUTH_TOKEN
migration-job.yaml Standalone pre-deploy prisma migrate deploy Job
hpa.yaml Pinned to 1 replica (event listener + agent cron require single active consumer)

docs/DEPLOYMENT.md covers prerequisites, staging vs production env matrix, rollout/rollback procedures, and the architectural constraint that multiple replicas are unsafe until API/worker split.

Test plan

  • npm run lint:types passes
  • tests/unit/middleware/correlationId.test.ts — preserves client ID, generates when missing, validates format
  • tests/integration/correlationId.integration.test.ts — single request ID across HTTP header, handler, and logs
  • tests/unit/stellar/dlq-correlation.test.ts — DLQ retains correlationId in payload metadata
  • kubeconform CI workflow validates manifests on merge
  • Manual: deploy to staging cluster, verify /health/ready returns 200 after initContainer migration
  • Manual: send X-Request-ID on deposit request, confirm header echoed and ID appears in logs

Introduce X-Request-ID propagation across HTTP logs, on-chain ops, Stellar events, DLQ, and agent jobs (#168), and add production K8s manifests with a deployment runbook (#167).

Co-authored-by: Cursor <cursoragent@cursor.com>
@robertocarlous robertocarlous merged commit 776639f into main Jun 18, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants