Files
ComfyUI_frontend/browser_tests/fixtures/data
Matt Miller 8a819fa2be refactor(assets): read content hash from the canonical hash field (#12638)
## 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.
2026-06-04 18:18:12 +00:00
..

Mock Data Fixtures

Deterministic mock data for browser (Playwright) tests. Each fixture exports typed objects that conform to generated types from packages/ingest-types or Zod schemas in src/schemas/.

Usage with page.route()

Note: comfyPageFixture navigates to the app during setup(), before the test body runs. Routes must be registered before navigation to intercept initial page-load requests. Set up routes in a custom fixture or test.beforeEach that runs before comfyPage.setup().

import { createMockNodeDefinitions } from '../fixtures/data/nodeDefinitions'
import { mockSystemStats } from '../fixtures/data/systemStats'

// Extend the base set with test-specific nodes
const nodeDefs = createMockNodeDefinitions({
  MyCustomNode: {
    /* ... */
  }
})

await page.route('**/api/object_info', (route) =>
  route.fulfill({ json: nodeDefs })
)

await page.route('**/api/system_stats', (route) =>
  route.fulfill({ json: mockSystemStats })
)

Adding new fixtures

  1. Locate the generated type in packages/ingest-types or Zod schema in src/schemas/ for the endpoint you need.
  2. Create a new .ts file here that imports and satisfies the corresponding TypeScript type.
  3. Keep values realistic but stable — avoid dates, random IDs, or values that would cause test flakiness.