Skip to content

feat: circuit breaker, idempotency middleware, mutation testing & RLS coverage#677

Open
Grace-CODE-D wants to merge 4 commits into
StellerCraft:mainfrom
Grace-CODE-D:feat/issue-052-vercel-circuit-breaker
Open

feat: circuit breaker, idempotency middleware, mutation testing & RLS coverage#677
Grace-CODE-D wants to merge 4 commits into
StellerCraft:mainfrom
Grace-CODE-D:feat/issue-052-vercel-circuit-breaker

Conversation

@Grace-CODE-D
Copy link
Copy Markdown
Contributor

@Grace-CODE-D Grace-CODE-D commented May 27, 2026

Summary

Test plan

  • Verify vercel-circuit-breaker.test.ts passes — covers all 4 state transition paths and fail-fast
  • Verify idempotency.test.ts passes — covers deduplication, cross-user isolation, non-2xx not cached, TTL expiry
  • Verify supabase/tests/rls/policy-verification.test.ts passes — 8 table suites including new github_vercel_deployments and deployment_updates tests
  • Review updated stryker.conf.json glob covers all backend service files without test/fixture exclusions
  • Review openapi.yaml POST /deployments section with Idempotency-Key header

Closes #585, closes #586,closes #587, closes #588

🤖 Generated with Claude Code

Grace-CODE-D and others added 4 commits May 27, 2026 15:08
- Add onStateChange callback to CircuitBreaker for state-transition logging
- Configure vercel circuit breaker thresholds via VERCEL_CB_FAILURE_THRESHOLD
  and VERCEL_CB_RESET_TIMEOUT_MS environment variables (defaults: 5 / 30000)
- Log CLOSED/OPEN/HALF_OPEN transitions with metadata to console
- Document circuit breaker configuration and behaviour in vercel.service.ts
- Add vercel-circuit-breaker.test.ts covering all state transitions:
  CLOSED→OPEN, OPEN→HALF_OPEN, HALF_OPEN→CLOSED, HALF_OPEN→OPEN
- Test fail-fast behaviour and onStateChange callback

Closes StellerCraft#588

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t creation

- Add withIdempotency middleware that reads Idempotency-Key header
- Cache successful responses per user+key within a configurable TTL (default 24h)
- Scope keys per authenticated user to prevent cross-tenant collisions
- Apply middleware to POST /api/deployments route
- Return Idempotent-Replayed: true header on cached responses
- Document Idempotency-Key header in openapi.yaml with full request/response spec
- Configure TTL via IDEMPOTENCY_TTL_MS environment variable

Closes StellerCraft#587

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extend stryker.conf.json mutate glob to cover all core services in
  apps/backend/src/services/**/*.ts (test/fixture/helper files excluded)
- Extend testPathPattern to include all *.test.ts, *.integration.test.ts,
  and *.property.test.ts under services/
- Set uniform 80% high / 70% medium / 60% low per-file threshold for all
  core service files (previously only 6 services were targeted)
- Update docs/mutation-testing.md with new configuration, per-file threshold
  table, and achieved scores matrix

Closes StellerCraft#586

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Enumerate all 8 RLS-protected tables and add enforcement tests for each
- Add policy predicates for github_vercel_deployments (authenticated SELECT,
  service_role ALL) and deployment_updates (per-user ALL policy)
- Add test suites 6-8 to policy-verification.test.ts:
  * github_vercel_deployments: authenticated SELECT, anon denial, service_role bypass
  * deployment_updates: SELECT/INSERT/UPDATE/DELETE cross-user isolation, ownership
    transfer blocked, service_role bypass
  * Anonymous denial: comprehensive anon denial across all 15 policy+table combinations
- Extend service-role bypass table to include deployment_updates
- Update docs/rls-audit.md with full 8-table per-table coverage matrix,
  policy details for github_vercel_deployments and deployment_updates

Closes StellerCraft#585

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@Grace-CODE-D 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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment