mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(editor): Remove feature flag from evals feature (#17107)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -9,12 +9,10 @@ import {
|
||||
PLACEHOLDER_EMPTY_WORKFLOW_ID,
|
||||
STICKY_NODE_TYPE,
|
||||
VIEWS,
|
||||
WORKFLOW_EVALUATION_EXPERIMENT,
|
||||
N8N_MAIN_GITHUB_REPO_URL,
|
||||
} from '@/constants';
|
||||
import { useExecutionsStore } from '@/stores/executions.store';
|
||||
import { useNDVStore } from '@/stores/ndv.store';
|
||||
import { usePostHog } from '@/stores/posthog.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
@@ -37,7 +35,6 @@ const sourceControlStore = useSourceControlStore();
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const executionsStore = useExecutionsStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
const posthogStore = usePostHog();
|
||||
|
||||
const activeHeaderTab = ref(MAIN_HEADER_TABS.WORKFLOW);
|
||||
const workflowToReturnTo = ref('');
|
||||
@@ -59,18 +56,11 @@ const executionRoutes: VIEWS[] = [
|
||||
VIEWS.EXECUTION_PREVIEW,
|
||||
];
|
||||
const tabBarItems = computed(() => {
|
||||
const items = [
|
||||
return [
|
||||
{ value: MAIN_HEADER_TABS.WORKFLOW, label: locale.baseText('generic.editor') },
|
||||
{ value: MAIN_HEADER_TABS.EXECUTIONS, label: locale.baseText('generic.executions') },
|
||||
{ value: MAIN_HEADER_TABS.EVALUATION, label: locale.baseText('generic.tests') },
|
||||
];
|
||||
|
||||
if (posthogStore.isFeatureEnabled(WORKFLOW_EVALUATION_EXPERIMENT)) {
|
||||
items.push({
|
||||
value: MAIN_HEADER_TABS.EVALUATION,
|
||||
label: locale.baseText('generic.tests'),
|
||||
});
|
||||
}
|
||||
return items;
|
||||
});
|
||||
|
||||
const activeNode = computed(() => ndvStore.activeNode);
|
||||
|
||||
@@ -82,7 +82,7 @@ describe('NodesListPanel', () => {
|
||||
await fireEvent.click(container.querySelector('.backButton')!);
|
||||
await nextTick();
|
||||
|
||||
expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(8);
|
||||
expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(9);
|
||||
});
|
||||
|
||||
it('should render regular nodes', async () => {
|
||||
|
||||
@@ -31,7 +31,6 @@ describe('useActionsGenerator', () => {
|
||||
setActivePinia(pinia);
|
||||
|
||||
posthogStore = usePostHog();
|
||||
|
||||
vi.spyOn(posthogStore, 'isVariantEnabled').mockReturnValue(true);
|
||||
});
|
||||
|
||||
@@ -402,48 +401,5 @@ describe('useActionsGenerator', () => {
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('should not return evaluation or evaluation trigger node if variant is not enabled', () => {
|
||||
vi.spyOn(posthogStore, 'isFeatureEnabled').mockReturnValue(false);
|
||||
|
||||
const node: INodeTypeDescription = {
|
||||
...baseV2NodeWoProps,
|
||||
properties: [
|
||||
resourcePropertyWithUser,
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get description',
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const evalNode: INodeTypeDescription = {
|
||||
...baseV2NodeWoProps,
|
||||
name: 'n8n-nodes-base.evaluation',
|
||||
};
|
||||
|
||||
const evalNodeTrigger: INodeTypeDescription = {
|
||||
...baseV2NodeWoProps,
|
||||
name: 'n8n-nodes-base.evaluationTrigger',
|
||||
};
|
||||
|
||||
const { mergedNodes } = generateMergedNodesAndActions([node, evalNode, evalNodeTrigger], []);
|
||||
|
||||
mergedNodes.forEach((mergedNode) => {
|
||||
expect(mergedNode.name).not.toEqual('n8n-nodes-base.evaluation');
|
||||
expect(mergedNode.name).not.toEqual('n8n-nodes-base.evaluationTrigger');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import { WORKFLOW_EVALUATION_EXPERIMENT } from '@/constants';
|
||||
import { usePostHog } from '@/stores/posthog.store';
|
||||
|
||||
const props = defineProps<{
|
||||
runningExecutionsCount: number;
|
||||
@@ -16,8 +14,6 @@ const emit = defineEmits<{
|
||||
|
||||
const i18n = useI18n();
|
||||
|
||||
const posthogStore = usePostHog();
|
||||
|
||||
const tooltipText = computed(() => {
|
||||
let text = i18n.baseText('executionsList.activeExecutions.tooltip', {
|
||||
interpolate: {
|
||||
@@ -26,9 +22,7 @@ const tooltipText = computed(() => {
|
||||
},
|
||||
});
|
||||
|
||||
if (posthogStore.isFeatureEnabled(WORKFLOW_EVALUATION_EXPERIMENT)) {
|
||||
text += '\n' + i18n.baseText('executionsList.activeExecutions.evaluationNote');
|
||||
}
|
||||
text += '\n' + i18n.baseText('executionsList.activeExecutions.evaluationNote');
|
||||
|
||||
return text;
|
||||
});
|
||||
|
||||
@@ -757,7 +757,6 @@ export const EXPERIMENTS_TO_TRACK = [
|
||||
WORKFLOW_BUILDER_EXPERIMENT.name,
|
||||
RAG_STARTER_WORKFLOW_EXPERIMENT.name,
|
||||
];
|
||||
export const WORKFLOW_EVALUATION_EXPERIMENT = '032_evaluation_mvp';
|
||||
|
||||
export const MFA_FORM = {
|
||||
MFA_TOKEN: 'MFA_TOKEN',
|
||||
|
||||
@@ -11,7 +11,6 @@ import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useTemplatesStore } from '@/stores/templates.store';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import { useSSOStore } from '@/stores/sso.store';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { EnterpriseEditionFeature, VIEWS, EDITABLE_CANVAS_VIEWS } from '@/constants';
|
||||
import { useTelemetry } from '@/composables/useTelemetry';
|
||||
import { middleware } from '@/utils/rbac/middleware';
|
||||
@@ -273,10 +272,7 @@ export const routes: RouteRecordRaw[] = [
|
||||
},
|
||||
meta: {
|
||||
keepWorkflowAlive: true,
|
||||
middleware: ['authenticated', 'custom'],
|
||||
middlewareOptions: {
|
||||
custom: () => useEvaluationStore().isFeatureEnabled,
|
||||
},
|
||||
middleware: ['authenticated'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee'; // Adjust the import path as necessary
|
||||
import { useRootStore } from '@n8n/stores/useRootStore';
|
||||
import { usePostHog } from '@/stores/posthog.store';
|
||||
import { useAnnotationTagsStore } from '@/stores/tags.store';
|
||||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import { mockedStore } from '@/__tests__/utils';
|
||||
@@ -40,14 +39,12 @@ const TEST_RUN: TestRunRecord = {
|
||||
describe('evaluation.store.ee', () => {
|
||||
let store: ReturnType<typeof useEvaluationStore>;
|
||||
let rootStoreMock: ReturnType<typeof useRootStore>;
|
||||
let posthogStoreMock: ReturnType<typeof usePostHog>;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
setActivePinia(createPinia());
|
||||
store = useEvaluationStore();
|
||||
rootStoreMock = useRootStore();
|
||||
posthogStoreMock = usePostHog();
|
||||
|
||||
mockedStore(useAnnotationTagsStore).fetchAll = vi.fn().mockResolvedValue([]);
|
||||
|
||||
@@ -62,17 +59,6 @@ describe('evaluation.store.ee', () => {
|
||||
expect(store.isLoading).toBe(false);
|
||||
});
|
||||
|
||||
describe('Computed Properties', () => {
|
||||
test('isFeatureEnabled', () => {
|
||||
posthogStoreMock.isFeatureEnabled = vi.fn().mockReturnValue(false);
|
||||
|
||||
expect(store.isFeatureEnabled).toBe(false);
|
||||
posthogStoreMock.isFeatureEnabled = vi.fn().mockReturnValue(true);
|
||||
|
||||
expect(store.isFeatureEnabled).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test Runs', () => {
|
||||
test('Fetching Test Runs', async () => {
|
||||
const result = await store.fetchTestRuns('1');
|
||||
|
||||
@@ -3,8 +3,6 @@ import { computed, ref } from 'vue';
|
||||
import { useRootStore } from '@n8n/stores/useRootStore';
|
||||
import * as evaluationsApi from '@/api/evaluation.ee';
|
||||
import type { TestCaseExecutionRecord, TestRunRecord } from '@/api/evaluation.ee';
|
||||
import { usePostHog } from './posthog.store';
|
||||
import { WORKFLOW_EVALUATION_EXPERIMENT } from '@/constants';
|
||||
import { STORES } from '@n8n/stores';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { EVALUATION_NODE_TYPE, EVALUATION_TRIGGER_NODE_TYPE, NodeHelpers } from 'n8n-workflow';
|
||||
@@ -22,7 +20,6 @@ export const useEvaluationStore = defineStore(
|
||||
const pollingTimeouts = ref<Record<string, NodeJS.Timeout>>({});
|
||||
|
||||
// Store instances
|
||||
const posthogStore = usePostHog();
|
||||
const rootStore = useRootStore();
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const nodeTypesStore = useNodeTypesStore();
|
||||
@@ -30,16 +27,7 @@ export const useEvaluationStore = defineStore(
|
||||
|
||||
// Computed
|
||||
|
||||
// Enable with `window.featureFlags.override('032_evaluation_mvp', true)`
|
||||
const isFeatureEnabled = computed(() =>
|
||||
posthogStore.isFeatureEnabled(WORKFLOW_EVALUATION_EXPERIMENT),
|
||||
);
|
||||
|
||||
const isEvaluationEnabled = computed(
|
||||
() =>
|
||||
posthogStore.isFeatureEnabled(WORKFLOW_EVALUATION_EXPERIMENT) &&
|
||||
settingsStore.settings.evaluation.quota !== 0,
|
||||
);
|
||||
const isEvaluationEnabled = computed(() => settingsStore.settings.evaluation?.quota !== 0);
|
||||
|
||||
const isLoading = computed(() => loadingTestRuns.value);
|
||||
|
||||
@@ -188,7 +176,6 @@ export const useEvaluationStore = defineStore(
|
||||
|
||||
// Computed
|
||||
isLoading,
|
||||
isFeatureEnabled,
|
||||
isEvaluationEnabled,
|
||||
testRunsByWorkflowId,
|
||||
evaluationTriggerExists,
|
||||
|
||||
Reference in New Issue
Block a user