-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(FF): CI check to prevent hardcoding of FFs #2790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR enhances the CI workflow to prevent hardcoded feature flags by adding two validation checks: (1) detecting hardcoded boolean literals like Key improvements:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant CI as GitHub Actions CI
participant Checkout as Checkout Code
participant Validation as Feature Flag Validation
participant File as feature-flags.ts
participant Perl as Perl Pattern Matcher
participant Grep as Grep Pattern Matcher
participant Lint as Lint Check
CI->>Checkout: Start workflow
Checkout->>CI: Code checked out
CI->>Validation: Run validation step
Validation->>File: Read feature-flags.ts
Note over Validation,Perl: Check 1: Hardcoded Booleans
Validation->>Perl: perl -0777 multiline regex
Perl->>Perl: Search for "export const is* = true/false"
Perl-->>Validation: Return matches (if any)
alt Hardcoded booleans found
Validation->>CI: ❌ Exit 1 - Hardcoded flags detected
else No hardcoded booleans
Note over Validation,Grep: Check 2: Naming Conventions
Validation->>Grep: grep -E lowercase exports
Grep->>Grep: Filter out "is" and "get" prefixes
Grep-->>Validation: Return non-compliant names
alt Bad naming found
Validation->>CI: ❌ Exit 1 - Invalid naming
else All checks pass
Validation->>CI: ✅ Validation passed
CI->>Lint: Continue to lint
end
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
Additional Comments (2)
Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/sim/lib/core/config/feature-flags.ts
Line: 24:24
Comment:
This hardcoded `true` value violates the CI check you just added. The new CI workflow will fail on this exact line.
```suggestion
export const isHosted =
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' ||
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai'
```
How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/sim/lib/core/config/feature-flags.ts
Line: 4:4
Comment:
`getEnv` is still needed for `isHosted`
```suggestion
import { env, getEnv, isFalsy, isTruthy } from './env'
```
How can I resolve this? If you propose a fix, please make it concise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 2 comments
* improvement(FF): CI check to prevent hardcoding of FFs * revert test change * add FF lint checks
Summary
Prevent hardcoding of feature flags.
Type of Change
Testing
Testing via CI
Checklist