Skip to content

fix: resolve issues #860, #861, #862#871

Merged
Mathews-25 merged 1 commit into
AgesEmpire:mainfrom
BethelDev-io:fix/issues-860-861-862
Jul 17, 2026
Merged

fix: resolve issues #860, #861, #862#871
Mathews-25 merged 1 commit into
AgesEmpire:mainfrom
BethelDev-io:fix/issues-860-861-862

Conversation

@BethelDev-io

Copy link
Copy Markdown
Contributor

closes #860
closes #861
closes #862

Issue #860 — API key scope validation per endpoint

  • Add ApiKeyScope enum (signals:read/write, trades:read/write, portfolio:read, analytics:read, admin:*)
  • Create ApiKeyScopesGuard that reads @RequireScopes metadata and rejects with 403 on missing scopes
  • Update @RequireScopes decorator to use ApiKeyScope enum (type-safe)
  • Update CreateApiKeyDto, ApiKeyResponseDto, ApiKey entity to use ApiKeyScope enum
  • Refactor ApiKeyAuthGuard to handle auth only; scope enforcement moved to ApiKeyScopesGuard
  • Apply @RequireScopes to all trade and signal endpoints
  • Export ApiKeyScopesGuard from ApiKeysModule
  • Unit tests: correct scope granted, missing scope 403, admin wildcard, no key 401

Issue #861 — Mandatory idempotency key for trade execution and signal creation

  • Add RequireIdempotencyKeyGuard that enforces Idempotency-Key header
  • Missing header returns 400 Bad Request with clear instructions
  • Concurrent duplicate returns 409 Conflict with Retry-After: 2 header
  • Add @UseGuards(RequireIdempotencyKeyGuard) to POST /trades/execute
  • Add @UseGuards(RequireIdempotencyKeyGuard) and IdempotencyInterceptor to POST /signals
  • Unit tests: missing header 400, empty header 400, valid header pass, concurrent 409, post-finish reuse

Issue #862 — Comprehensive health check probes

  • Add GET /health/live explicit liveness endpoint (process-alive, no dependency checks)
  • Existing GET /health/ready readiness probe checks database, Redis, BullMQ, Soroban RPC
  • Update k8s/base/deployment.yaml to use /health/live for startup and liveness probes
  • Unit tests: /live returns 200 with empty indicator list, /ready returns 503 on each dependency failure (postgres, redis, soroban), latency field present in all results

Issue AgesEmpire#860 — API key scope validation per endpoint
- Add ApiKeyScope enum (signals:read/write, trades:read/write, portfolio:read, analytics:read, admin:*)
- Create ApiKeyScopesGuard that reads @RequireScopes metadata and rejects with 403 on missing scopes
- Update @RequireScopes decorator to use ApiKeyScope enum (type-safe)
- Update CreateApiKeyDto, ApiKeyResponseDto, ApiKey entity to use ApiKeyScope enum
- Refactor ApiKeyAuthGuard to handle auth only; scope enforcement moved to ApiKeyScopesGuard
- Apply @RequireScopes to all trade and signal endpoints
- Export ApiKeyScopesGuard from ApiKeysModule
- Unit tests: correct scope granted, missing scope 403, admin wildcard, no key 401

Issue AgesEmpire#861 — Mandatory idempotency key for trade execution and signal creation
- Add RequireIdempotencyKeyGuard that enforces Idempotency-Key header
- Missing header returns 400 Bad Request with clear instructions
- Concurrent duplicate returns 409 Conflict with Retry-After: 2 header
- Add @UseGuards(RequireIdempotencyKeyGuard) to POST /trades/execute
- Add @UseGuards(RequireIdempotencyKeyGuard) and IdempotencyInterceptor to POST /signals
- Unit tests: missing header 400, empty header 400, valid header pass, concurrent 409, post-finish reuse

Issue AgesEmpire#862 — Comprehensive health check probes
- Add GET /health/live explicit liveness endpoint (process-alive, no dependency checks)
- Existing GET /health/ready readiness probe checks database, Redis, BullMQ, Soroban RPC
- Update k8s/base/deployment.yaml to use /health/live for startup and liveness probes
- Unit tests: /live returns 200 with empty indicator list, /ready returns 503 on each
  dependency failure (postgres, redis, soroban), latency field present in all results
@Mathews-25
Mathews-25 merged commit 02f6385 into AgesEmpire:main Jul 17, 2026
1 of 7 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

2 participants