Skip to content

Add FeatureFlag type alias for consistent feature flag handling#6870

Merged
pelikhan merged 4 commits intomainfrom
copilot/add-feature-flag-type-alias
Dec 18, 2025
Merged

Add FeatureFlag type alias for consistent feature flag handling#6870
pelikhan merged 4 commits intomainfrom
copilot/add-feature-flag-type-alias

Conversation

Copy link
Contributor

Copilot AI commented Dec 18, 2025

  • Add FeatureFlag type alias in pkg/constants/constants.go
  • Move SafeInputsFeatureFlag constant from pkg/workflow/safe_inputs.go to pkg/constants/constants.go with new type
  • Move MCPGatewayFeatureFlag constant from pkg/workflow/gateway.go to pkg/constants/constants.go with new type
  • Update isFeatureEnabled() function signature in pkg/workflow/features.go to accept FeatureFlag type
  • Update call sites in pkg/workflow/safe_inputs.go and pkg/workflow/gateway.go to use constants from pkg/constants
  • Update call sites in pkg/workflow/sandbox.go to use typed constant
  • Add tests for the new FeatureFlag type in pkg/constants/constants_test.go
  • Run make test-unit to validate changes (feature flag tests pass)
  • Run make build to ensure compilation works
  • Run make lint to ensure code quality standards
Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Add FeatureFlag type alias for consistent feature flag handling</issue_title>
<issue_description>## Objective

Create a FeatureFlag type alias in the constants package to provide type safety and clearer intent for feature flag constants and function parameters.

Context

Feature flag constants like SafeInputsFeatureFlag are currently untyped strings. Adding a semantic type alias would:

  • Provide compile-time type safety
  • Make the API clearer
  • Prevent typos and misuse
  • Follow the pattern established by LineLength and Version types

Implementation Steps

  1. Add type alias in pkg/constants/constants.go:
// FeatureFlag represents a feature flag identifier
type FeatureFlag string
  1. Update feature flag constant declarations:
const SafeInputsFeatureFlag FeatureFlag = "safe-inputs"
// Update other feature flag constants similarly
  1. Update function signatures that accept feature flags to use the new type
  2. Grep for feature flag usage and update as needed: grep -r "FeatureFlag" pkg/

Files to Modify

  • pkg/constants/constants.go - Add type alias and update constants
  • Functions that accept feature flags - Update parameter types
  • Call sites - Ensure they use the typed constants

Acceptance Criteria

  • FeatureFlag type alias defined
  • All feature flag constants use the new type
  • Function signatures updated to accept FeatureFlag type
  • Code compiles without errors
  • All tests pass (make test)
  • Pattern documented for future feature flags

Estimated Effort

30 minutes

Priority

Very Low - Nice to have for consistency, minimal functional impact
Related to #6836

AI generated by Plan Command for discussion #6829

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add FeatureFlag type alias for feature flag handling Add FeatureFlag type alias for consistent feature flag handling Dec 18, 2025
Copilot AI requested a review from mnkiefer December 18, 2025 15:16
@pelikhan pelikhan marked this pull request as ready for review December 18, 2025 15:40
@pelikhan
Copy link
Contributor

@copilot lint

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot lint

Fixed linter error in b5a7a72. Removed redundant type declaration from test variable.

@pelikhan pelikhan merged commit 50bd765 into main Dec 18, 2025
3 checks passed
@pelikhan pelikhan deleted the copilot/add-feature-flag-type-alias branch December 18, 2025 15:51
Copilot AI requested a review from pelikhan December 18, 2025 15:52
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.

[plan] Add FeatureFlag type alias for consistent feature flag handling

3 participants