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
14 changes: 14 additions & 0 deletions apps/cli/src/server/local-schema-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,20 @@ export const LOCAL_SCHEMA_HISTORY: ReadonlyArray<LocalSchemaHistoryEntry> = Obje
manifestDigest: "005ad815cff50e1c642dfc696cf423d7d9a3c7ee58b8cdcd4ad647bf35ab1297",
projectRevision: "ed74788ef292834069e0ea6ee3b22d68fc604fb66cb54d2d551db67ce8d20b3a",
}),
Object.freeze({
// v26 recreates ai_trace_index_mv as a projection of the ingest
// gateway's maple_ai.* stamps. No column changes and no row is
// rewritten: rows before the edge keep the values the v25 view gave them.
//
// projectRevision is carried forward deliberately: it is a hardcoded
// constant that no longer tracks the generator's header, and the identity
// this gate compares is the fingerprint/digest pair.
version: 26,
fingerprint: "203c87dde2b5aedc",
digest: "203c87dde2b5aedc28de3b2fd72829991b28fdf703bbb40ae72ebd835dbdb67c",
manifestDigest: "a3f69dea62db6610d63a6b2442f86d9071c91c286b5935e764700efc01fa7d7a",
projectRevision: "ed74788ef292834069e0ea6ee3b22d68fc604fb66cb54d2d551db67ce8d20b3a",
}),
] as const)

/** Immutable SQLite control DDL identities, checked by clickhouse:schema:check. */
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/server/local-schema-version.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Increment this value for every structural change to the generated local
// schema. The compatibility manifest and migration registry must be updated in
// the same change before a new value can ship.
export const LOCAL_SCHEMA_VERSION = 25 as const
export const LOCAL_SCHEMA_VERSION = 26 as const

/** SQLite eventing state has its own independent version sequence. */
export const LOCAL_CONTROL_SCHEMA_VERSION = 1 as const
26 changes: 26 additions & 0 deletions apps/cli/src/server/local-store-migrations/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,5 +1114,31 @@ export const LOCAL_STORE_STEPS: ReadonlyArray<StepSpec> = [
},
],
},
{
id: "local-0025-to-0026-ai-trace-index-gateway-stamps",
from: 25,
to: 26,
description: "Recreate ai_trace_index_mv as a projection of the ingest gateway's maple_ai.* stamps",
clonedBefore: "any DDL runs",
beforeBootstrap: [dropViews("ai_trace_index_mv")],
plan: [
[
"rebuild-ai-trace-index-view",
"Rebuild ai_trace_index_mv to project the maple_ai.* facts the ingest gateway stamps on each span",
],
],
verifies: "Verify the v26 physical schema and the retained raw telemetry counts",
dispositions: [
AI_TRACE_INDEX_SOURCE,
{
name: "ai_trace_index",
classification: "derived",
disposition: "rebuild-within-retention-horizon",
guarantee:
"Existing rows are preserved untouched with the values the v25 view gave them; the rebuilt view fills spans materialized after the migration from the gateway's stamps, and the gap closes as the retention window rolls.",
...AI_TRACE_INDEX_FORWARD,
},
],
},
// local-schema:bump appends the next step above this line.
]
3 changes: 3 additions & 0 deletions apps/cli/src/server/schema-identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import schemaV22Sql from "./schema/local-schema-v22.sql" with { type: "text" }
import schemaV23Sql from "./schema/local-schema-v23.sql" with { type: "text" }
import schemaV24Sql from "./schema/local-schema-v24.sql" with { type: "text" }
import schemaV25Sql from "./schema/local-schema-v25.sql" with { type: "text" }
import schemaV26Sql from "./schema/local-schema-v26.sql" with { type: "text" }
import { schemaDigest as digestSchema, schemaFingerprint as fingerprintSchema } from "./store-version"
import { buildLocalSchemaManifest, type LocalSchemaManifest } from "./schema-manifest"
import { LOCAL_SCHEMA_VERSION } from "./local-schema-version"
Expand Down Expand Up @@ -93,6 +94,7 @@ const SNAPSHOT_SQL: ReadonlyArray<string> = [
schemaV23Sql,
schemaV24Sql,
schemaV25Sql,
schemaV26Sql,
]

export interface LocalSchemaSnapshot {
Expand Down Expand Up @@ -175,6 +177,7 @@ export const LOCAL_SCHEMA_V22 = localSchemaIdentity(22)
export const LOCAL_SCHEMA_V23 = localSchemaIdentity(23)
export const LOCAL_SCHEMA_V24 = localSchemaIdentity(24)
export const LOCAL_SCHEMA_V25 = localSchemaIdentity(25)
export const LOCAL_SCHEMA_V26 = localSchemaIdentity(26)

export const CURRENT_LOCAL_SCHEMA: LocalSchemaIdentity = Object.freeze({
version: LOCAL_SCHEMA_VERSION,
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/server/schema/local-inserts.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"projectRevision": "92181b09631cc85a9bfc1ea57dc85000f3c6770b0799e5b357692f4634ce8042",
"projectRevision": "6f17e5994398bfddfebe6a99f13f097bbe822a95820cf6e0cb575082823d4f32",
"orgPlaceholder": "__ORG__",
"datasources": {
"traces": {
Expand Down
Loading
Loading