Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
# Create at: https://github.com/settings/personal-access-tokens
# GITHUB_TOKEN=

# CollectiveX public artifact store (serves only the store's public/ tree)
# COLLECTIVEX_STORE_ROOT=/absolute/path/to/collectivex-store

# ╔══════════════════════════════════════════════════════════════════════════╗
# ║ Production deployment (Vercel) ║
# ║ ║
Expand Down
6 changes: 6 additions & 0 deletions packages/app/cypress/component/tab-nav.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ describe('TabNav — unofficialrun URL preservation (issue #319)', () => {
'href',
'/submissions?unofficialruns=12345',
);
cy.get('[data-testid="tab-trigger-collectivex"]').should(
'have.attr',
'href',
'/collectivex?unofficialruns=12345',
);
cy.get('[data-testid="tab-trigger-historical"]').should(
'have.attr',
'href',
Expand Down Expand Up @@ -109,6 +114,7 @@ describe('TabNav — Hidden popover for gated tabs', () => {
mountTabNav({});
cy.get('[data-testid="tab-trigger-inference"]').should('exist');
cy.get('[data-testid="tab-trigger-gpu-specs"]').should('exist');
cy.get('[data-testid="tab-trigger-collectivex"]').should('exist');
cy.get('[data-testid="tab-trigger-submissions"]').should('exist');
cy.get('[data-testid="tab-trigger-hidden"]').should('not.exist');
cy.get('[data-testid="tab-trigger-feedback"]').should('not.exist');
Expand Down
291 changes: 291 additions & 0 deletions packages/app/cypress/e2e/collectivex.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
import {
makeCollectiveXDataset,
makeCollectiveXDatasetWithDiagnosticCohort,
makeCollectiveXDiagnosticDataset,
} from '@/components/collectivex/test-fixture';
import type { CollectiveXDataset } from '@/components/collectivex/types';

type Channel = 'dev-latest' | 'latest-attempt';
const channelUrl = (channel: Channel) => `/collectivex-data/channels/${channel}.json`;

async function sha256(value: string): Promise<string> {
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(value));
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, '0')).join('');
}

function installPublication(
dataset: CollectiveXDataset | Record<string, unknown> = makeCollectiveXDataset(),
options: { channel?: Channel; digest?: string; delay?: number } = {},
) {
const channel = options.channel ?? 'dev-latest';
const body = JSON.stringify(dataset);
return cy.wrap(sha256(body), { log: false }).then((actualDigest) => {
const digest = options.digest ?? actualDigest;
cy.intercept('GET', channelUrl(channel), {
body: {
format: 'collectivex.channel.v1',
channel,
generated_at: '2026-07-04T01:00:00Z',
dataset: {
path: `datasets/${digest}/dataset.json`,
sha256: digest,
bytes: new TextEncoder().encode(body).length,
},
},
}).as(`collectivexChannel-${channel}`);
cy.intercept('GET', `/collectivex-data/datasets/${digest}/dataset.json`, {
body,
delay: options.delay,
headers: { 'content-type': 'application/json' },
}).as(`collectivexDataset-${channel}`);
});
}

function openCollectiveX() {
cy.visit('/collectivex');
cy.wait('@collectivexChannel-dev-latest');
cy.get('[data-testid="collectivex-display"]', { timeout: 10_000 }).should('be.visible');
}

describe('CollectiveX native publication', () => {
beforeEach(() => {
installPublication();
installPublication(makeCollectiveXDiagnosticDataset(), { channel: 'latest-attempt' });
openCollectiveX();
});

it('defaults to a publisher-controlled, decision-grade cohort', () => {
cy.get('[data-testid="collectivex-display"]')
.should('contain.text', 'Promoted v1')
.and('contain.text', '7/7')
.and('contain.text', '22')
.and('contain.text', 'H100 EP8 library comparison');
cy.get('[data-testid="collectivex-scope-toggle"]')
.contains('button', 'Controlled')
.should('have.attr', 'aria-selected', 'true');
cy.get('[data-testid="collectivex-main-chart"]')
.should('contain.text', 'Round trip (measured) · decode · p99')
.and('contain.text', 'H100 EP8 · deepep')
.and('contain.text', 'H100 EP8 · mori');
cy.get('[data-testid="collectivex-explorer-chart"] .line-path').should('have.length', 2);
cy.get('[data-testid="collectivex-diagnostic-warning"]').should('not.exist');
});

it('keeps the evidence workflow usable on a mobile viewport', () => {
cy.viewport(390, 844);
cy.get('[data-testid="collectivex-channel-toggle"]').should('be.visible');
cy.get('[data-testid="collectivex-cohort-select"]').should('be.visible');
cy.get('[data-testid="collectivex-tabs"]').should('be.visible');
cy.document()
.its('documentElement')
.should((element) => {
expect(element.scrollWidth).to.be.at.most(element.clientWidth);
});
});

it('requires an explicit switch to render diagnostics', () => {
installPublication(makeCollectiveXDatasetWithDiagnosticCohort());
cy.reload();
cy.wait('@collectivexChannel-dev-latest');
cy.get('[data-testid="collectivex-scope-toggle"]').contains('button', 'Diagnostics').click();

cy.get('[data-testid="collectivex-diagnostic-warning"]')
.should('be.visible')
.and('contain.text', 'excluded from rankings');
cy.get('[data-testid="collectivex-main-chart"]')
.should('contain.text', 'H100 EP8 · deepep')
.and('contain.text', 'H100 EP8 · mori');
cy.get('[data-testid="collectivex-explorer-chart"] .line-path').should('have.length', 2);
cy.get('[data-testid="collectivex-sku-select"]').should('exist');
});

it('shows why a controlled cohort was excluded', () => {
installPublication(makeCollectiveXDatasetWithDiagnosticCohort());
cy.reload();
cy.wait('@collectivexChannel-dev-latest');
cy.get('[data-testid="collectivex-scope-toggle"]').contains('button', 'Diagnostics').click();
cy.get('[data-testid="collectivex-cohort-select"]').click();
cy.contains('[role="option"]', 'H100 EP8 library comparison').click();

cy.get('[data-testid="collectivex-diagnostic-cohort-reasons"]')
.should('contain.text', 'unstable-ordering')
.and('contain.text', 'p50 1.050x')
.and('contain.text', 'p99 1.100x');
cy.get('[data-testid="collectivex-main-chart"]')
.should('contain.text', 'H100 EP8 · deepep')
.and('contain.text', 'H100 EP8 · mori');
});

it('resolves the latest-attempt channel without carrying published data forward', () => {
cy.get('[data-testid="collectivex-channel-toggle"]')
.contains('button', 'Latest attempt')
.click();
cy.wait('@collectivexChannel-latest-attempt');

cy.get('[data-testid="collectivex-display"]')
.should('contain.text', 'diagnostic')
.and('contain.text', '1/1')
.and('contain.text', '1')
.and('contain.text', 'H100 EP8 · nccl-ep')
.and('not.contain.text', 'H100 EP8 · deepep');
});

it('resets diagnostic cohorts and filters when the publication changes', () => {
installPublication(makeCollectiveXDatasetWithDiagnosticCohort());
const latest = makeCollectiveXDiagnosticDataset();
latest.series[0].label = 'MI300X EP8 · nccl-ep';
latest.series[0].system = {
...latest.series[0].system,
sku: 'mi300x',
label: 'AMD Instinct MI300X',
vendor: 'amd',
topology_class: 'single-node-xgmi',
transport: 'xgmi',
};
latest.coverage[0].sku = 'mi300x';
installPublication(latest, { channel: 'latest-attempt' });
cy.reload();
cy.wait('@collectivexChannel-dev-latest');

cy.get('[data-testid="collectivex-scope-toggle"]').contains('button', 'Diagnostics').click();
cy.get('[data-testid="collectivex-cohort-select"]').click();
cy.contains('[role="option"]', 'H100 EP8 library comparison').click();
cy.get('[data-testid="collectivex-sku-select"]').click();
cy.contains('[role="option"]', 'H100').click();
cy.get('[data-testid="collectivex-channel-toggle"]')
.contains('button', 'Latest attempt')
.click();
cy.wait('@collectivexChannel-latest-attempt');

cy.get('[data-testid="collectivex-cohort-select"]').should(
'contain.text',
'All diagnostic evidence',
);
cy.get('[data-testid="collectivex-sku-select"]').should('contain.text', 'All');
cy.get('[data-testid="collectivex-main-chart"]')
.should('contain.text', 'MI300X EP8 · nccl-ep')
.and('not.contain.text', 'H100 EP8 · deepep');
});

it('never promotes latest-attempt candidates in the browser', () => {
const unpromoted = makeCollectiveXDataset();
unpromoted.promotion.status = 'diagnostic';
installPublication(unpromoted, { channel: 'latest-attempt' });
cy.get('[data-testid="collectivex-channel-toggle"]')
.contains('button', 'Latest attempt')
.click();
cy.wait('@collectivexChannel-latest-attempt');

cy.get('[data-testid="collectivex-scope-toggle"]')
.find('button')
.should('have.length', 1)
.and('contain.text', 'Diagnostics');
cy.get('[data-testid="collectivex-main-chart"]')
.should('contain.text', 'H100 EP8 · deepep')
.and('contain.text', 'H100 EP8 · nccl-ep');

cy.contains('[role="tab"]', 'Decisions').click();
cy.get('[data-testid="collectivex-unpromoted-decisions"]').should(
'contain.text',
'does not drive rankings or recommendations',
);
cy.get('[data-testid="collectivex-rankings"]').should('not.exist');
});

it('can inspect the latest attempt before the first promotion exists', () => {
cy.intercept('GET', channelUrl('dev-latest'), { statusCode: 404 }).as('missingPromotion');
cy.reload();
cy.wait('@missingPromotion');
cy.get('[data-testid="collectivex-error"]').should('be.visible');

cy.get('[data-testid="collectivex-error-channel-toggle"]')
.contains('button', 'Latest attempt')
.click();
cy.wait('@collectivexChannel-latest-attempt');
cy.get('[data-testid="collectivex-display"]')
.should('be.visible')
.and('contain.text', 'diagnostic');
});

it('renders only publisher-declared rankings and recommendations', () => {
cy.contains('[role="tab"]', 'Decisions').click();

cy.get('[data-testid="collectivex-rankings"]')
.should('contain.text', '3 series allocations')
.and('contain.text', 'deepep')
.and('contain.text', 'mori')
.and('not.contain.text', 'nccl-ep');
cy.get('[data-testid="collectivex-recommendations"]')
.should('contain.text', 'Best min-p99-latency at T=128')
.and('contain.text', '100 us')
.and('contain.text', 'deepep');

cy.get('[data-testid="collectivex-cohort-select"]').click();
cy.contains('[role="option"]', 'H100 EP8 routing comparison').click();
cy.get('[data-testid="collectivex-sensitivity"]')
.should('contain.text', 'Routing sensitivity latency_us p99 T=128')
.and('contain.text', '30.0%');
});

it('shows terminal coverage and every retained retry', () => {
cy.contains('[role="tab"]', 'Evidence').click();

cy.get('[data-testid="collectivex-coverage-table"]')
.should('contain.text', 'deepep decode')
.and('contain.text', 'nccl-ep decode')
.and('contain.text', 'MI355X / DeepEP / unsupported')
.and('contain.text', 'runnable')
.and('contain.text', 'unsupported')
.and('contain.text', 'capability')
.and('contain.text', 'success');
cy.get('[data-testid="collectivex-attempts-table"]')
.should('contain.text', 'timeout')
.and('contain.text', 'execution-timeout')
.and('contain.text', 'failed')
.and('contain.text', 'retained')
.and('contain.text', 'selected')
.and('contain.text', 'Failure mode');
cy.get('[data-testid="collectivex-provenance"]')
.should('contain.text', 'dev-latest')
.and('contain.text', 'Dataset SHA-256');
});

it('keeps nullable isolated components unavailable', () => {
cy.get('[data-testid="collectivex-operation-select"]').click();
cy.contains('[role="option"]', 'Dispatch').click();

cy.get('[data-testid="collectivex-explorer-chart"] .line-path').should('have.length', 1);
cy.get('[data-testid="collectivex-main-chart"]').should(
'contain.text',
'Unavailable components remain null',
);
});

it('renders loading while resolving immutable bytes', () => {
const delayed = makeCollectiveXDataset();
delayed.generated_at = '2026-07-04T02:00:00Z';
installPublication(delayed, { delay: 750 });
cy.reload();
cy.get('[data-testid="collectivex-loading"]').should('be.visible');
cy.wait('@collectivexDataset-dev-latest');
cy.get('[data-testid="collectivex-display"]').should('be.visible');
});

it('fails closed on digest or schema mismatch', () => {
installPublication(makeCollectiveXDataset(), { digest: 'f'.repeat(64) });
cy.reload();
cy.wait('@collectivexChannel-dev-latest');
cy.get('[data-testid="collectivex-error"]')
.should('be.visible')
.and('contain.text', 'SHA-256 does not match');

const malformed = makeCollectiveXDataset() as unknown as Record<string, unknown>;
malformed.browser_ranking = true;
installPublication(malformed);
cy.reload();
cy.wait('@collectivexChannel-dev-latest');
cy.get('[data-testid="collectivex-error"]')
.should('be.visible')
.and('contain.text', 'unknown field browser_ranking');
});
});
3 changes: 2 additions & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"remark-gfm": "^4.0.1",
"shiki": "^4.3.0",
"tailwind-merge": "^3.6.0",
"three": "^0.185.0"
"three": "^0.185.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.8",
Expand Down
10 changes: 10 additions & 0 deletions packages/app/src/app/(dashboard)/collectivex/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Metadata } from 'next';

import CollectiveXDisplay from '@/components/collectivex/CollectiveXDisplay';
import { tabMetadata } from '@/lib/tab-meta';

export const metadata: Metadata = tabMetadata('collectivex');

export default function CollectiveXPage() {
return <CollectiveXDisplay />;
}
Loading