Skip to content

Add feature flag for quote submissions#274

Merged
Starefossen merged 7 commits into
mainfrom
unleash-toggles
Mar 4, 2026
Merged

Add feature flag for quote submissions#274
Starefossen merged 7 commits into
mainfrom
unleash-toggles

Conversation

@Starefossen
Copy link
Copy Markdown
Member

Introduce a feature flag to control the submission of quotes, updating the UI components accordingly to reflect the flag's status. This change enhances user feedback and integrates a new API endpoint for fetching feature flags.

- Implemented a new API endpoint to fetch feature flags.
- Updated the QuoteDisplay component to disable the submit link based on the feature flag.
- Modified the Home component to fetch the feature flag and control the submission of new quotes.
- Enhanced the SubmitQuote component to reflect the feature flag status and provide user feedback when submissions are disabled.
- Introduced a utility for managing feature flags using Unleash.
- Updated unleash configuration for quotes-loadgen.
Comment thread quotes-analytics/Controllers/AnalyticsController.cs Fixed
Comment thread quotes-analytics/Controllers/AnalyticsController.cs Fixed
Comment thread quotes-analytics/Controllers/AnalyticsController.cs Fixed
Comment thread quotes-analytics/Controllers/AnalyticsController.cs Fixed
Comment thread quotes-analytics/Controllers/AnalyticsController.cs Fixed
Comment thread quotes-analytics/Services/QuotesAnalyticsService.cs Fixed
Comment thread quotes-analytics/Services/QuotesAnalyticsService.cs Fixed
Comment thread quotes-analytics/Services/QuotesAnalyticsService.cs Fixed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Unleash-based feature flagging across the quotes example services, gating quote submission (and backend error injection) and wiring NAIS + local dev configuration to support toggles.

Changes:

  • Introduces Unleash clients and /api/features endpoints (frontend + backend) to expose flag states.
  • Gates quote submission in both frontend UI and backend POST handler; adds an error-injection toggle for backend.
  • Updates NAIS manifests, local dev (.mise.toml), docker-compose, and docs to include Unleash configuration.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
quotes-loadgen/.nais/unleash.yaml Provisions Unleash ApiToken for loadgen service
quotes-frontend/src/utils/unleash.ts Adds Node Unleash client helper + flag constants
quotes-frontend/src/app/api/features/route.ts Adds frontend /api/features route
quotes-frontend/src/app/submit-quote/page.tsx Disables submit UI based on feature flag
quotes-frontend/src/app/page.tsx Disables “Submit a New Quote” entry point based on flag
quotes-frontend/src/tests/components/QuoteDisplay.test.tsx Adds coverage for disabled submit link styling
quotes-frontend/package.json / pnpm-lock.yaml Adds unleash-client dependency
quotes-frontend/.nais/unleash.yaml / .nais/app.yaml Provisions token + mounts secret via envFrom
quotes-frontend/.mise.toml Adds local Unleash env vars
quotes-backend/src/main/kotlin/.../FeatureFlags.kt Adds backend Unleash integration and flag defaults
quotes-backend/src/main/kotlin/.../Application.kt Applies flags to submission + error injection; adds backend /api/features
quotes-backend/build.gradle.kts Adds Unleash Java client dependency
quotes-backend/.nais/unleash.yaml / .nais/app.yaml Provisions token + mounts secret via envFrom
quotes-backend/.mise.toml Adds local Unleash env vars
quotes-analytics/Services/QuotesAnalyticsService.cs Sanitizes IDs before logging/activity tags
quotes-analytics/Controllers/AnalyticsController.cs Sanitizes IDs before logging
quotes-analytics/.nais/unleash.yaml Switches to Unleash ApiToken provisioning
docker-compose.yaml Adds Unleash admin bootstrap + injects Unleash env vars into services
README.md / AGENTS.md Documents Unleash feature flag setup and usage
.github/workflows/service-pipeline.yaml / codeql.yml Updates pinned action SHAs
.github/workflows/dependabot-auto-merge.yaml Changes trigger to pull_request_target
Files not reviewed (1)
  • quotes-frontend/pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

quotes-analytics/Services/QuotesAnalyticsService.cs:358

  • SanitizeForLog is duplicated here and in AnalyticsController. Consider moving it to a shared utility (or a small internal static helper class) to avoid diverging implementations if the sanitization rules change.

}

quotes-analytics/Controllers/AnalyticsController.cs:120

  • SanitizeForLog is duplicated here and in QuotesAnalyticsService. Consider centralizing it (shared utility/helper) so the sanitization logic stays consistent.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread quotes-analytics/.nais/unleash.yaml Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread .github/workflows/dependabot-auto-merge.yaml
Comment thread AGENTS.md
Comment thread quotes-backend/.nais/unleash.yaml Outdated
Comment thread quotes-frontend/src/utils/unleash.ts Outdated
Comment thread quotes-frontend/src/app/api/features/route.ts Outdated
Comment thread quotes-backend/src/main/kotlin/io/nais/quotesbackend/FeatureFlags.kt Outdated
@Starefossen Starefossen merged commit 226bfa5 into main Mar 4, 2026
18 checks passed
@Starefossen Starefossen deleted the unleash-toggles branch March 4, 2026 10:14
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.

3 participants