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 { statusTone, toneClasses } from './utils';
|
||||
import { statusTone, toneClasses, formatActivityMeta } from './utils';
|
||||
|
||||
describe('statusTone', () => {
|
||||
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');
|
||||
});
|
||||
});
|
||||
|
||||
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 {
|
||||
return [
|
||||
workerId ? `worker: ${workerPill(workerId)}` : '',
|
||||
// Show the physical backend when it differs from the (proxy) worker name.
|
||||
backendId && backendId !== workerId ? `backend: ${workerPill(backendId)}` : '',
|
||||
mode ? `mode: ${mode}` : '',
|
||||
].filter(Boolean).join(' · ');
|
||||
// For proxy workers (AAO gateway) the interesting name is the PHYSICAL
|
||||
// backend behind the gateway — show it as the worker, with the proxy
|
||||
// relegated to a "via" suffix. Lines without a backend tag (direct
|
||||
// workers, or logs written before the backend tag existed) keep the
|
||||
// plain worker name.
|
||||
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[] {
|
||||
@ -215,7 +219,7 @@ export function buildActivitySteps(events: ActivityEvent[]): Array<{ label: stri
|
||||
let currentMovement: string | null = null;
|
||||
|
||||
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}` : '';
|
||||
|
||||
if (event.kind === 'movement_start') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user