Skip to content

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

@github-actions

Description

@github-actions

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions