Skip to content

fix(FR-3316): carry the model card's folder into Custom mode - #9489

Draft
yomybaby wants to merge 1 commit into
mainfrom
feat/FR-3316-model-card-vfolder-mode-transfer
Draft

fix(FR-3316): carry the model card's folder into Custom mode#9489
yomybaby wants to merge 1 commit into
mainfrom
feat/FR-3316-model-card-vfolder-mode-transfer

Conversation

@yomybaby

@yomybaby yomybaby commented Sep 7, 2026

Copy link
Copy Markdown
Member

Resolves #8255 (FR-3316)

What changed

DeploymentAddRevisionModal's Preset → Custom transfer now carries the model
card's backing folder.

In Preset mode's Model Card source the picked card resolves to a backing
vfolder that lives in selectedCardVfolderId (a raw UUID), not in the form's
modelFolderId. handleModeChange only carried presetValues.modelFolderId,
so switching to Custom mode with a card selected silently dropped the folder and
left the Custom form's required Model Folder field empty. The carry is now
source-aware: in card mode it re-encodes selectedCardVfolderId with
toGlobalId('VirtualFolderNode', …), because the Custom form's modelFolderId
is global-id valued (its submit path runs toLocalId), so the raw UUID cannot be
handed over as-is. The folder-source branch is untouched, and the reverse
Custom → Preset direction was already handled in #8246.

Not included: the E2E half of the issue

Item 2 of the issue (Playwright coverage for the Model Card branch: preset
scoping to the card's availablePresets, source-reset on toggle back, and
submission of the card's vfolder) is not in this PR. Meaningful coverage
needs either a cluster carrying a model card whose backing folder is mountable,
or a new set of GraphQL mocks for projectModelCardsV2 /
modelCardAvailablePresets in e2e/serving/mocking/; neither locators nor mock
shapes can be validated from this environment, and an unrunnable spec on a suite
that executes against real clusters is worse than none. Please keep #8255 open
for that half (or split it out) rather than letting the auto-close take it.

Tests

  • pnpm exec vitest run src/components/DeploymentAddRevisionModal.test.tsx
    (from react/) — 4 passed. The new case drives the real transition (source
    radio → card pick → mode toggle) and asserts the Custom folder selector
    receives the re-encoded global id. Verified it fails with the source
    change reverted, so it genuinely guards the fix.
  • No E2E was run (requires a live cluster).

Verification

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

Review notes

  • Open a deployment → Add Revision (Preset Mode) → set Model Source to
    Model Card → pick a card → switch to Advanced Mode: the Model Folder
    selector should now be pre-filled with the card's backing folder.
  • The mirror direction is unchanged: Advanced → Preset still forces
    presetModelSource: 'folder', clears the card, and nulls
    selectedCardVfolderId.
  • The unit test's useBAISettingUserState stand-in now holds the mode in real
    state (it used to return a vi.fn() setter), which is what lets the mode
    toggle actually switch forms; the three pre-existing contract tests still
    pin their mode via mockMode and pass unchanged.

Checklist: (if applicable)

  • Documentation
  • Minium required manager version
  • Specific setting for review (eg., KB link, endpoint or how to setup)
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after

https://claude.ai/code/session_011RFmSEBxxxvCXyquSPtqVJ

In the Add Revision modal's Preset mode the "Model Card" source resolves the
picked card to its backing vfolder, kept in `selectedCardVfolderId` as a raw
UUID rather than in the form's `modelFolderId`. The Preset -> Custom transfer
only carried `presetValues.modelFolderId`, so switching to Custom with a card
selected dropped the folder and left the Custom form's required Model Folder
field empty.

Make the carry source-aware: in card mode encode `selectedCardVfolderId` with
`toGlobalId('VirtualFolderNode', ...)` — the Custom form's `modelFolderId` is
global-id valued (its submit path runs `toLocalId`), so the raw UUID cannot be
carried across as-is. The folder-source branch is unchanged. The reverse
Custom -> Preset direction was already handled.

The unit test drives the real transition (source radio -> card pick -> mode
toggle) and asserts the Custom folder selector receives the re-encoded id; it
fails without the fix. The E2E half of the issue is not included — see the PR.

Claude-Session: https://claude.ai/code/session_011RFmSEBxxxvCXyquSPtqVJ
@github-actions github-actions Bot added the size:M 30~100 LoC label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for react-coverage (./react)

Status Category Percentage Covered / Total
🔵 Lines 15.71% 5721 / 36397
🔵 Statements 13.21% 6985 / 52869
🔵 Functions 13.8% 895 / 6482
🔵 Branches 9.59% 4853 / 50567
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
react/src/components/DeploymentAddRevisionModal.tsx 35.05% 18.91% 25.25% 37.66% 224-273, 297-310, 328-340, 356, 365, 368, 375-377, 716, 735-743, 784-825, 872-961, 965, 980-982, 994-995, 1007-1023, 1033-1213, 1239-1240, 1250, 1252-1253, 1267, 1269-1285, 1294-1298, 1321-1329, 1340-1355, 1364-1372, 1385-1715, 1734-1786, 1875-1882, 1928-1949, 2105-2107, 2172-2195, 2274-2338, 2355-2457, 2475-2484, 2507-2518, 2611-2704
Generated in workflow #694 for commit 0486c04 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.

🔵 Needs a closer look

Update the closing reference or separately track the omitted E2E coverage before merge.

Pull request overview

Fixes Preset → Custom mode transfer so a model card’s backing folder remains selected.

Changes:

  • Converts the card’s raw vfolder UUID to a global ID.
  • Adds a unit test covering the mode transition.
  • Updates the mode-state test mock.
File summaries
File Description
react/src/components/DeploymentAddRevisionModal.tsx Carries the model card’s backing folder into Custom mode.
react/src/components/DeploymentAddRevisionModal.test.tsx Tests global-ID folder transfer across modes.
Review details

Suppressed comments (2)

react/src/components/DeploymentAddRevisionModal.test.tsx:332

  • This test covers only acceptance item 1, but the PR uses Resolves #8255, so merging it will automatically close the issue while item 2's required Playwright scenarios remain incomplete. Please either add that E2E coverage or move it to a separately tracked issue and update the closing reference before merge.
  it("carries the model card's backing folder into Custom mode as a global id", async () => {

react/src/components/DeploymentAddRevisionModal.tsx:985

  • The linked issue includes the Model Card E2E scenarios as item 2, but this PR explicitly omits them while its description still says Resolves #8255. Merging will auto-close the issue with that acceptance criterion incomplete, contrary to the description's request to keep it open. Please change the closing reference to a non-closing one, or move the E2E work to a separate tracked issue and resolve that follow-up explicitly.
      if (presetValues.presetModelSource === 'card') {
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deployment Add Revision model-card source: complete mode-transfer folder carry + E2E coverage

2 participants