Expose versionBump arg in flow update mutation
What does this MR do and why?
This MR exposes the versionBump arg in the GraphQL flow update mutation.
It's the equivalent change of !201694 (merged) for flows.
The functionality is underpinned by logic in BaseUpdateService that Flows::UpdateService already supports.
How to set up and validate locally
Enable these two flags:
Feature.enable(:global_ai_catalog)
Feature.enable(:ai_catalog_enforce_readonly_versions)
Visit GraphQL Explorer: http://gdk.test:3000/-/graphql-explorer
Create a new agent:
mutation {
aiCatalogAgentCreate(input: {
projectId: "gid://gitlab/Project/1000000"
name: "My name"
description: "My description"
release: true
public: false
systemPrompt: "My system prompt"
userPrompt: "My user prompt"
}) {
errors
item {
id
}
}
}
Using the id of the agent you just created as agentId, now create a flow using that agent:
mutation {
aiCatalogFlowCreate(input: {
projectId: "gid://gitlab/Project/1000000"
name: "My name"
description: "My description"
public: false
release: true
steps: [{
agentId: "<AGENT_GLOBAL_ID>"
}]
}) {
errors
item {
id
latestVersion {
released
versionName
}
versions {
nodes {
released
versionName
}
}
}
}
}
Take the id of the flow you created, and use the aiCatalogFlowUpdate mutation to do a series of updates to the steps[], changing the pinnedVersionPrefix between "1" and null for each update to create more versions.
You will see each released version is a "patch" release. You can also change versionBump to MINOR or MAJOR.
fragment VersionFragment on AiCatalogItemVersion {
released
versionName
}
mutation {
aiCatalogFlowUpdate(input: {
id: "<FLOW_GLOBAL_ID>",
name: "My name"
description: "My description"
release: true
versionBump: PATCH
steps: [{
agentId: "<AGENT_GLOBAL_ID>",
pinnedVersionPrefix: "1.0"
}]
}) {
errors
item {
id
latestVersion {
...VersionFragment
}
versions {
count
nodes {
...VersionFragment
}
}
}
}
}
Now make a series of update mutation calls, but only change the versionBump argument to PATCH, MINOR or MAJOR. Notice that now you can't version bump its versionName as the version has been released.
Now make another update mutation call, this time change pinnedVersionPrefix and have release: false so that you create a new draft version.
Now make a series of update mutation calls, but only change the versionBump argument to PATCH, MINORorMAJOR. Notice that you can version bump its versionName` as the version is a draft version.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #560509 (closed)