Fix ci-server ci (#18180)

This commit is contained in:
Paul Rastoin
2026-02-24 12:51:46 +01:00
committed by GitHub
parent 959cbfb725
commit c6ec764b23
14 changed files with 116 additions and 54 deletions
@@ -2318,6 +2318,7 @@ export type Mutation = {
runEvaluationInput: AgentTurn;
saveImapSmtpCaldavAccount: ImapSmtpCaldavConnectionSuccess;
sendInvitations: SendInvitationsOutput;
setAdminAiModelEnabled: Scalars['Boolean'];
setMeteredSubscriptionPrice: BillingUpdateOutput;
signIn: AvailableWorkspacesAndAccessTokensOutput;
signUp: AvailableWorkspacesAndAccessTokensOutput;
@@ -2943,6 +2944,12 @@ export type MutationSendInvitationsArgs = {
};
export type MutationSetAdminAiModelEnabledArgs = {
enabled: Scalars['Boolean'];
modelId: Scalars['String'];
};
export type MutationSetMeteredSubscriptionPriceArgs = {
priceId: Scalars['String'];
};
@@ -6122,11 +6129,6 @@ export type GetConnectedImapSmtpCaldavAccountQueryVariables = Exact<{
export type GetConnectedImapSmtpCaldavAccountQuery = { __typename?: 'Query', getConnectedImapSmtpCaldavAccount: { __typename?: 'ConnectedImapSmtpCaldavAccount', id: string, handle: string, provider: string, accountOwnerId: string, connectionParameters?: { __typename?: 'ImapSmtpCaldavConnectionParameters', IMAP?: { __typename?: 'ConnectionParametersOutput', host: string, port: number, secure?: boolean | null, username?: string | null, password: string } | null, SMTP?: { __typename?: 'ConnectionParametersOutput', host: string, username?: string | null, port: number, secure?: boolean | null, password: string } | null, CALDAV?: { __typename?: 'ConnectionParametersOutput', host: string, username?: string | null, password: string } | null } | null } };
export type GetAdminAiModelsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetAdminAiModelsQuery = { __typename?: 'Query', getAdminAiModels: { __typename?: 'AdminAIModelsOutput', autoEnableNewModels: boolean, models: Array<{ __typename?: 'AdminAIModelConfig', modelId: string, label: string, modelFamily?: ModelFamily | null, inferenceProvider: InferenceProvider, isAvailable: boolean, isAdminEnabled: boolean, deprecated?: boolean | null, isRecommended?: boolean | null }> } };
export type SetAdminAiModelEnabledMutationVariables = Exact<{
modelId: Scalars['String'];
enabled: Scalars['Boolean'];
@@ -6135,6 +6137,11 @@ export type SetAdminAiModelEnabledMutationVariables = Exact<{
export type SetAdminAiModelEnabledMutation = { __typename?: 'Mutation', setAdminAiModelEnabled: boolean };
export type GetAdminAiModelsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetAdminAiModelsQuery = { __typename?: 'Query', getAdminAiModels: { __typename?: 'AdminAIModelsOutput', autoEnableNewModels: boolean, models: Array<{ __typename?: 'AdminAIModelConfig', modelId: string, label: string, modelFamily?: ModelFamily | null, inferenceProvider: InferenceProvider, isAvailable: boolean, isAdminEnabled: boolean, deprecated?: boolean | null, isRecommended?: boolean | null }> } };
export type CreateDatabaseConfigVariableMutationVariables = Exact<{
key: Scalars['String'];
value: Scalars['JSON'];
@@ -12101,6 +12108,38 @@ export function useGetConnectedImapSmtpCaldavAccountLazyQuery(baseOptions?: Apol
export type GetConnectedImapSmtpCaldavAccountQueryHookResult = ReturnType<typeof useGetConnectedImapSmtpCaldavAccountQuery>;
export type GetConnectedImapSmtpCaldavAccountLazyQueryHookResult = ReturnType<typeof useGetConnectedImapSmtpCaldavAccountLazyQuery>;
export type GetConnectedImapSmtpCaldavAccountQueryResult = Apollo.QueryResult<GetConnectedImapSmtpCaldavAccountQuery, GetConnectedImapSmtpCaldavAccountQueryVariables>;
export const SetAdminAiModelEnabledDocument = gql`
mutation SetAdminAiModelEnabled($modelId: String!, $enabled: Boolean!) {
setAdminAiModelEnabled(modelId: $modelId, enabled: $enabled)
}
`;
export type SetAdminAiModelEnabledMutationFn = Apollo.MutationFunction<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>;
/**
* __useSetAdminAiModelEnabledMutation__
*
* To run a mutation, you first call `useSetAdminAiModelEnabledMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useSetAdminAiModelEnabledMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [setAdminAiModelEnabledMutation, { data, loading, error }] = useSetAdminAiModelEnabledMutation({
* variables: {
* modelId: // value for 'modelId'
* enabled: // value for 'enabled'
* },
* });
*/
export function useSetAdminAiModelEnabledMutation(baseOptions?: Apollo.MutationHookOptions<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>(SetAdminAiModelEnabledDocument, options);
}
export type SetAdminAiModelEnabledMutationHookResult = ReturnType<typeof useSetAdminAiModelEnabledMutation>;
export type SetAdminAiModelEnabledMutationResult = Apollo.MutationResult<SetAdminAiModelEnabledMutation>;
export type SetAdminAiModelEnabledMutationOptions = Apollo.BaseMutationOptions<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>;
export const GetAdminAiModelsDocument = gql`
query GetAdminAiModels {
getAdminAiModels {
@@ -12145,19 +12184,6 @@ export function useGetAdminAiModelsLazyQuery(baseOptions?: Apollo.LazyQueryHookO
export type GetAdminAiModelsQueryHookResult = ReturnType<typeof useGetAdminAiModelsQuery>;
export type GetAdminAiModelsLazyQueryHookResult = ReturnType<typeof useGetAdminAiModelsLazyQuery>;
export type GetAdminAiModelsQueryResult = Apollo.QueryResult<GetAdminAiModelsQuery, GetAdminAiModelsQueryVariables>;
export const SetAdminAiModelEnabledDocument = gql`
mutation SetAdminAiModelEnabled($modelId: String!, $enabled: Boolean!) {
setAdminAiModelEnabled(modelId: $modelId, enabled: $enabled)
}
`;
export type SetAdminAiModelEnabledMutationFn = Apollo.MutationFunction<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>;
export function useSetAdminAiModelEnabledMutation(baseOptions?: Apollo.MutationHookOptions<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>(SetAdminAiModelEnabledDocument, options);
}
export type SetAdminAiModelEnabledMutationHookResult = ReturnType<typeof useSetAdminAiModelEnabledMutation>;
export type SetAdminAiModelEnabledMutationResult = Apollo.MutationResult<SetAdminAiModelEnabledMutation>;
export type SetAdminAiModelEnabledMutationOptions = Apollo.BaseMutationOptions<SetAdminAiModelEnabledMutation, SetAdminAiModelEnabledMutationVariables>;
export const CreateDatabaseConfigVariableDocument = gql`
mutation CreateDatabaseConfigVariable($key: String!, $value: JSON!) {
createDatabaseConfigVariable(key: $key, value: $value)
@@ -144,6 +144,6 @@ export class GenerateApiKeyCommand extends CommandRunner {
return;
}
console.log(`TOKEN:${tokenResult.token}\n`);
this.logger.log(`TOKEN:${tokenResult.token}\n`);
}
}
@@ -34,7 +34,7 @@ describe('ClientConfigService', () => {
{
provide: AiModelRegistryService,
useValue: {
getAvailableModels: jest.fn().mockReturnValue([]),
getAdminFilteredModels: jest.fn().mockReturnValue([]),
},
},
],
@@ -29,6 +29,7 @@ import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.ent
import { createEmptyAllFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/constant/create-empty-all-flat-entity-maps.constant';
import { WorkspaceManyOrAllFlatEntityMapsCacheService } from 'src/engine/metadata-modules/flat-entity/services/workspace-many-or-all-flat-entity-maps-cache.service';
import { ObjectMetadataService } from 'src/engine/metadata-modules/object-metadata/object-metadata.service';
import { AiModelRegistryService } from 'src/engine/metadata-modules/ai/ai-models/services/ai-model-registry.service';
import { PermissionsService } from 'src/engine/metadata-modules/permissions/permissions.service';
import { WorkspaceCacheStorageService } from 'src/engine/workspace-cache-storage/workspace-cache-storage.service';
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
@@ -117,6 +118,7 @@ describe('WorkspaceService', () => {
ExceptionHandlerService,
PermissionsService,
FileCorePictureService,
AiModelRegistryService,
].map((service) => ({
provide: service,
useValue: {},
@@ -2,7 +2,7 @@ import { UseGuards, UseInterceptors } from '@nestjs/common';
import { Args, Mutation, Query } from '@nestjs/graphql';
import { PermissionFlagType } from 'twenty-shared/constants';
import { isDefined } from 'twenty-shared/utils';
import { isNonEmptyString } from '@sniptt/guards';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
@@ -74,7 +74,7 @@ export class AgentResolver {
@Args('input') input: CreateAgentInput,
@AuthWorkspace() workspace: WorkspaceEntity,
): Promise<AgentDTO> {
if (isDefined(input.modelId)) {
if (isNonEmptyString(input.modelId)) {
this.aiModelRegistryService.validateModelAvailability(
input.modelId,
workspace,
@@ -96,7 +96,7 @@ export class AgentResolver {
@Args('input') input: UpdateAgentInput,
@AuthWorkspace() workspace: WorkspaceEntity,
): Promise<AgentDTO> {
if (isDefined(input.modelId)) {
if (isNonEmptyString(input.modelId)) {
this.aiModelRegistryService.validateModelAvailability(
input.modelId,
workspace,
+1
View File
@@ -22,6 +22,7 @@ import './instrument';
import { settings } from './engine/constants/settings';
import { generateFrontConfig } from './utils/generate-front-config';
// Trigger
const bootstrap = async () => {
setPgDateTypeParser();
@@ -26,6 +26,7 @@ exports[`successful find view with all sub-relations (e2e) Company View Structur
"position": 0,
"size": 180,
"updatedAt": Any<String>,
"viewFieldGroupId": null,
"viewId": Any<String>,
},
{
@@ -37,6 +38,7 @@ exports[`successful find view with all sub-relations (e2e) Company View Structur
"position": 1,
"size": 100,
"updatedAt": Any<String>,
"viewFieldGroupId": null,
"viewId": Any<String>,
},
{
@@ -48,6 +50,7 @@ exports[`successful find view with all sub-relations (e2e) Company View Structur
"position": 2,
"size": 150,
"updatedAt": Any<String>,
"viewFieldGroupId": null,
"viewId": Any<String>,
},
{
@@ -59,6 +62,7 @@ exports[`successful find view with all sub-relations (e2e) Company View Structur
"position": 3,
"size": 150,
"updatedAt": Any<String>,
"viewFieldGroupId": null,
"viewId": Any<String>,
},
{
@@ -70,6 +74,7 @@ exports[`successful find view with all sub-relations (e2e) Company View Structur
"position": 4,
"size": 150,
"updatedAt": Any<String>,
"viewFieldGroupId": null,
"viewId": Any<String>,
},
{
@@ -81,6 +86,7 @@ exports[`successful find view with all sub-relations (e2e) Company View Structur
"position": 5,
"size": 150,
"updatedAt": Any<String>,
"viewFieldGroupId": null,
"viewId": Any<String>,
},
{
@@ -92,6 +98,7 @@ exports[`successful find view with all sub-relations (e2e) Company View Structur
"position": 6,
"size": 170,
"updatedAt": Any<String>,
"viewFieldGroupId": null,
"viewId": Any<String>,
},
{
@@ -103,6 +110,7 @@ exports[`successful find view with all sub-relations (e2e) Company View Structur
"position": 7,
"size": 170,
"updatedAt": Any<String>,
"viewFieldGroupId": null,
"viewId": Any<String>,
},
],
@@ -32,7 +32,7 @@ describe('Agent creation should fail', () => {
input: {
label: globalTestContext.existingAgentLabel,
prompt: 'Existing agent for testing',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
});
@@ -55,7 +55,7 @@ describe('Agent creation should fail', () => {
context: {
input: {
prompt: 'Test prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
} as CreateAgentInput,
},
},
@@ -64,7 +64,7 @@ describe('Agent creation should fail', () => {
context: {
input: {
label: 'Test Agent Missing Prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
} as CreateAgentInput,
},
},
@@ -83,7 +83,7 @@ describe('Agent creation should fail', () => {
input: {
label: '',
prompt: 'Test prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
},
},
@@ -93,7 +93,7 @@ describe('Agent creation should fail', () => {
input: {
label: 'Empty Prompt Agent',
prompt: '',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
},
},
@@ -114,7 +114,7 @@ describe('Agent creation should fail', () => {
input: {
label: globalTestContext.existingAgentLabel,
prompt: 'Duplicate agent',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
},
},
@@ -125,7 +125,7 @@ describe('Agent creation should fail', () => {
input: {
label: 'Invalid Response Format Agent',
prompt: 'Test prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
responseFormat: {
type: 'invalid',
} as any,
@@ -138,7 +138,7 @@ describe('Agent creation should fail', () => {
input: {
label: 'JSON Without Schema Agent',
prompt: 'Test prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
responseFormat: {
type: 'json',
} as any,
@@ -151,7 +151,7 @@ describe('Agent creation should fail', () => {
input: {
label: 'Text With Schema Agent',
prompt: 'Test prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
responseFormat: {
type: 'text',
schema: { type: 'object' },
@@ -40,7 +40,7 @@ describe('Agent update should fail', () => {
input: {
label: globalTestContext.existingAgentLabelForDuplicate,
prompt: 'Existing agent for duplicate test',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
});
@@ -55,7 +55,7 @@ describe('Agent update should fail', () => {
description: 'Original description',
icon: 'IconRobot',
prompt: 'Original prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
});
@@ -23,7 +23,7 @@ describe('Agent creation should succeed', () => {
input: {
label: 'Test Agent',
prompt: 'You are a helpful test assistant',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
});
@@ -36,7 +36,7 @@ describe('Agent creation should succeed', () => {
icon: null,
description: null,
prompt: 'You are a helpful test assistant',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
responseFormat: { type: 'text' },
roleId: null,
isCustom: true,
@@ -52,7 +52,7 @@ describe('Agent creation should succeed', () => {
icon: 'IconRobot',
description: 'A custom agent with all fields specified',
prompt: 'You are a specialized assistant for testing',
modelId: 'gpt-4o-mini',
modelId: 'gpt-5.2',
responseFormat: { type: 'text' },
modelConfiguration: {
webSearch: {
@@ -88,7 +88,7 @@ describe('Agent creation should succeed', () => {
input: {
label: 'JSON Response Agent',
prompt: 'Return structured JSON data',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
responseFormat: {
type: 'json',
schema: {
@@ -127,7 +127,7 @@ describe('Agent creation should succeed', () => {
input: {
label: 'My Test Agent With Spaces',
prompt: 'Testing name computation',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
});
@@ -149,7 +149,7 @@ describe('Agent creation should succeed', () => {
icon: ' IconRobot ',
description: ' Description with spaces ',
prompt: ' Prompt with spaces ',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
});
@@ -192,7 +192,7 @@ describe('Agent creation should succeed', () => {
input: {
label: 'Agent With Role',
prompt: 'Agent with role assignment',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
roleId: createdRoleId,
},
});
@@ -203,7 +203,7 @@ describe('Agent creation should succeed', () => {
id: expect.any(String),
label: 'Agent With Role',
prompt: 'Agent with role assignment',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
roleId: createdRoleId,
isCustom: true,
});
@@ -9,7 +9,7 @@ describe('Agent deletion should succeed', () => {
input: {
label: 'Agent To Delete',
prompt: 'This agent will be deleted',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
});
@@ -74,7 +74,7 @@ describe('Agent role update should succeed', () => {
input: {
label: 'Agent Without Role',
prompt: 'Test prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
},
});
@@ -103,7 +103,7 @@ describe('Agent role update should succeed', () => {
input: {
label: 'Agent With Initial Role',
prompt: 'Test prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
roleId: testRoleId,
},
});
@@ -133,7 +133,7 @@ describe('Agent role update should succeed', () => {
input: {
label: 'Agent With Role To Remove',
prompt: 'Test prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
roleId: testRoleId,
},
});
@@ -15,7 +15,7 @@ describe('Agent update should succeed', () => {
description: 'Original description',
icon: 'IconRobot',
prompt: 'Original prompt',
modelId: 'gpt-4o',
modelId: 'gpt-4.1',
responseFormat: { type: 'text' },
evaluationInputs: ['input 1'],
},
@@ -100,13 +100,13 @@ describe('Agent update should succeed', () => {
expectToFail: false,
input: {
id: testAgentId,
modelId: 'gpt-4o-mini',
modelId: 'gpt-5.2',
},
});
expect(data.updateOneAgent).toMatchObject({
id: testAgentId,
modelId: 'gpt-4o-mini',
modelId: 'gpt-5.2',
});
});
@@ -226,7 +226,7 @@ describe('Agent update should succeed', () => {
description: 'Updated multiple fields',
icon: 'IconBrain',
prompt: 'New comprehensive prompt',
modelId: 'gpt-4o-mini',
modelId: 'gpt-5.2',
responseFormat: {
type: 'json',
schema: DEFAULT_TOOL_INPUT_SCHEMA as AgentResponseSchema,
@@ -241,7 +241,7 @@ describe('Agent update should succeed', () => {
description: 'Updated multiple fields',
icon: 'IconBrain',
prompt: 'New comprehensive prompt',
modelId: 'gpt-4o-mini',
modelId: 'gpt-5.2',
responseFormat: {
type: 'json',
schema: { type: 'object' },
@@ -11,6 +11,7 @@ import { v4 as uuidv4 } from 'uuid';
type FieldsWidgetTestSetup = {
widgetId: string;
viewId: string;
labelIdentifierFieldMetadataId: string | null;
viewFields: Array<{
id: string;
fieldMetadataId: string;
@@ -31,6 +32,7 @@ const VIEW_WITH_FIELDS_AND_GROUPS_GQL_FIELDS = `
`;
const fetchFieldsWidgetTestSetup = async (): Promise<FieldsWidgetTestSetup> => {
// TODO refactor should not use global source for that
const widgets = await global.testDataSource.query(
`SELECT id, configuration->>'viewId' AS "viewId"
FROM core."pageLayoutWidget"
@@ -46,6 +48,18 @@ const fetchFieldsWidgetTestSetup = async (): Promise<FieldsWidgetTestSetup> => {
expect(widgetId).toBeDefined();
expect(viewId).toBeDefined();
// TODO refactor should not use global source for that
const views = await global.testDataSource.query(
`SELECT v."objectMetadataId", om."labelIdentifierFieldMetadataId"
FROM core."view" v
JOIN core."objectMetadata" om ON om.id = v."objectMetadataId"
WHERE v.id = $1`,
[viewId],
);
const labelIdentifierFieldMetadataId =
views[0]?.labelIdentifierFieldMetadataId ?? null;
const { data } = await findCoreViewFields({
viewId,
gqlFields: 'id fieldMetadataId position isVisible viewFieldGroupId',
@@ -54,7 +68,7 @@ const fetchFieldsWidgetTestSetup = async (): Promise<FieldsWidgetTestSetup> => {
const viewFields = data.getCoreViewFields;
return { widgetId, viewId, viewFields };
return { widgetId, viewId, labelIdentifierFieldMetadataId, viewFields };
};
describe('upsertFieldsWidget', () => {
@@ -199,7 +213,12 @@ describe('upsertFieldsWidget', () => {
it('should update view field positions and visibility within groups', async () => {
const groupId = uuidv4();
const targetField = testSetup.viewFields[0];
const targetField = testSetup.viewFields.find(
(field) =>
field.fieldMetadataId !== testSetup.labelIdentifierFieldMetadataId,
)!;
expect(targetField).toBeDefined();
await upsertFieldsWidget({
expectToFail: false,
@@ -343,7 +362,13 @@ describe('upsertFieldsWidget', () => {
});
it('should update field positions and visibility without groups', async () => {
const targetField = testSetup.viewFields[0];
const targetField = testSetup.viewFields.find(
(field) =>
field.fieldMetadataId !== testSetup.labelIdentifierFieldMetadataId,
)!;
expect(targetField).toBeDefined();
const groupId = uuidv4();
// First assign the field to a group so it has a non-null viewFieldGroupId