beadboard/tests/lib/coord-schema.test.ts
zenchantlive c246ceaf21 feat(ux): consolidate Launch Swarm + telemetry UX with minimized strip
- Removed broken LaunchSwarmDialog (formula-based) from TopBar/LeftPanel
- All Rocket buttons (TopBar, LeftPanel, DAG nodes, social cards) now open
  AssignmentPanel (archetype-based) which actually works
- Every Rocket clears taskId first so assignMode && !taskId condition passes
- Conversation button priority: taskId always shows conversation, not assign panel
- Added TelemetryStrip: minimized right sidebar with status dots when non-telemetry
  panel (conversation/assignment) is active
- Live feed has minimize button → restores last taskId or assignMode
- DAG nodes: Signal icon → restores telemetry feed
- Social button on DAG nodes: single router.push to avoid race (setView + setTaskId)
- Fixed social card message button: opens right panel with drawer:closed (no popup)

Co-Authored-By: Oz <oz-agent@warp.dev>
2026-03-01 18:17:58 -08:00

63 lines
1.8 KiB
TypeScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { validateCoordEventEnvelope } from '../../src/lib/coord-schema';
function baseEnvelope(eventType: string): any {
return {
version: 'coord.v1',
kind: 'coord_event',
issue_id: 'bb-123',
actor: 'amber-otter',
timestamp: '2026-02-28T18:00:00.000Z',
data: {
event_type: eventType,
event_id: 'evt_01JN6Y1Q7R80E8P6K1Q5',
project_root: '/tmp/repo',
payload: {},
},
};
}
test('validateCoordEventEnvelope accepts valid SEND', () => {
const input = baseEnvelope('SEND');
input.data.to_agent = 'cobalt-harbor';
input.data.state = 'unread';
input.data.payload = { subject: 's', body: 'b' };
const result = validateCoordEventEnvelope(input);
assert.equal(result.ok, true);
});
test('validateCoordEventEnvelope rejects READ without event_ref', () => {
const input = baseEnvelope('READ');
const result = validateCoordEventEnvelope(input);
assert.equal(result.ok, false);
if (!result.ok) {
assert.match(result.error, /event_ref/i);
}
});
test('validateCoordEventEnvelope accepts TAKEOVER with stale mode', () => {
const input = baseEnvelope('TAKEOVER');
input.data.scope = 'src/lib/*';
input.data.takeover_mode = 'stale';
input.data.reason = 'owner stale';
const result = validateCoordEventEnvelope(input);
assert.equal(result.ok, true);
});
test('validateCoordEventEnvelope rejects TAKEOVER with invalid mode', () => {
const input = baseEnvelope('TAKEOVER');
input.data.scope = 'src/lib/*';
input.data.takeover_mode = 'none';
input.data.reason = 'owner stale';
const result = validateCoordEventEnvelope(input);
assert.equal(result.ok, false);
if (!result.ok) {
assert.match(result.error, /takeover_mode/i);
}
});