Skip to content

Commit a985514

Browse files
fix: add runtime guards for stale webgl events and fix type errors
1 parent 8e37cec commit a985514

4 files changed

Lines changed: 40 additions & 5 deletions

File tree

docs/openapi.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,10 @@ components:
660660
- assetBundles
661661
PlatformStatus:
662662
type: object
663-
description: Conversion status per platform (Windows and Mac)
663+
description: |
664+
Conversion status per platform (Windows and Mac).
665+
Note: WebGL platform support was removed as part of the WebGL asset bundle decommission.
666+
Only Windows and Mac platforms are supported going forward.
664667
properties:
665668
mac:
666669
type: string
@@ -754,7 +757,9 @@ components:
754757
- lods
755758
BundlePlatformStatus:
756759
type: object
757-
description: Conversion status for each platform
760+
description: |
761+
Conversion status for each platform.
762+
Note: WebGL platform was removed as part of the WebGL asset bundle decommission.
758763
properties:
759764
windows:
760765
type: string

src/logic/handlers/status-handler.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DeploymentToSqs } from '@dcl/schemas/dist/misc/deployments-to-sqs'
2-
import { AppComponents, IEventHandlerComponent, EventHandlerName, EventHandlerResult } from '../../types'
2+
import { AppComponents, IEventHandlerComponent, EventHandlerName, EventHandlerResult, isSupportedPlatform } from '../../types'
33
import { AssetBundleConversionManuallyQueuedEvent, Events } from '@dcl/schemas'
44

55
export const createStatusEventHandler = ({
@@ -19,8 +19,12 @@ export const createStatusEventHandler = ({
1919
if (event.type === Events.Type.ASSET_BUNDLE && event.subType === Events.SubType.AssetBundle.MANUALLY_QUEUED) {
2020
const { metadata } = event as AssetBundleConversionManuallyQueuedEvent
2121

22+
if (!isSupportedPlatform(metadata.platform)) {
23+
return { entityId: '', platforms: [], isLods: false }
24+
}
25+
2226
entityId = metadata.entityId
23-
platforms.push(metadata.platform as 'windows' | 'mac')
27+
platforms.push(metadata.platform)
2428
isLods = metadata.isLods
2529
} else {
2630
const deploymentEvent = event as DeploymentToSqs
@@ -42,6 +46,11 @@ export const createStatusEventHandler = ({
4246
try {
4347
const { entityId, platforms, isLods } = getEventProperties(event)
4448

49+
if (platforms.length === 0) {
50+
logger.warn('Ignoring event for unsupported platform')
51+
return { ok: true, handlerName: HANDLER_NAME }
52+
}
53+
4554
if (isLods) {
4655
logger.info('Skipping processing status for LODs', { entityId, platforms: platforms.join(', ') })
4756
return { ok: true, handlerName: HANDLER_NAME }

src/logic/handlers/textures-handler.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AssetBundleConversionFinishedEvent, Entity } from '@dcl/schemas'
2-
import { AppComponents, IEventHandlerComponent, EventHandlerName, EventHandlerResult, Registry } from '../../types'
2+
import { AppComponents, IEventHandlerComponent, EventHandlerName, EventHandlerResult, Registry, isSupportedPlatform } from '../../types'
33
import { ManifestStatusCode } from '../entity-status-fetcher'
44

55
export const createTexturesEventHandler = ({
@@ -21,6 +21,15 @@ export const createTexturesEventHandler = ({
2121
handle: async (event: AssetBundleConversionFinishedEvent): Promise<EventHandlerResult> => {
2222
try {
2323
const eventMetadata = event.metadata
24+
25+
if (!isSupportedPlatform(eventMetadata.platform)) {
26+
logger.warn('Ignoring event for unsupported platform', {
27+
entityId: eventMetadata.entityId,
28+
platform: eventMetadata.platform
29+
})
30+
return { ok: true, handlerName: HANDLER_NAME }
31+
}
32+
2433
let entity: Registry.DbEntity | null = await db.getRegistryById(eventMetadata.entityId)
2534

2635
// Track if the entity was originally OBSOLETE to preserve its status later

src/types/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,15 @@ export type MessageProcessorResult = {
151151
ok: boolean
152152
failedHandlers: EventHandlerName[]
153153
}
154+
155+
/**
156+
* Platforms supported for asset bundle conversion.
157+
* WebGL was decommissioned — stale events with platform 'webgl' must be
158+
* filtered out at the handler entry point.
159+
*/
160+
export const SUPPORTED_PLATFORMS = ['windows', 'mac'] as const
161+
export type SupportedPlatform = (typeof SUPPORTED_PLATFORMS)[number]
162+
163+
export function isSupportedPlatform(p: string): p is SupportedPlatform {
164+
return (SUPPORTED_PLATFORMS as readonly string[]).includes(p)
165+
}

0 commit comments

Comments
 (0)