sync: update from private repo (11502dd)
Some checks failed
CI / build-and-test (push) Has been cancelled
Some checks failed
CI / build-and-test (push) Has been cancelled
This commit is contained in:
parent
25c087067a
commit
35c3b483d0
@ -1,5 +1,5 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { statusTone, toneClasses } from './utils';
|
import { statusTone, toneClasses, formatActivityMeta } from './utils';
|
||||||
|
|
||||||
describe('statusTone', () => {
|
describe('statusTone', () => {
|
||||||
it('returns theme-adaptive light-dark() colors', () => {
|
it('returns theme-adaptive light-dark() colors', () => {
|
||||||
@ -24,3 +24,19 @@ describe('toneClasses', () => {
|
|||||||
expect(toneClasses('neutral')).toBe('bg-surface-2 text-slate-700 border-hairline');
|
expect(toneClasses('neutral')).toBe('bg-surface-2 text-slate-700 border-hairline');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('formatActivityMeta (backend-primary labels)', () => {
|
||||||
|
it('shows the physical backend as the worker with a via-proxy suffix', () => {
|
||||||
|
expect(formatActivityMeta('aao-gateway', 'quality', 'gpu-rtx-a'))
|
||||||
|
.toBe('worker: gpu-rtx-a (via aao-gateway) · mode: quality');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('falls back to the plain worker name when no backend tag exists', () => {
|
||||||
|
expect(formatActivityMeta('my-worker', null, null)).toBe('worker: my-worker');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('ignores a backend equal to the worker id (direct worker echo)', () => {
|
||||||
|
expect(formatActivityMeta('gpu-a', 'auto', 'gpu-a'))
|
||||||
|
.toBe('worker: gpu-a · mode: auto');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@ -120,12 +120,16 @@ export interface ActivityEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function formatActivityMeta(workerId: string | null, mode: string | null, backendId?: string | null): string {
|
export function formatActivityMeta(workerId: string | null, mode: string | null, backendId?: string | null): string {
|
||||||
return [
|
// For proxy workers (AAO gateway) the interesting name is the PHYSICAL
|
||||||
workerId ? `worker: ${workerPill(workerId)}` : '',
|
// backend behind the gateway — show it as the worker, with the proxy
|
||||||
// Show the physical backend when it differs from the (proxy) worker name.
|
// relegated to a "via" suffix. Lines without a backend tag (direct
|
||||||
backendId && backendId !== workerId ? `backend: ${workerPill(backendId)}` : '',
|
// workers, or logs written before the backend tag existed) keep the
|
||||||
mode ? `mode: ${mode}` : '',
|
// plain worker name.
|
||||||
].filter(Boolean).join(' · ');
|
const hasBackend = !!backendId && backendId !== workerId;
|
||||||
|
const workerLabel = hasBackend
|
||||||
|
? `worker: ${workerPill(backendId!)}${workerId ? ` (via ${workerId})` : ''}`
|
||||||
|
: workerId ? `worker: ${workerPill(workerId)}` : '';
|
||||||
|
return [workerLabel, mode ? `mode: ${mode}` : ''].filter(Boolean).join(' · ');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseActivityLog(logText: string): ActivityEvent[] {
|
export function parseActivityLog(logText: string): ActivityEvent[] {
|
||||||
@ -215,7 +219,7 @@ export function buildActivitySteps(events: ActivityEvent[]): Array<{ label: stri
|
|||||||
let currentMovement: string | null = null;
|
let currentMovement: string | null = null;
|
||||||
|
|
||||||
for (const event of events) {
|
for (const event of events) {
|
||||||
const meta = formatActivityMeta(event.workerId, event.mode);
|
const meta = formatActivityMeta(event.workerId, event.mode, event.backendId);
|
||||||
const suffix = meta ? ` · ${meta}` : '';
|
const suffix = meta ? ` · ${meta}` : '';
|
||||||
|
|
||||||
if (event.kind === 'movement_start') {
|
if (event.kind === 'movement_start') {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user