@@ -41,10 +41,11 @@ export interface FeatureFlags {
4141 * External service features (advancedCAD) require separate deployment and are opt-in
4242 */
4343export const DEFAULT_FEATURE_FLAGS : FeatureFlags = {
44- // WIP MODULES - Not ready for production yet (hidden from UI , cannot be enabled)
44+ // WIP MODULES - Not ready for production yet (forced off , cannot be enabled)
4545 analytics : false , // WIP: Analytics module (QRM, OEE, Quality, Reliability)
4646 shipping : false , // WIP: Shipping planning module
4747 appStore : false , // WIP: App Store / Marketplace
48+ advancedCAD : false , // WIP: Backend-only CAD processing - requires external eryxon3d service
4849
4950 // Active modules
5051 monitoring : true ,
@@ -53,11 +54,14 @@ export const DEFAULT_FEATURE_FLAGS: FeatureFlags = {
5354 issues : true ,
5455 capacity : true ,
5556 assignments : true ,
56-
57- // External service features - enabled for local development with eryxon3d
58- advancedCAD : true ,
5957} ;
6058
59+ /**
60+ * WIP flags that are forced OFF regardless of database values.
61+ * These modules are not ready for production and cannot be enabled.
62+ */
63+ const WIP_FLAGS : ( keyof FeatureFlags ) [ ] = [ 'analytics' , 'shipping' , 'appStore' , 'advancedCAD' ] ;
64+
6165/**
6266 * Feature flag metadata for UI display
6367 */
@@ -70,9 +74,9 @@ export interface FeatureFlagMeta {
7074}
7175
7276export const FEATURE_FLAG_METADATA : FeatureFlagMeta [ ] = [
73- // NOTE: WIP modules (analytics, shipping, appStore) are intentionally excluded
74- // from this list so they cannot be enabled via the UI. They will be added back
75- // when the features are ready for production.
77+ // NOTE: WIP modules (analytics, shipping, appStore, advancedCAD ) are intentionally
78+ // excluded from this list so they cannot be enabled via the UI. They will be added
79+ // back when the features are ready for production.
7680
7781 {
7882 key : 'monitoring' ,
@@ -116,14 +120,6 @@ export const FEATURE_FLAG_METADATA: FeatureFlagMeta[] = [
116120 icon : 'UserCheck' ,
117121 category : 'operations' ,
118122 } ,
119- // External service features
120- {
121- key : 'advancedCAD' ,
122- labelKey : 'featureFlags.advancedCAD.label' ,
123- descriptionKey : 'featureFlags.advancedCAD.description' ,
124- icon : 'Box' ,
125- category : 'admin' ,
126- } ,
127123] ;
128124
129125/**
@@ -153,10 +149,17 @@ export function useFeatureFlags() {
153149 // Merge with defaults to ensure all flags exist
154150 // Cast to access feature_flags which exists in DB but may not be in generated types
155151 const storedFlags = ( data as any ) ?. feature_flags as Partial < FeatureFlags > | null ;
156- return {
152+ const mergedFlags = {
157153 ...DEFAULT_FEATURE_FLAGS ,
158154 ...( storedFlags || { } ) ,
159155 } ;
156+
157+ // Force WIP flags to false regardless of what's stored in DB
158+ for ( const wipFlag of WIP_FLAGS ) {
159+ mergedFlags [ wipFlag ] = false ;
160+ }
161+
162+ return mergedFlags ;
160163 } ,
161164 enabled : ! ! tenant ?. id ,
162165 staleTime : 1000 * 60 * 5 , // Cache for 5 minutes
@@ -224,8 +227,14 @@ export function useFeatureFlags() {
224227 updateFlags . mutate ( allDisabled ) ;
225228 } ;
226229
230+ // Ensure WIP flags are forced off in the returned flags
231+ const safeFlags = flags ?? DEFAULT_FEATURE_FLAGS ;
232+ for ( const wipFlag of WIP_FLAGS ) {
233+ safeFlags [ wipFlag ] = false ;
234+ }
235+
227236 return {
228- flags : flags ?? DEFAULT_FEATURE_FLAGS ,
237+ flags : safeFlags ,
229238 isLoading,
230239 error,
231240 isEnabled,
0 commit comments