evijit HF Staff Claude Opus 4.8 (1M context) commited on
Commit
5fe6792
·
1 Parent(s): 527aae9

Add /api/_diag probe; restore @duckdb/node-api 1.5.3-r.2

Browse files

The 1.5.2 rollback did not help — the rebuilt Space still fails with
"don't know what type:" on a freshly purged + re-downloaded cache, on the
old binding. So neither the disk cache nor the binding version is the
cause. The Space's pinned snapshot (warehouse/2026-05-29T00-24-44Z) also
reads cleanly under linux/amd64 Rosetta emulation locally, which points
at a real-hardware (Sapphire Rapids / AVX-512) Parquet-decode path that
emulation doesn't exercise.

Adds a temporary read-only /api/_diag endpoint to isolate, on the Space
hardware itself, which nested column's to_json decode trips the Thrift
error, and whether thread count or the local-file vs httpfs read path
matters. Restores the binding to the preferred 1.5.3-r.2 (version proven
irrelevant to the failure).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files changed (3) hide show
  1. app/api/_diag/route.ts +156 -0
  2. package.json +1 -1
  3. pnpm-lock.yaml +59 -33
app/api/_diag/route.ts ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import "server-only"
2
+
3
+ import { NextResponse } from "next/server"
4
+ import { getConnection } from "@/lib/duckdb"
5
+
6
+ export const dynamic = "force-dynamic"
7
+
8
+ // Temporary read-only diagnostic for the linux-x64 Space "don't know what
9
+ // type:" Parquet-decode failure. Probes the live DuckDB connection on the
10
+ // Space hardware to isolate which column / read-path / thread setting
11
+ // triggers it. Remove once the root cause is fixed.
12
+ //
13
+ // Usage: /api/_diag?id=deepseek/deepseek-v4-flash[&threads=1][&http=1]
14
+
15
+ const NESTED_COLUMNS = [
16
+ "model_info",
17
+ "derived_tags",
18
+ "score_details",
19
+ "generation_config",
20
+ "source_metadata",
21
+ "source_data",
22
+ "eval_library",
23
+ "evalcards_annotations",
24
+ ]
25
+
26
+ type ProbeResult = {
27
+ name: string
28
+ ok: boolean
29
+ rows?: number
30
+ ms: number
31
+ error?: string
32
+ note?: string
33
+ }
34
+
35
+ async function probe(
36
+ name: string,
37
+ fn: () => Promise<number>,
38
+ note?: string,
39
+ ): Promise<ProbeResult> {
40
+ const t0 = Date.now()
41
+ try {
42
+ const rows = await fn()
43
+ return { name, ok: true, rows, ms: Date.now() - t0, note }
44
+ } catch (err) {
45
+ return {
46
+ name,
47
+ ok: false,
48
+ ms: Date.now() - t0,
49
+ error: err instanceof Error ? `${err.name}: ${err.message}` : String(err),
50
+ note,
51
+ }
52
+ }
53
+ }
54
+
55
+ export async function GET(request: Request) {
56
+ const { searchParams } = new URL(request.url)
57
+ const modelKey = searchParams.get("id") ?? "deepseek/deepseek-v4-flash"
58
+ const threadsParam = searchParams.get("threads")
59
+ const useHttp = searchParams.get("http") === "1"
60
+
61
+ const connection = await getConnection()
62
+ const snapshotUrl = (process.env.SNAPSHOT_URL ?? "").replace(/\/+$/, "")
63
+
64
+ // When http=1, read straight from the remote parquet (range reads over
65
+ // HTTPS) instead of the disk-cached local file the views point at, so we
66
+ // can tell a local-file/mmap issue apart from a decode issue.
67
+ const source = useHttp
68
+ ? `read_parquet('${snapshotUrl}/eval_results_view.parquet')`
69
+ : `eval_results_view`
70
+
71
+ // Count rows through a reader; the JSON-row variant is what the app uses.
72
+ const run = async (sql: string, params?: unknown[]) => {
73
+ const reader = params?.length
74
+ ? await connection.runAndRead(sql, params as any[])
75
+ : await connection.runAndRead(sql)
76
+ await reader.readAll()
77
+ return reader.getRowObjectsJson().length
78
+ }
79
+
80
+ let appliedThreads: string | undefined
81
+ if (threadsParam && /^\d+$/.test(threadsParam)) {
82
+ try {
83
+ await connection.run(`SET threads=${Number(threadsParam)}`)
84
+ appliedThreads = threadsParam
85
+ } catch {
86
+ /* ignore */
87
+ }
88
+ }
89
+
90
+ const probes: ProbeResult[] = []
91
+
92
+ probes.push(
93
+ await probe("version_threads", async () =>
94
+ run("SELECT version() AS v, current_setting('threads') AS threads"),
95
+ ),
96
+ )
97
+
98
+ probes.push(
99
+ await probe("count_rows", async () =>
100
+ run(`SELECT count(*) AS n FROM ${source} WHERE model_key = ?`, [modelKey]),
101
+ ),
102
+ )
103
+
104
+ probes.push(
105
+ await probe("scan_primitives", async () =>
106
+ run(
107
+ `SELECT evaluation_id, score, model_key FROM ${source} WHERE model_key = ? AND score IS NOT NULL`,
108
+ [modelKey],
109
+ ),
110
+ ),
111
+ )
112
+
113
+ // The decisive probe: one to_json column at a time, so we learn exactly
114
+ // which nested column's decode trips the Thrift "don't know what type:".
115
+ for (const col of NESTED_COLUMNS) {
116
+ probes.push(
117
+ await probe(`tojson_${col}`, async () =>
118
+ run(
119
+ `SELECT CAST(to_json(${col}) AS VARCHAR) AS x FROM ${source} WHERE model_key = ? AND score IS NOT NULL`,
120
+ [modelKey],
121
+ ),
122
+ ),
123
+ )
124
+ }
125
+
126
+ // Same projection but reading every row (no model filter), to learn
127
+ // whether the bad page is confined to this model's row group.
128
+ probes.push(
129
+ await probe(
130
+ "tojson_evalcards_all_rows",
131
+ async () =>
132
+ run(
133
+ `SELECT CAST(to_json(evalcards_annotations) AS VARCHAR) AS x FROM ${source} WHERE score IS NOT NULL`,
134
+ ),
135
+ "all rows, not just this model",
136
+ ),
137
+ )
138
+
139
+ // Reset threads to engine default so the diagnostic doesn't leave the
140
+ // shared connection in a weird state for normal traffic.
141
+ if (appliedThreads) {
142
+ try {
143
+ await connection.run("RESET threads")
144
+ } catch {
145
+ /* ignore */
146
+ }
147
+ }
148
+
149
+ return NextResponse.json({
150
+ modelKey,
151
+ snapshotUrl,
152
+ source: useHttp ? "remote-httpfs" : "local-cache-view",
153
+ appliedThreads: appliedThreads ?? "(default)",
154
+ probes,
155
+ })
156
+ }
package.json CHANGED
@@ -17,7 +17,7 @@
17
  "audit-adapters": "tsx scripts/audit-adapters.mjs"
18
  },
19
  "dependencies": {
20
- "@duckdb/node-api": "1.5.2-r.1",
21
  "@hookform/resolvers": "^3.10.0",
22
  "@radix-ui/react-accordion": "1.2.2",
23
  "@radix-ui/react-alert-dialog": "1.1.4",
 
17
  "audit-adapters": "tsx scripts/audit-adapters.mjs"
18
  },
19
  "dependencies": {
20
+ "@duckdb/node-api": "1.5.3-r.2",
21
  "@hookform/resolvers": "^3.10.0",
22
  "@radix-ui/react-accordion": "1.2.2",
23
  "@radix-ui/react-alert-dialog": "1.1.4",
pnpm-lock.yaml CHANGED
@@ -9,8 +9,8 @@ importers:
9
  .:
10
  dependencies:
11
  '@duckdb/node-api':
12
- specifier: 1.5.2-r.1
13
- version: 1.5.2-r.1
14
  '@hookform/resolvers':
15
  specifier: ^3.10.0
16
  version: 3.10.0(react-hook-form@7.62.0(react@19.1.1))
@@ -211,41 +211,51 @@ packages:
211
  '@date-fns/tz@1.2.0':
212
  resolution: {integrity: sha512-LBrd7MiJZ9McsOgxqWX7AaxrDjcFVjWH/tIKJd7pnR7McaslGYOP1QmmiBXdJH/H/yLCT+rcQ7FaPBUxRGUtrg==}
213
 
214
- '@duckdb/node-api@1.5.2-r.1':
215
- resolution: {integrity: sha512-OzBBnS0JGXMoS5mzKNY/Ylr7SshcRQiLFIoxQ4AlePwJ2fNeDL/fbHu/knjxUrXwW1fJBTUgwWftmxDdnZZb3A==}
216
 
217
- '@duckdb/node-bindings-darwin-arm64@1.5.2-r.1':
218
- resolution: {integrity: sha512-v35FyKOb8EJCvaiPF7k0gvKiJTXR7PPQDNoWR0Gu+YSX5O9b+DIguzt1348Of3HebHy6ATSMzlUekaVA9YXu+g==}
219
  cpu: [arm64]
220
  os: [darwin]
221
 
222
- '@duckdb/node-bindings-darwin-x64@1.5.2-r.1':
223
- resolution: {integrity: sha512-SU9dIJ1BluKkkGxi4UsP4keqkkstB2YDySF9KcYu3EZKIVM3FTv2zc7XO38dXnHOq6+F3WqhWWZvD+XU945p7A==}
224
  cpu: [x64]
225
  os: [darwin]
226
 
227
- '@duckdb/node-bindings-linux-arm64@1.5.2-r.1':
228
- resolution: {integrity: sha512-3Tra9xM3aM3denaER4KhJ6//6PpmPbik9ECBQ+sh9PyKaEgHw/0kAcKnLm5EzWUnXF0qYmZlewvkCrse8KmOYw==}
229
  cpu: [arm64]
230
  os: [linux]
231
 
232
- '@duckdb/node-bindings-linux-x64@1.5.2-r.1':
233
- resolution: {integrity: sha512-pcQvZRHiIfJ9cq8parkSQczQHEml/IeGfnDCMAbEgD6+jaV9Y9Y5Ph1kP9aR+bm6him1S5ZIEr3kZbihjKnWbA==}
 
 
 
 
 
234
  cpu: [x64]
235
  os: [linux]
236
 
237
- '@duckdb/node-bindings-win32-arm64@1.5.2-r.1':
238
- resolution: {integrity: sha512-Ji8tym+N3LkrhVt0Up3bsacD/kpg4/JXFJQqxswiYvBaNCQOk+D+aiVS0GN5pcqvmnG7V7TpsDRzkLEFaWp1vw==}
 
 
 
 
 
239
  cpu: [arm64]
240
  os: [win32]
241
 
242
- '@duckdb/node-bindings-win32-x64@1.5.2-r.1':
243
- resolution: {integrity: sha512-5XqcqC+4R8ghBEEbnc2a0sqfz1zyPBRb9YcmIWfiuDoCYSYFbKhmHcEyNftZDHcwCoLOHXnUin45jraex4STqQ==}
244
  cpu: [x64]
245
  os: [win32]
246
 
247
- '@duckdb/node-bindings@1.5.2-r.1':
248
- resolution: {integrity: sha512-bUg3bLVj70YVku6fKyQJS8ASORl7kM7YFVFznsEB9pWbtazPj+ME2x2FUk0WiTzjJdutjzSSGXF066mB4bGGZA==}
249
 
250
  '@emnapi/runtime@1.4.5':
251
  resolution: {integrity: sha512-++LApOtY0pEEz1zrd9vy1/zXVaVJJ/EbAF3u0fXIzPJEDtnITsBGbbK0EkM72amhl/R5b+5xx0Y/QhcVOpuulg==}
@@ -1946,6 +1956,10 @@ packages:
1946
  resolution: {integrity: sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==}
1947
  engines: {node: '>=8'}
1948
 
 
 
 
 
1949
  detect-node-es@1.1.0:
1950
  resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==}
1951
 
@@ -2821,36 +2835,46 @@ snapshots:
2821
 
2822
  '@date-fns/tz@1.2.0': {}
2823
 
2824
- '@duckdb/node-api@1.5.2-r.1':
2825
  dependencies:
2826
- '@duckdb/node-bindings': 1.5.2-r.1
 
 
 
2827
 
2828
- '@duckdb/node-bindings-darwin-arm64@1.5.2-r.1':
2829
  optional: true
2830
 
2831
- '@duckdb/node-bindings-darwin-x64@1.5.2-r.1':
2832
  optional: true
2833
 
2834
- '@duckdb/node-bindings-linux-arm64@1.5.2-r.1':
2835
  optional: true
2836
 
2837
- '@duckdb/node-bindings-linux-x64@1.5.2-r.1':
2838
  optional: true
2839
 
2840
- '@duckdb/node-bindings-win32-arm64@1.5.2-r.1':
2841
  optional: true
2842
 
2843
- '@duckdb/node-bindings-win32-x64@1.5.2-r.1':
2844
  optional: true
2845
 
2846
- '@duckdb/node-bindings@1.5.2-r.1':
 
 
 
 
 
2847
  optionalDependencies:
2848
- '@duckdb/node-bindings-darwin-arm64': 1.5.2-r.1
2849
- '@duckdb/node-bindings-darwin-x64': 1.5.2-r.1
2850
- '@duckdb/node-bindings-linux-arm64': 1.5.2-r.1
2851
- '@duckdb/node-bindings-linux-x64': 1.5.2-r.1
2852
- '@duckdb/node-bindings-win32-arm64': 1.5.2-r.1
2853
- '@duckdb/node-bindings-win32-x64': 1.5.2-r.1
 
 
2854
 
2855
  '@emnapi/runtime@1.4.5':
2856
  dependencies:
@@ -4323,6 +4347,8 @@ snapshots:
4323
 
4324
  detect-libc@2.0.4: {}
4325
 
 
 
4326
  detect-node-es@1.1.0: {}
4327
 
4328
  devtools-protocol@0.0.1595872: {}
 
9
  .:
10
  dependencies:
11
  '@duckdb/node-api':
12
+ specifier: 1.5.3-r.2
13
+ version: 1.5.3-r.2
14
  '@hookform/resolvers':
15
  specifier: ^3.10.0
16
  version: 3.10.0(react-hook-form@7.62.0(react@19.1.1))
 
211
  '@date-fns/tz@1.2.0':
212
  resolution: {integrity: sha512-LBrd7MiJZ9McsOgxqWX7AaxrDjcFVjWH/tIKJd7pnR7McaslGYOP1QmmiBXdJH/H/yLCT+rcQ7FaPBUxRGUtrg==}
213
 
214
+ '@duckdb/node-api@1.5.3-r.2':
215
+ resolution: {integrity: sha512-xjn6W9n8Sn9PaYmzrB6ayidNLQHpqNKdaRz4gx3yVoLUkrsIebQC1M1jV3BR8KqXj5P0RX4wLs8Tg/fK2ZQmNA==}
216
 
217
+ '@duckdb/node-bindings-darwin-arm64@1.5.3-r.2':
218
+ resolution: {integrity: sha512-5RQ3+fUZn+OvIJEfa1i/KngJHo5d6ilpjunsHfHdQy5F7r5pewDkPxRQno4xInPqGukMibKDoMdpzCKnymFJtw==}
219
  cpu: [arm64]
220
  os: [darwin]
221
 
222
+ '@duckdb/node-bindings-darwin-x64@1.5.3-r.2':
223
+ resolution: {integrity: sha512-E7Pc+do8kj82+hHXkp4mxfw9Kqfe6V5FUT2EMoRsacbvhuoM1AeZxOj9jknh23IoNxPtn3S2tKnD1krL0v0I7A==}
224
  cpu: [x64]
225
  os: [darwin]
226
 
227
+ '@duckdb/node-bindings-linux-arm64-musl@1.5.3-r.2':
228
+ resolution: {integrity: sha512-P9lTyML8M6pS300fJbnMNFSBhojC0xJcvGvuR44xd//NqaHk9EwcPIs4+r2ek4LP5uugm7konVZ3VMr0BOKujw==}
229
  cpu: [arm64]
230
  os: [linux]
231
 
232
+ '@duckdb/node-bindings-linux-arm64@1.5.3-r.2':
233
+ resolution: {integrity: sha512-R8RKkNgVL4kHodot1krfbB4XQ+bA90LPsnN1Lm5J03QJlFgNlezul0H2U1UuvEaKUBPWDQj8g9Yt4hhKKKX0zw==}
234
+ cpu: [arm64]
235
+ os: [linux]
236
+
237
+ '@duckdb/node-bindings-linux-x64-musl@1.5.3-r.2':
238
+ resolution: {integrity: sha512-V9kPvbMoJENvPo82LOzfhZ+KilFe1K8TKrksFmHe1Sy2pduNUVnxC+T4OQuOu4sqyCCVqVYRXe3pqTzKa/hCYg==}
239
  cpu: [x64]
240
  os: [linux]
241
 
242
+ '@duckdb/node-bindings-linux-x64@1.5.3-r.2':
243
+ resolution: {integrity: sha512-6vYTXgIqnWEjlNZX/AveTU7EzicuGATOdy8ncUbBIDxoC9cIrjoIqQc37COKEyT5IHjLIt25MllJtags96vvxA==}
244
+ cpu: [x64]
245
+ os: [linux]
246
+
247
+ '@duckdb/node-bindings-win32-arm64@1.5.3-r.2':
248
+ resolution: {integrity: sha512-CjKqTI0WfRxwLgz8FV4fej/wkijPQnRgDk93aQlWQ+/+EwB9EnwQW3yfUy4Rs8cFjQkxkwlL5azoSR973l8U6w==}
249
  cpu: [arm64]
250
  os: [win32]
251
 
252
+ '@duckdb/node-bindings-win32-x64@1.5.3-r.2':
253
+ resolution: {integrity: sha512-/oxN8ZFf2LxhForL+Uc+lEqnzHNvhSEsu3blnk3zu73rKTbD/WvPYIecrenb1ysApRK9ElGxitIYFx8PBuVKxg==}
254
  cpu: [x64]
255
  os: [win32]
256
 
257
+ '@duckdb/node-bindings@1.5.3-r.2':
258
+ resolution: {integrity: sha512-bveKx+LfqRazcH8/MuCkMsbLVQKqr/EyuYRzaKpBcEvRYenw/TqK5+1N4fkMyoTv8ZukA4UYobymNYHqJUpdOA==}
259
 
260
  '@emnapi/runtime@1.4.5':
261
  resolution: {integrity: sha512-++LApOtY0pEEz1zrd9vy1/zXVaVJJ/EbAF3u0fXIzPJEDtnITsBGbbK0EkM72amhl/R5b+5xx0Y/QhcVOpuulg==}
 
1956
  resolution: {integrity: sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==}
1957
  engines: {node: '>=8'}
1958
 
1959
+ detect-libc@2.1.2:
1960
+ resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
1961
+ engines: {node: '>=8'}
1962
+
1963
  detect-node-es@1.1.0:
1964
  resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==}
1965
 
 
2835
 
2836
  '@date-fns/tz@1.2.0': {}
2837
 
2838
+ '@duckdb/node-api@1.5.3-r.2':
2839
  dependencies:
2840
+ '@duckdb/node-bindings': 1.5.3-r.2
2841
+
2842
+ '@duckdb/node-bindings-darwin-arm64@1.5.3-r.2':
2843
+ optional: true
2844
 
2845
+ '@duckdb/node-bindings-darwin-x64@1.5.3-r.2':
2846
  optional: true
2847
 
2848
+ '@duckdb/node-bindings-linux-arm64-musl@1.5.3-r.2':
2849
  optional: true
2850
 
2851
+ '@duckdb/node-bindings-linux-arm64@1.5.3-r.2':
2852
  optional: true
2853
 
2854
+ '@duckdb/node-bindings-linux-x64-musl@1.5.3-r.2':
2855
  optional: true
2856
 
2857
+ '@duckdb/node-bindings-linux-x64@1.5.3-r.2':
2858
  optional: true
2859
 
2860
+ '@duckdb/node-bindings-win32-arm64@1.5.3-r.2':
2861
  optional: true
2862
 
2863
+ '@duckdb/node-bindings-win32-x64@1.5.3-r.2':
2864
+ optional: true
2865
+
2866
+ '@duckdb/node-bindings@1.5.3-r.2':
2867
+ dependencies:
2868
+ detect-libc: 2.1.2
2869
  optionalDependencies:
2870
+ '@duckdb/node-bindings-darwin-arm64': 1.5.3-r.2
2871
+ '@duckdb/node-bindings-darwin-x64': 1.5.3-r.2
2872
+ '@duckdb/node-bindings-linux-arm64': 1.5.3-r.2
2873
+ '@duckdb/node-bindings-linux-arm64-musl': 1.5.3-r.2
2874
+ '@duckdb/node-bindings-linux-x64': 1.5.3-r.2
2875
+ '@duckdb/node-bindings-linux-x64-musl': 1.5.3-r.2
2876
+ '@duckdb/node-bindings-win32-arm64': 1.5.3-r.2
2877
+ '@duckdb/node-bindings-win32-x64': 1.5.3-r.2
2878
 
2879
  '@emnapi/runtime@1.4.5':
2880
  dependencies:
 
4347
 
4348
  detect-libc@2.0.4: {}
4349
 
4350
+ detect-libc@2.1.2: {}
4351
+
4352
  detect-node-es@1.1.0: {}
4353
 
4354
  devtools-protocol@0.0.1595872: {}