Conversation
Document the decision to use Unleash for feature flags with workspace-scoped ConfigMap overrides. Includes architecture diagrams, evaluation logic, API endpoints, and implementation patterns. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Unleash deployment script (e2e/scripts/deploy-unleash.sh) - Add feature flags documentation (docs/feature-flags/) - Add Makefile targets for Unleash deployment - Update constitution with Principle XI: Feature Flag Discipline - Update component READMEs with feature flag configuration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Unleash client integration (featureflags/featureflags.go) - Add feature flags handlers (handlers/featureflags.go, featureflags_admin.go) - Implement workspace-scoped ConfigMap overrides - API endpoints: list, evaluate, enable, disable, override management - Proxy to Unleash Admin API with backend credentials Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…errides - Add Unleash provider with environment context field - Add feature flags admin UI in Workspace Settings tab - Implement batch save pattern (local state, Save/Discard buttons) - Add Next.js API routes to proxy backend feature flags endpoints - Add useWorkspaceFlag hook for workspace-scoped flag evaluation - Add Switch UI component and feature flags service layer Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
@maskarb once we get the blockers and 🔴 fixed from the review, this is getting really close to landing. The testing path(s) might be deferrable for future PRs, too, however given this is a key platform functionality.. I'm inclined to ask for at least a critical path test or two 👍🏾 |
Add comprehensive unit tests for the feature flag admin API handlers covering: - Authentication requirements (401 Unauthorized) - ConfigMap create/update/delete operations - Unleash API error handling (503 when not configured) - Override precedence logic (workspace > Unleash > default) - Edge cases (nil ConfigMap data, concurrent operations) Also includes error handling fix to not expose Unleash response body in error messages (security improvement). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Platform team can now control which feature flags are visible in the workspace admin UI by adding a tag (scope: workspace) in Unleash: - Flags with the tag appear in the workspace admin UI - Flags without the tag are platform-only (Unleash UI only) - Tag type/value configurable via environment variables: UNLEASH_WORKSPACE_TAG_TYPE (default: "scope") UNLEASH_WORKSPACE_TAG_VALUE (default: "workspace") Also updates ADR-0006 with flag visibility governance documentation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Unleash SDK sends usage metrics and client registration to the proxy URL. These were missing, causing no metrics to appear in Unleash. Added endpoints: - POST /api/feature-flags/client/metrics - forwards usage metrics - POST /api/feature-flags/client/register - forwards client registration Note: "Impression data" must also be enabled on flags in Unleash UI for detailed impression tracking. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename sessionId to sessionID in IsEnabledWithContext (ST1003) - Use type conversion instead of struct literal for EnvState (S1016) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Claude Code ReviewSummaryThis PR implements Unleash-based feature flag management with workspace-scoped ConfigMap overrides. The implementation adds comprehensive feature flag capabilities including:
Overall Assessment: ✅ Approve with Minor Suggestions The code follows established patterns from CLAUDE.md and context files. Security, error handling, and authentication are implemented correctly. Excellent test coverage. Issues by Severity🚫 Blocker IssuesNone - No blocking issues found. 🔴 Critical IssuesNone - No critical issues found. 🟡 Major Issues1. Backend Service Account Usage for ConfigMap OperationsLocation: Issue: All ConfigMap operations (lines 88, 400, 414, 432, 469, 489, 525, 539, 557, 594, 608, 626) use Current Pattern: cm, err := K8sClient.CoreV1().ConfigMaps(namespace).Get(ctx, FeatureFlagOverridesConfigMap, metav1.GetOptions{})Expected Pattern (per CLAUDE.md:525-556): reqK8s, _ := GetK8sClientsForRequest(c)
// Validate RBAC permissions for ConfigMap access
ssar := &authv1.SelfSubjectAccessReview{
Spec: authv1.SelfSubjectAccessReviewSpec{
ResourceAttributes: &authv1.ResourceAttributes{
Resource: "configmaps",
Verb: "get", // or "create", "update", "delete"
Namespace: namespace,
Name: FeatureFlagOverridesConfigMap,
},
},
}
// Then use backend service account AFTER validationWhy this matters: Per ADR-0002 and k8s-client-usage.md, user operations should validate RBAC before using elevated permissions. The current implementation validates project access (line 140) but doesn't check ConfigMap-specific permissions. Recommendation: Add RBAC checks for ConfigMap operations, or document why backend service account is appropriate here (similar to CR writes in sessions.go:417). 2. Potential Token Leak in Admin ProxyLocation: Issue: Admin API token is set directly in header without redaction in logs. req.Header.Set("Authorization", getUnleashAdminToken())Risk: If HTTP client logs requests or errors include headers, the admin token could leak. Recommendation: Ensure 🔵 Minor Issues1. Inconsistent Error Message FormatLocation: Issue: Log message includes response body which may contain sensitive data: log.Printf("Unleash Admin API returned %d: %s", resp.StatusCode, string(body))Recommendation: Don't log full response bodies. Use: log.Printf("Unleash Admin API returned %d", resp.StatusCode)Note: Already fixed on line 361 - just needs consistency. 2. Missing
|
- Update feature flag tests to expect "unleash" source (SDK refactor) - Remove unused instrumentationHook from next.config.js - Add debug logging for Unleash metrics proxy - Remove unused refreshInterval from feature flag provider Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Claude Code ReviewSummaryThis PR introduces comprehensive feature flag management using Unleash with workspace-scoped overrides. The implementation follows established patterns with good separation between platform-wide and workspace-specific controls. Code quality is generally high with proper use of user token authentication, React Query, and Shadcn UI components. Issues by Severity🚫 Blocker IssuesNone - No blocking issues found. 🔴 Critical Issues
🟡 Major Issues
🔵 Minor Issues
Positive Highlights✅ Excellent RBAC Implementation
✅ Proper React Query Usage
✅ Shadcn UI Component Usage
✅ Type-Safe API Layer
✅ Three-Tier Override Logic
✅ Comprehensive Tests
✅ Tag-Based Filtering
RecommendationsHigh Priority
Medium Priority
Documentation Improvements
Code Quality Metrics
Security Checklist
Overall AssessmentQuality Score: 7.5/10 This is a well-designed feature with good architectural patterns. The main concerns are:
Once these critical issues are addressed, this PR will be production-ready. The three-tier override system (workspace → platform → disabled) is elegant and the tag-based filtering is a smart design choice. Recommendation: Request changes to address Critical #1 and #2 before merging. 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
No description provided.