mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-06-06 07:51:57 +00:00
## Summary The assets API exposes an asset's content hash as `hash`. An older `asset_hash` field was a deprecated alias carrying the same value. This PR moves the frontend fully onto `hash` and removes `asset_hash` from the frontend entirely. ## Changes - Read `asset.hash` (no `?? asset_hash` fallback) across the asset consumers: - `useMediaAssetActions` — widget-value variants + cloud-mode stored-filename resolution - `assetsStore` — input-asset-by-filename map - `assetMetadataUtils.getAssetUrlFilename` - `missingMedia` resolver/scan and `missingModel` scan hash matching - `useComboWidget` / `useWidgetSelectItems` - `assetPreviewUtil.findOutputAsset` now queries `/assets?hash=` instead of the deprecated `?asset_hash=` param and matches on `a.hash`. - Removed `asset_hash` from the zod asset schema and the local `AssetRecord` type. Responses that still include the alias parse cleanly — zod strips unknown keys — so the declared field protected nothing once the reads were gone. - Purged `asset_hash` from all test fixtures/mocks; tests key on the canonical `hash`. ## Safety / rollout The API currently emits **both** `hash` and `asset_hash` with identical values, so reading `hash` is safe today. This is the frontend half of retiring the alias; the backend stops emitting `asset_hash` only after this ships and old bundles age out, so there is no window where the field the UI reads is absent. ## Verification - `pnpm typecheck`: clean. - Affected unit tests pass (asset utils, store, media/model scans, widget composables). - `grep -rn asset_hash src/`: zero matches.
93 lines
2.8 KiB
TypeScript
93 lines
2.8 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import type { Asset } from '@comfyorg/ingest-types'
|
|
import {
|
|
countAssetRequestsByTag,
|
|
createCloudAssetsFixture
|
|
} from '@e2e/fixtures/assetApiFixture'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
import { PropertiesPanelHelper } from '@e2e/tests/propertiesPanel/PropertiesPanelHelper'
|
|
|
|
const WORKFLOW = 'missing/nested_subgraph_installed_model'
|
|
const OUTER_SUBGRAPH_NODE_ID = '205'
|
|
const LOTUS_MODEL_NAME = 'lotus-depth-d-v1-1.safetensors'
|
|
|
|
const LOTUS_DIFFUSION_MODEL: Asset & { hash?: string } = {
|
|
id: 'test-lotus-depth-d-v1-1',
|
|
name: LOTUS_MODEL_NAME,
|
|
hash: 'blake3:0000000000000000000000000000000000000000000000000000000000000203',
|
|
size: 1_024,
|
|
mime_type: 'application/octet-stream',
|
|
tags: ['models', 'diffusion_models'],
|
|
created_at: '2026-05-05T00:00:00Z',
|
|
updated_at: '2026-05-05T00:00:00Z',
|
|
last_access_time: '2026-05-05T00:00:00Z',
|
|
user_metadata: {
|
|
filename: LOTUS_MODEL_NAME
|
|
}
|
|
}
|
|
|
|
const test = createCloudAssetsFixture([LOTUS_DIFFUSION_MODEL])
|
|
|
|
test.describe(
|
|
'Errors tab - Cloud missing models',
|
|
{ tag: ['@cloud', '@vue-nodes'] },
|
|
() => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.RightSidePanel.ShowErrorsTab',
|
|
true
|
|
)
|
|
})
|
|
|
|
test('keeps installed models resolved after returning from a nested subgraph', async ({
|
|
cloudAssetRequests,
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow(WORKFLOW)
|
|
|
|
const panel = new PropertiesPanelHelper(comfyPage.page)
|
|
const errorOverlay = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.errorOverlay
|
|
)
|
|
const errorsTab = panel.root.getByTestId(
|
|
TestIds.propertiesPanel.errorsTab
|
|
)
|
|
|
|
await expect
|
|
.poll(
|
|
() => countAssetRequestsByTag(cloudAssetRequests, 'diffusion_models'),
|
|
{ timeout: 10_000 }
|
|
)
|
|
.toBeGreaterThan(0)
|
|
await expect(errorOverlay).toBeHidden()
|
|
await panel.open(comfyPage.actionbar.propertiesButton)
|
|
await expect(errorsTab).toBeHidden()
|
|
await panel.close()
|
|
|
|
await comfyPage.vueNodes.enterSubgraph(OUTER_SUBGRAPH_NODE_ID)
|
|
await expect.poll(() => comfyPage.subgraph.isInSubgraph()).toBe(true)
|
|
await expect(errorOverlay).toBeHidden()
|
|
|
|
const requestCountBeforeRootReturn = countAssetRequestsByTag(
|
|
cloudAssetRequests,
|
|
'diffusion_models'
|
|
)
|
|
|
|
await comfyPage.subgraph.exitViaBreadcrumb()
|
|
await panel.open(comfyPage.actionbar.propertiesButton)
|
|
|
|
await expect
|
|
.poll(
|
|
() =>
|
|
countAssetRequestsByTag(cloudAssetRequests, 'diffusion_models') >
|
|
requestCountBeforeRootReturn,
|
|
{ timeout: 10_000 }
|
|
)
|
|
.toBe(true)
|
|
|
|
await expect(errorsTab).toBeHidden()
|
|
})
|
|
}
|
|
)
|