Skip to content

fix(FR-3221): handle nullable model service shell in deployment revision preset form#8060

Open
agatha197 wants to merge 1 commit into
mainfrom
fr-3221
Open

fix(FR-3221): handle nullable model service shell in deployment revision preset form#8060
agatha197 wants to merge 1 commit into
mainfrom
fr-3221

Conversation

@agatha197

@agatha197 agatha197 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Resolves #8059 (FR-3221)

Problem

The 26.7.0 GraphQL schema (backend.ai #12418 / BA-6551) relaxes the model service shell field on the output type ModelServiceConfig.shell from String! to String (nullable) — the same PR adds a single-string command field and deprecates the startCommand list. After syncing the schema, the deployment revision preset form failed to compile:

Type 'string | null | undefined' is not assignable to type 'string'.

because the edit-mode initial values map m.service.shell (now nullable) into ModelServiceFormValue.shell (typed string).

Approach

Preserve the nullability honestly instead of coercing a blank shell to an empty string. The same buildModelDefinitionInput object feeds both mutations, and their generated input types differ:

  • CreatePresetModelServiceConfigInput.shellshell?: string (optional, forbids null; omitting applies the server default /bin/bash).
  • UpdateModelServiceConfigInput.shellshell?: string | null (nullable).

So the form value is kept as string | undefined (never null) so it stays assignable to both. Clearing the field omits shell; because the update mutation replaces model_definition wholesale (backend TriState[ModelDefinition]) and the service input shell defaults to null, an omitted shell is stored as null — i.e. the previous value is cleared.

User intent Field Submitted Result
Keep value filled the value unchanged
Change value new value the value updated
Remove value blank omitted create → server default /bin/bash; update → null (cleared)

A blank (empty or whitespace-only) shell is normalized to undefined; '' / ' ' are never sent.

Changes

  • Schema sync: adopt the 26.7.0 data/schema.graphql and regenerate Relay artifacts (pnpm relay).
  • ModelServiceFormValue.shell → optional (string | undefined).
  • Edit-mode initial values normalize null → undefined (AdminDeploymentPresetSettingPageContent.tsx).
  • Submit normalizes a blank shell (service.shell?.trim() || undefined) to omit (AdminDeploymentPresetSettingPage.tsx).
  • Drop the required rule on the shell form item so it can be left blank (AdminDeploymentPresetModelConfigItem.tsx).

Screenshot

The model service fields on the preset form — Shell now carries the (optional) marker, while the still-required Port and Start Command do not:

Shell field is now optional

Verification

bash scripts/verify.sh=== ALL PASS ===

  • Relay: PASS
  • Lint: PASS
  • Format: PASS
  • TypeScript: PASS

🤖 Generated with Claude Code

@github-actions github-actions Bot added the size:XL 500~ LoC label Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@agatha197 agatha197 marked this pull request as ready for review June 26, 2026 09:12
Copilot AI review requested due to automatic review settings June 26, 2026 09:12
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for react-coverage (./react)

Status Category Percentage Covered / Total
🔵 Lines 6.77% 1947 / 28751
🔵 Statements 5.53% 2194 / 39646
🔵 Functions 5.7% 322 / 5646
🔵 Branches 3.71% 1387 / 37359
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
react/src/components/AdminDeploymentPresetFormTypes.ts 0% 100% 100% 0% 7
react/src/components/AdminDeploymentPresetModelConfigItem.tsx 0% 0% 0% 0% 25-151
react/src/components/AdminDeploymentPresetSettingPageContent.tsx 0% 0% 0% 0% 120-1048
react/src/pages/AdminDeploymentPresetSettingPage.tsx 0% 0% 0% 0% 24-417
Generated in workflow #2285 for commit 58994ca by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Admin deployment revision preset form to compile and behave correctly after the 26.7.0 schema change that makes ModelServiceConfig.shell nullable, while syncing the repo’s GraphQL schema and Relay artifacts.

Changes:

  • Sync data/schema.graphql to 26.7.0 and regenerate Relay artifacts.
  • Make ModelServiceFormValue.shell optional and normalize null → undefined when prefilling edit-mode values.
  • Allow the shell field to be left blank in the form and omit it from submit payloads.

Reviewed changes

Copilot reviewed 5 out of 32 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
react/src/pages/AdminDeploymentPresetSettingPage.tsx Normalizes submitted shell when building the model-definition mutation input.
react/src/components/AdminDeploymentPresetSettingPageContent.tsx Normalizes edit-mode initial values (shell: null → undefined).
react/src/components/AdminDeploymentPresetModelConfigItem.tsx Removes the required validation rule for the shell form item.
react/src/components/AdminDeploymentPresetFormTypes.ts Makes ModelServiceFormValue.shell optional and updates related type docs.
react/src/generated/VFolderDeployModalQuery.graphql.ts Relay artifact regenerated after schema sync.
react/src/generated/useCurrentUserProjectRolesQuery.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/ScopedAuditLogQuery.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RoleScopeTabRefetchQuery.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RoleScopeTabFragment.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RolePermissionTabRefetchQuery.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RolePermissionTabFragment.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RoleNodesFragment.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RoleFormModalPermissionMatrixQuery.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RoleFormModalCreateMutation.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RoleDetailDrawerQuery.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RoleAssignmentTabRefetchQuery.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/RoleAssignmentTab_roleScopeFragment.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/ModelCardDrawerQuery.graphql.ts Relay artifact regenerated after schema sync (presetValues type rename).
react/src/generated/DeploymentSettingModalCreateMutation.graphql.ts Relay artifact regenerated after schema sync (command added to service input).
react/src/generated/DeploymentRevisionDetail_revision.graphql.ts Relay artifact regenerated after schema sync (shell becomes nullable).
react/src/generated/DeploymentPresetDetailModalFragment.graphql.ts Relay artifact regenerated after schema sync (presetValues type rename).
react/src/generated/DeploymentAddRevisionModalPresetDetailQuery.graphql.ts Relay artifact regenerated after schema sync (presetValues type rename).
react/src/generated/DeploymentAddRevisionModalAddMutation.graphql.ts Relay artifact regenerated after schema sync (command added to service input).
react/src/generated/CreatePermissionModalUpdateMutation.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/CreatePermissionModalPermissionMatrixQuery.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/CreatePermissionModalCreateMutation.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/CreatePermissionModal_roleScopeFragment.graphql.ts Relay artifact regenerated after schema sync (RBAC enum updates).
react/src/generated/AdminDeploymentPresetSettingPageUpdateMutation.graphql.ts Relay artifact regenerated after schema sync (command, presetValues type rename).
react/src/generated/AdminDeploymentPresetSettingPagePresetQuery.graphql.ts Relay artifact regenerated after schema sync (presetValues type rename).
react/src/generated/AdminDeploymentPresetSettingPageCreateMutation.graphql.ts Relay artifact regenerated after schema sync (command, startCommand optional, presetValues type rename).
react/src/generated/AdminDeploymentPresetSettingPageContent_preset.graphql.ts Relay artifact regenerated after schema sync (shell becomes nullable, presetValues type rename).
data/schema.graphql Syncs the schema to 26.7.0 (nullable shell, new command, RBAC additions, presetValues type rename, etc.).
Files not reviewed (27)
  • react/src/generated/AdminDeploymentPresetSettingPageContent_preset.graphql.ts: Generated file
  • react/src/generated/AdminDeploymentPresetSettingPageCreateMutation.graphql.ts: Generated file
  • react/src/generated/AdminDeploymentPresetSettingPagePresetQuery.graphql.ts: Generated file
  • react/src/generated/AdminDeploymentPresetSettingPageUpdateMutation.graphql.ts: Generated file
  • react/src/generated/CreatePermissionModalCreateMutation.graphql.ts: Generated file
  • react/src/generated/CreatePermissionModalPermissionMatrixQuery.graphql.ts: Generated file
  • react/src/generated/CreatePermissionModalUpdateMutation.graphql.ts: Generated file
  • react/src/generated/CreatePermissionModal_roleScopeFragment.graphql.ts: Generated file
  • react/src/generated/DeploymentAddRevisionModalAddMutation.graphql.ts: Generated file
  • react/src/generated/DeploymentAddRevisionModalPresetDetailQuery.graphql.ts: Generated file
  • react/src/generated/DeploymentPresetDetailModalFragment.graphql.ts: Generated file
  • react/src/generated/DeploymentRevisionDetail_revision.graphql.ts: Generated file
  • react/src/generated/DeploymentSettingModalCreateMutation.graphql.ts: Generated file
  • react/src/generated/ModelCardDrawerQuery.graphql.ts: Generated file
  • react/src/generated/RoleAssignmentTabRefetchQuery.graphql.ts: Generated file
  • react/src/generated/RoleAssignmentTab_roleScopeFragment.graphql.ts: Generated file
  • react/src/generated/RoleDetailDrawerQuery.graphql.ts: Generated file
  • react/src/generated/RoleFormModalCreateMutation.graphql.ts: Generated file
  • react/src/generated/RoleFormModalPermissionMatrixQuery.graphql.ts: Generated file
  • react/src/generated/RoleNodesFragment.graphql.ts: Generated file
  • react/src/generated/RolePermissionTabFragment.graphql.ts: Generated file
  • react/src/generated/RolePermissionTabRefetchQuery.graphql.ts: Generated file
  • react/src/generated/RoleScopeTabFragment.graphql.ts: Generated file
  • react/src/generated/RoleScopeTabRefetchQuery.graphql.ts: Generated file
  • react/src/generated/ScopedAuditLogQuery.graphql.ts: Generated file
  • react/src/generated/VFolderDeployModalQuery.graphql.ts: Generated file
  • react/src/generated/useCurrentUserProjectRolesQuery.graphql.ts: Generated file

Comment thread react/src/pages/AdminDeploymentPresetSettingPage.tsx Outdated
Comment thread react/src/components/AdminDeploymentPresetFormTypes.ts
…ion preset form

Adopt the 26.7.0 GraphQL schema, which relaxes the model service `shell`
field on the output type from `String!` to `String` (nullable) — backend.ai
#12418 / BA-6551, which also adds a single-string `command` field and
deprecates the `startCommand` list. Update the deployment revision preset
form to preserve that nullability instead of coercing a blank shell to an
empty string.

- ModelServiceFormValue.shell -> optional (string | undefined; never null,
  so the shared submit object stays assignable to the create input, whose
  PresetModelServiceConfigInput.shell forbids null).
- Edit-mode initial values normalize null -> undefined so the field shows
  blank and can be cleared.
- Submit normalizes a blank shell to undefined (omit), never '': create
  falls back to the server default /bin/bash, and update — which replaces
  the model definition wholesale (backend TriState[ModelDefinition]) —
  stores null, clearing any previous shell.
- Drop the required rule on the shell form item so it can be left blank.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle nullable model service shell in deployment revision preset form

2 participants