Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ nul
.spawner/
svelte-check-output.txt
.gstack/
# Office lockfiles (Word/Excel/PowerPoint create these when files are open)
~$*
2 changes: 1 addition & 1 deletion src/lib/components/MissionBoard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
const counts = getMissionBoardWorkBreakdown(card).build;
if (!counts || counts.total <= 0) {
if (card.status === 'completed') return 100;
if (card.status === 'running') return 48;
if (card.status === 'running') return 0;
return 0;
}
return Math.round(((counts.completed + counts.failed + counts.cancelled) / counts.total) * 100);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/services/completion-evidence-display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export function completionEvidenceTooltipForDisplay(
): string | null {
if (!evidence || evidence.state === 'not_terminal') return null;
if (evidence.state === 'complete') return 'Completion proof is present.';
return 'Completion proof is incomplete.';
return evidence.summary || 'Completion proof is incomplete.';
}
8 changes: 4 additions & 4 deletions src/lib/stores/canvas.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export function addNodesWithConnections(
const sourceId = nodeIds[connDef.sourceIndex];
const targetId = nodeIds[connDef.targetIndex];
if (sourceId && targetId) {
const id = 'conn-' + Math.random().toString(36).slice(2, 10);
const id = 'conn-' + crypto.randomUUID();
const connection: Connection = {
id,
sourceNodeId: sourceId,
Expand Down Expand Up @@ -437,7 +437,7 @@ export function duplicateSelected(): string[] {
);
const newConnections: Connection[] = connectionsToDuplicate.map((conn) => ({
...conn,
id: 'conn-' + Math.random().toString(36).slice(2, 10),
id: 'conn-' + crypto.randomUUID(),
sourceNodeId: idMap[conn.sourceNodeId],
targetNodeId: idMap[conn.targetNodeId]
}));
Expand Down Expand Up @@ -493,7 +493,7 @@ export function pasteFromClipboard(): string[] {
// Recreate connections
const newConnections: Connection[] = clipboard.connections.map((conn) => ({
...conn,
id: 'conn-' + Math.random().toString(36).slice(2, 10),
id: 'conn-' + crypto.randomUUID(),
sourceNodeId: idMap[conn.sourceNodeId],
targetNodeId: idMap[conn.targetNodeId]
}));
Expand Down Expand Up @@ -523,7 +523,7 @@ export function addConnection(
): string {
pushHistory();

const id = 'conn-' + Math.random().toString(36).slice(2, 10);
const id = 'conn-' + crypto.randomUUID();
const connection: Connection = {
id,
sourceNodeId,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/missions/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
<!-- Filters & Actions -->
<div class="flex items-center justify-between mb-6">
<div class="flex items-center gap-2">
{#each ['all', 'spark', 'draft', 'ready', 'running', 'completed', 'failed'] as status}
{#each ['all', 'spark', 'draft', 'ready', 'running', 'paused', 'completed', 'failed'] as status}
{@const count = statusCounts()[status] || 0}
<button
onclick={() => filterStatus = status}
Expand Down
28 changes: 28 additions & 0 deletions tests/test_canvas_store_conn_id.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { describe, it, expect } from 'vitest';

const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

function makeConnId(): string {
return 'conn-' + crypto.randomUUID();
}

describe('canvas store connection ID generation', () => {
it('starts with conn- prefix', () => {
expect(makeConnId()).toMatch(/^conn-/);
});
it('contains a valid UUID v4', () => {
const id = makeConnId();
expect(UUID_RE.test(id.slice(5))).toBe(true);
});
it('does not use Math.random', () => {
const src = makeConnId.toString();
expect(src).not.toContain('Math.random');
});
it('generates 1000 unique IDs', () => {
const ids = Array.from({ length: 1000 }, () => makeConnId());
expect(new Set(ids).size).toBe(1000);
});
it('is a plain string', () => {
expect(typeof makeConnId()).toBe('string');
});
});
Loading