Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion packages/app/src/lib/inference-labels.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

import { getHardwareConfig } from '@/lib/constants';
import {
Expand All @@ -12,6 +12,61 @@ const runUrl = 'https://github.com/SemiAnalysisAI/InferenceX/actions/runs/349262
const historicalUrl = 'https://github.com/SemiAnalysisAI/InferenceX/actions/runs/34926284364';
const hwKey = 'mi355x_mori-sglang';

describe('temporary DSpark UMBP run label', () => {
const dsparkUrl = 'https://github.com/SemiAnalysisAI/InferenceX/actions/runs/35166686551';
const expiresAt = Date.parse('2026-10-09T01:32:00Z');

beforeEach(() => {
vi.spyOn(Date, 'now').mockReturnValue(Date.parse('2026-09-18T01:32:00Z'));
});
afterEach(() => vi.restoreAllMocks());

it.each([dsparkUrl, `${dsparkUrl}/attempts/1`, `${dsparkUrl}/attempts/5`])(
'labels the new run without changing identity: %s',
(url) => {
expect(inferenceFrameworkLabelOverride('mori-sglang', url)).toBe('MoRI UMBP SGLang');
expect(inferenceFrameworkLabelOverride('sglang-disagg', url)).toBe('MoRI UMBP SGLang');
expect(inferenceFrameworkLabelOverride('sglang', url)).toBeUndefined();
const config = getInferenceHardwareConfig(hwKey, undefined, [{ run_url: url }]);
expect(config.suffix).toBe('(MoRI UMBP SGLang)');
expect(config.name).toBe(getHardwareConfig(hwKey).name);
expect(getPointHardwareConfig({ hwKey, run_url: url }, config)).toEqual(config);
expect(getInferenceRunLabel('✕ dspark', [{ framework: 'mori-sglang', run_url: url }])).toBe(
'✕ dspark (MoRI UMBP SGLang)',
);
},
);

it('leaves neighboring run IDs and mixed historical points correctly labeled', () => {
for (const id of ['35166686550', '35166686552', '351666865510']) {
expect(
inferenceFrameworkLabelOverride('mori-sglang', dsparkUrl.replace('35166686551', id)),
).toBeUndefined();
}
expect(
getInferenceHardwareConfig(hwKey, undefined, [
{ run_url: dsparkUrl },
{ run_url: historicalUrl },
]).suffix,
).toBe('(MoRI SGLang / MoRI UMBP SGLang)');
});

it('returns to the standard label at the exact cutoff in all shared display paths', () => {
vi.mocked(Date.now).mockReturnValue(expiresAt - 1);
expect(inferenceFrameworkLabelOverride('mori-sglang', dsparkUrl)).toBe('MoRI UMBP SGLang');
for (const now of [expiresAt, expiresAt + 1, expiresAt + 86_400_000]) {
vi.mocked(Date.now).mockReturnValue(now);
expect(inferenceFrameworkLabelOverride('mori-sglang', dsparkUrl)).toBeUndefined();
const point = { hwKey, framework: 'mori-sglang', run_url: dsparkUrl };
const generic = getHardwareConfig(hwKey);
expect(getInferenceHardwareConfig(hwKey, undefined, [point])).toBe(generic);
expect(getPointHardwareConfig(point, generic)).toBe(generic);
expect(getInferenceRunLabel('✕ dspark', [point])).toBe('✕ dspark');
expect(inferenceFrameworkLabelOverride('mori-sglang', runUrl)).toBe('MoRI UMBP SGLang');
}
});
});

describe('run-specific MoRI UMBP labels', () => {
it('retains the unofficial marker and branch while labeling only the target overlay', () => {
expect(
Expand Down
13 changes: 9 additions & 4 deletions packages/app/src/lib/inference-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ interface RunProvenance {
run_url?: string | null;
}

// Three-week recognition window, ending 2026-10-08 at 21:32 America/New_York.
const UMBP_DSPARK_LABEL_EXPIRES_AT = Date.parse('2026-10-09T01:32:00Z');

/** Display-only: never change framework/hardware keys used by filters and history. */
export function inferenceFrameworkLabelOverride(
framework: string,
runUrl?: string | null,
): string | undefined {
return resolveFrameworkAlias(framework) === 'mori-sglang' &&
runIdFromRunUrl(runUrl) === '34926284365'
? 'MoRI UMBP SGLang'
: undefined;
if (resolveFrameworkAlias(framework) !== 'mori-sglang') return undefined;
const runId = runIdFromRunUrl(runUrl);
const hasLabel =
runId === '34926284365' ||
(runId === '35166686551' && Date.now() < UMBP_DSPARK_LABEL_EXPIRES_AT);
return hasLabel ? 'MoRI UMBP SGLang' : undefined;
}

/** Keep unofficial-run identity/markers while making its special engine visible. */
Expand Down
Loading