Skip to content

Commit 1a73c68

Browse files
committed
fix(FR-2901): sync deployment revision state in Relay store after activate / auto-activate (#7428)
Resolves #7427(FR-2901) Stacked on #7407. ## Summary After mutations that change a deployment's `currentRevisionId` / `deployingRevisionId`, the Relay store's deployment record can fall out of sync with the server, causing the row tags in the revision history table and the Configuration Section's "current / deploying" panels to drift apart from what the server thinks. Two specific gaps were addressed: - **`activateDeploymentRevision` (Revision History → Deploy)** — Mutation response previously returned only `deployment { id, currentRevisionId, currentRevision { id } }`. Extended to include `deployingRevisionId` and `...DeploymentRevisionDetail_revision` fragment on both `currentRevision` and `deployingRevision @SInCE(version: "26.4.3")`, so the normalized deployment record updates atomically. Consumers (`DeploymentDetailPage`, `DeploymentConfigurationSection`, `DeploymentRevisionHistoryTab` row tags) all share the same Relay store record and re-render on the next render pass. - **`addModelRevision` (Add Revision modal, both Preset and Custom modes)** — Now that the backend exposes `ModelRevision.deployment` (lablup/backend.ai#11631 / BA-6056), the mutation reaches into `revision.deployment @SInCE(version: "26.4.4")` and selects `currentRevisionId`, `deployingRevisionId`, `currentRevision`, `deployingRevision`, so the deployment node is updated unconditionally on every revision add. No `autoActivate` branching — Relay normalizes the shared deployment node either way. - The previous client-side `fetchQuery` workaround helper is removed. - The `revision` selection itself was reduced to `id` + `...DeploymentRevisionDetail_revision`. The previously inlined fields (`resourceConfig.resourceOpts`, `modelRuntimeConfig.runtimeVariantId`, `modelDefinition.models[].service.preStartActions / shell / healthCheck.expectedStatusCode`, etc.) were dead selections — none of the response handlers read them, and the actual consumers (`AdminDeploymentPresetSettingPageContent`, `AdminDeploymentPresetModelConfigItem`, `DeploymentPresetDetailModal`) have their own queries. - **`data/schema.graphql`** — Regenerated to add `ModelRevision.deploymentId: ID!` and `ModelRevision.deployment: ModelDeployment` per the merged backend PR. ## Test plan - [ ] Open a deployment detail with multiple revisions in the Revision History tab. Click **Deploy** on a non-current revision → confirm the "Current" / "배포중" row tags AND the Configuration Section's `currentRevision` / `deployingRevision` panels both update without a manual refresh. - [ ] From the same page open **Add Revision** modal in either Preset or Custom mode with **Auto activate ON** → submit → modal closes, success toast shows. Verify the Configuration Section moves to "deploying" state and the new revision appears as `deployingRevision` without a manual refresh. - [ ] Same flow with **Auto activate OFF** → deployment record is still refreshed by the mutation (no autoActivate branching). `deployingRevisionId` typically stays unchanged on the server side; UI should show the new revision in history without an orphan "deploying" state. - [ ] Backend lifecycle: leave the page idle while a deploying revision becomes current. The 5s `useInterval` polling in `DeploymentConfigurationSection` continues to work because `deployingRevision` is correctly populated immediately after the mutation. ## Backend dependency Requires backend manager with [lablup/backend.ai#11631](lablup/backend.ai#11631) (BA-6056) — `ModelRevision.deployment` / `ModelRevision.deploymentId`. Older managers without the field will see the `@since(version: "26.4.4")` directive strip the field at request time, falling back to no auto-update for `addModelRevision` (the activate path is unaffected).
1 parent aaff679 commit 1a73c68

3 files changed

Lines changed: 35 additions & 62 deletions

File tree

data/schema.graphql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9725,6 +9725,14 @@ type ModelRevision implements Node
97259725

97269726
"""Added in 26.4.2. Resource slot allocations for this revision."""
97279727
resourceSlots(filter: AllocatedResourceSlotFilter = null, orderBy: [AllocatedResourceSlotOrderBy!] = null): [AllocatedResourceSlot!]
9728+
9729+
"""Added in UNRELEASED. ID of the parent deployment this revision belongs to."""
9730+
deploymentId: ID!
9731+
9732+
"""
9733+
Added in UNRELEASED. The parent deployment this revision belongs to, resolved via DataLoader.
9734+
"""
9735+
deployment: ModelDeployment
97289736
}
97299737

97309738
"""Added in 25.19.0. Connection for model revisions."""

react/src/components/DeploymentAddRevisionModal.tsx

Lines changed: 20 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,13 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
459459
return preset;
460460
};
461461

462+
// The `revision.deployment` selection (added in BA-6056) lets the mutation
463+
// update the parent deployment record in the Relay store atomically — so
464+
// row tags in the revision history table and the Configuration Section's
465+
// "current / deploying" panels stay consistent without a manual refresh.
466+
// `currentRevisionId` / `deployingRevisionId` aren't in any deployment
467+
// fragment yet (DeploymentRevisionHistoryTab reads them inline), so they
468+
// are selected explicitly here.
462469
const [commitAdd, isAddInFlight] =
463470
useMutation<DeploymentAddRevisionModalAddMutation>(graphql`
464471
mutation DeploymentAddRevisionModalAddMutation(
@@ -467,67 +474,18 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
467474
addModelRevision(input: $input) {
468475
revision {
469476
id
470-
clusterConfig {
471-
mode
472-
size
473-
}
474-
resourceConfig {
475-
resourceOpts {
476-
entries {
477-
name
478-
value
479-
}
480-
}
481-
}
482-
resourceSlots {
483-
slotName
484-
quantity
485-
}
486-
modelRuntimeConfig {
487-
runtimeVariantId
488-
environ {
489-
entries {
490-
name
491-
value
492-
}
493-
}
494-
}
495-
modelMountConfig {
496-
vfolderId
497-
mountDestination
498-
definitionPath
499-
}
500-
extraMounts {
501-
vfolderId
502-
mountDestination
503-
}
504-
modelDefinition {
505-
models {
506-
name
507-
modelPath
508-
service {
509-
preStartActions {
510-
action
511-
args
512-
}
513-
startCommand
514-
shell
515-
port
516-
healthCheck {
517-
interval
518-
path
519-
maxRetries
520-
maxWaitTime
521-
expectedStatusCode
522-
initialDelay
523-
}
524-
}
525-
}
526-
}
527-
imageV2 {
477+
...DeploymentRevisionDetail_revision
478+
deployment @since(version: "26.4.4") {
528479
id
529-
identity {
530-
canonicalName
480+
currentRevisionId
481+
deployingRevisionId
482+
currentRevision @since(version: "26.4.3") {
483+
id
484+
...DeploymentRevisionDetail_revision
485+
}
486+
deployingRevision @since(version: "26.4.3") {
487+
id
488+
...DeploymentRevisionDetail_revision
531489
}
532490
}
533491
}
@@ -1201,7 +1159,7 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
12011159
direction="row"
12021160
align="center"
12031161
justify="between"
1204-
gap="sm"
1162+
gap="md"
12051163
wrap="wrap"
12061164
style={{ paddingRight: token.paddingLG }}
12071165
>
@@ -1213,6 +1171,7 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
12131171
{ label: t('deployment.PresetMode'), value: 'preset' },
12141172
{ label: t('deployment.CustomMode'), value: 'custom' },
12151173
]}
1174+
style={{ fontWeight: 'normal' }}
12161175
/>
12171176
</BAIFlex>
12181177
}

react/src/components/DeploymentRevisionHistoryTab.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,14 @@ const DeploymentRevisionHistoryTab: React.FC<
260260
deployment {
261261
id
262262
currentRevisionId
263-
currentRevision {
263+
deployingRevisionId
264+
currentRevision @since(version: "26.4.3") {
265+
id
266+
...DeploymentRevisionDetail_revision
267+
}
268+
deployingRevision @since(version: "26.4.3") {
264269
id
270+
...DeploymentRevisionDetail_revision
265271
}
266272
}
267273
previousRevisionId

0 commit comments

Comments
 (0)