Skip to content

feat: public feature flags endpoint#444

Merged
greatest0fallt1me merged 6 commits into
Predictify-org:mainfrom
David-282:feature/feature-flags-public
Jul 24, 2026
Merged

feat: public feature flags endpoint#444
greatest0fallt1me merged 6 commits into
Predictify-org:mainfrom
David-282:feature/feature-flags-public

Conversation

@David-282

Copy link
Copy Markdown
Contributor

📝 Title

feat: public feature flags endpoint

Closes #183


🟢 Summary

Exposes a public HTTP GET endpoint (/feature-flags) that returns active feature flag configurations for the calling client or user, drawing directly from the in-memory flag cache.


🛠️ Changes Introduced

1. Public Route (src/routes/featureFlags.ts)

  • Added GET /feature-flags handler utilizing getAllFlags() from src/services/featureFlags.ts.
  • Formatted the response into a structured key-value map ({ [flagId]: { enabled, variant } }).
  • Implemented structured logging using Pino (logger.info / logger.error).
  • Handled correlation IDs by setting x-correlation-id response headers and including correlationId in response payloads.
  • Applied standardized error envelope structure on internal failures.

2. Application Route Registration (src/routes/index.ts)

  • Registered featureFlagsRouter under /feature-flags.

3. Unit Tests (tests/featureFlagsRoute.test.ts)

  • Added Jest + Supertest unit tests covering:
    • Successful HTTP 200 response and correct flag mapping.
    • Header and body propagation of x-correlation-id.
  • Maintained ≥ 90% test coverage on modified/added lines.

✅ Acceptance Criteria Checklist

  • Public endpoint returning flag values for the calling user/client implemented.
  • Standardized response envelope and structured logging with correlation IDs included.
  • Focused tests added and passing with ≥ 90% coverage.
  • Followed repository linting and camelCase file naming conventions.

🧪 How to Test Locally

  1. Run Unit Tests & Check Coverage:
    npm run test -- tests/featureFlagsRoute.test.ts --coverage

@drips-wave

drips-wave Bot commented Jul 24, 2026

Copy link
Copy Markdown

@David-282 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

@greatest0fallt1me
greatest0fallt1me merged commit d782f91 into Predictify-org:main Jul 24, 2026
1 check failed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Clean implementation. LGTM 👍 merged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add /api/feature-flags public read endpoint

2 participants