(raw: string | null)
| 61 | } |
| 62 | |
| 63 | function parseChunkSummaries(raw: string | null): Array<{ type: string }> { |
| 64 | if (!raw) return [] |
| 65 | let parsed: unknown |
| 66 | try { |
| 67 | parsed = JSON.parse(raw) |
| 68 | } catch { |
| 69 | return [] |
| 70 | } |
| 71 | if (!Array.isArray(parsed)) return [] |
| 72 | const result: Array<{ type: string }> = [] |
| 73 | for (const entry of parsed) { |
| 74 | if (!entry || typeof entry !== 'object') continue |
| 75 | const inner: Record<string, unknown> = { ...entry } |
| 76 | const t = inner.type |
| 77 | if (typeof t === 'string') result.push({ type: t }) |
| 78 | } |
| 79 | return result |
| 80 | } |
| 81 | |
| 82 | test.describe('Structured Output × Middleware Coverage', () => { |
| 83 | test('legacy finalization path: middleware observes structuredOutput phase chunks (claude-3-7-sonnet)', async ({ |
no test coverage detected