Skip to content
Merged
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
98 changes: 95 additions & 3 deletions apps/api/test/archive-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ const RUN_ID = "00000000-0000-4000-8000-000000000021";
const MODEL_ID = "00000000-0000-4000-8000-000000000022";
const TEST_CASE_ID = "00000000-0000-4000-8000-000000000023";
const PREVIOUS_RUN_ID = "00000000-0000-4000-8000-000000000037";
const SOURCE_ID = "00000000-0000-4000-8000-000000000033";
const BINDING_ID = "00000000-0000-4000-8000-000000000038";
const ALIAS_ID = "00000000-0000-4000-8000-000000000039";
const ALIAS_EVENT_ID = "00000000-0000-4000-8000-000000000040";
const TEST_VERSION_ID = "00000000-0000-4000-8000-000000000041";

const archiveSource = {
id: SOURCE_ID,
sourceType: "provider_docs",
url: "https://api-docs.deepseek.com/guides/responses_api/",
title: "DeepSeek Responses API guide",
author: null,
publishedAt: null,
retrievedAt: "2026-09-01T00:00:00.000Z",
contentSha256: null,
} as const;


function baseRuns() {
return {
Expand Down Expand Up @@ -183,17 +200,65 @@ const archiveModelDetail = {
},
releasedAt: "2026-09-01T00:00:00.000Z",
retiredAt: null,
canonicalSourceId: "00000000-0000-4000-8000-000000000033",
canonicalSourceId: SOURCE_ID,
canonicalSource: archiveSource,
snapshots: [
{
id: "00000000-0000-4000-8000-000000000034",
providerSnapshotId: "deepseek-flash-202609",
validFrom: "2026-09-01T00:00:00.000Z",
validTo: null,
sourceId: "00000000-0000-4000-8000-000000000033",
sourceId: SOURCE_ID,
source: archiveSource,
},
],
relations: [],
aliasResolutions: [
{
id: ALIAS_EVENT_ID,
alias: {
id: ALIAS_ID,
value: "deepseek-flash",
},
observedAt: "2026-09-01T00:00:00.000Z",
sourceType: "provider_docs",
confidence: 1,
resolvedModelId: MODEL_ID,
resolvedSnapshot: null,
source: archiveSource,
},
],
executionBindings: [
{
id: BINDING_ID,
apiModelId: "deepseek-flash",
validFrom: "2026-09-01T00:00:00.000Z",
validTo: null,
createdAt: "2026-09-01T00:00:00.000Z",
endpoint: {
id: archiveRun.provider.id,
path: "first_party_direct",
baseUrl: "https://api.deepseek.com",
hostname: "api.deepseek.com",
source: archiveSource,
},
snapshot: null,
source: archiveSource,
},
],
identityTimeline: [
{
id: `alias-resolution:${ALIAS_EVENT_ID}`,
kind: "alias_resolution",
occurredAt: "2026-09-01T00:00:00.000Z",
title: "Alias observed · deepseek-flash",
description: "resolved to canonical model deepseek-flash",
source: archiveSource,
aliasId: ALIAS_ID,
bindingId: null,
snapshotId: null,
},
],
testCoverage: [
{
testCaseId: TEST_CASE_ID,
Expand Down Expand Up @@ -238,7 +303,29 @@ const archiveTestDetail = {
},
runCount: 1,
origin: "modelapse",
canonicalSourceId: null,
canonicalSourceId: SOURCE_ID,
canonicalSource: archiveSource,
versionSource: archiveSource,
versionHistory: [
{
id: TEST_VERSION_ID,
version: "1.0.0",
status: "published",
definitionSha256:
"1111111111111111111111111111111111111111111111111111111111111111",
license: "Apache-2.0",
publishedAt: "2026-09-01T00:00:00.000Z",
createdAt: "2026-08-31T00:00:00.000Z",
source: archiveSource,
evaluator: {
slug: "exact-text",
version: "1.0.0",
kind: "deterministic",
},
publicCaseCount: 1,
linkedTestCaseId: TEST_CASE_ID,
},
],
versionStatus: "published",
definitionSha256:
"1111111111111111111111111111111111111111111111111111111111111111",
Expand Down Expand Up @@ -389,6 +476,9 @@ describe("Archive read API", () => {
await expect(model.json()).resolves.toMatchObject({
model: {
id: MODEL_ID,
canonicalSource: { id: SOURCE_ID },
aliasResolutions: [{ alias: { value: "deepseek-flash" } }],
executionBindings: [{ apiModelId: "deepseek-flash" }],
timeline: [{ kind: "run", runId: RUN_ID }],
},
});
Expand All @@ -399,6 +489,8 @@ describe("Archive read API", () => {
test: {
testCaseId: TEST_CASE_ID,
definitionSha256: archiveTestDetail.definitionSha256,
canonicalSource: { id: SOURCE_ID },
versionHistory: [{ version: "1.0.0", linkedTestCaseId: TEST_CASE_ID }],
},
});

Expand Down
93 changes: 93 additions & 0 deletions apps/web/src/modelapse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,97 @@ export interface ArchiveTest {
readonly runCount: number;
}

export interface ArchiveSource {
readonly id: string;
readonly sourceType: string;
readonly url: string | null;
readonly title: string | null;
readonly author: string | null;
readonly publishedAt: string | null;
readonly retrievedAt: string;
readonly contentSha256: string | null;
}

export interface ArchiveModelAliasResolution {
readonly id: string;
readonly alias: {
readonly id: string;
readonly value: string;
};
readonly observedAt: string;
readonly sourceType: string;
readonly confidence: number;
readonly resolvedModelId: string | null;
readonly resolvedSnapshot: {
readonly id: string;
readonly providerSnapshotId: string;
} | null;
readonly source: ArchiveSource | null;
}

export interface ArchiveModelExecutionBinding {
readonly id: string;
readonly apiModelId: string;
readonly validFrom: string;
readonly validTo: string | null;
readonly createdAt: string;
readonly endpoint: {
readonly id: string;
readonly path: string;
readonly baseUrl: string;
readonly hostname: string;
readonly source: ArchiveSource | null;
};
readonly snapshot: {
readonly id: string;
readonly providerSnapshotId: string;
} | null;
readonly source: ArchiveSource;
}

export interface ArchiveIdentityTimelineEvent {
readonly id: string;
readonly kind:
| "canonical_source"
| "alias_resolution"
| "binding_started"
| "binding_ended"
| "snapshot_started"
| "snapshot_ended";
readonly occurredAt: string;
readonly title: string;
readonly description: string;
readonly source: ArchiveSource | null;
readonly aliasId: string | null;
readonly bindingId: string | null;
readonly snapshotId: string | null;
}

export interface ArchiveTestVersionHistory {
readonly id: string;
readonly version: string;
readonly status: string;
readonly definitionSha256: string;
readonly license: string | null;
readonly publishedAt: string | null;
readonly createdAt: string;
readonly source: ArchiveSource | null;
readonly evaluator: {
readonly slug: string;
readonly version: string;
readonly kind: string;
} | null;
readonly publicCaseCount: number;
readonly linkedTestCaseId: string | null;
}

export interface ArchiveModelSnapshot {
readonly id: string;
readonly providerSnapshotId: string;
readonly validFrom: string | null;
readonly validTo: string | null;
readonly sourceId: string | null;
readonly source: ArchiveSource | null;
}

export interface ArchiveModelRelation {
Expand All @@ -92,6 +177,7 @@ export interface ArchiveModelRelation {
readonly validFrom: string | null;
readonly validTo: string | null;
readonly sourceId: string | null;
readonly source: ArchiveSource | null;
readonly confidence: number;
}

Expand Down Expand Up @@ -128,8 +214,12 @@ export interface ArchiveModelDetail extends ArchiveModel {
readonly releasedAt: string | null;
readonly retiredAt: string | null;
readonly canonicalSourceId: string | null;
readonly canonicalSource: ArchiveSource | null;
readonly snapshots: readonly ArchiveModelSnapshot[];
readonly relations: readonly ArchiveModelRelation[];
readonly aliasResolutions: readonly ArchiveModelAliasResolution[];
readonly executionBindings: readonly ArchiveModelExecutionBinding[];
readonly identityTimeline: readonly ArchiveIdentityTimelineEvent[];
readonly testCoverage: readonly {
readonly testCaseId: string;
readonly familySlug: string;
Expand All @@ -146,6 +236,9 @@ export interface ArchiveModelDetail extends ArchiveModel {
export interface ArchiveTestDetail extends ArchiveTest {
readonly origin: string;
readonly canonicalSourceId: string | null;
readonly canonicalSource: ArchiveSource | null;
readonly versionSource: ArchiveSource | null;
readonly versionHistory: readonly ArchiveTestVersionHistory[];
readonly versionStatus: string;
readonly definitionSha256: string;
readonly license: string | null;
Expand Down
Loading
Loading