also looking at this
Deploy: uniform auth session model (main → production)
#7
282 files
+3028
-64856
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -0,0 +1,66 @@ | ||
| 1 | { | |
| 2 | "version": 1, | |
| 3 | "clients": [ | |
| 4 | { | |
| 5 | "name": "@loghq/stacks", | |
| 6 | "path": "/logs", | |
| 7 | "headerKey": "loghq_stacks", | |
| 8 | "body": { | |
| 9 | "logs": [ | |
| 10 | { | |
| 11 | "level": "error", | |
| 12 | "message": "checkout failed", | |
| 13 | "channel": "payments", | |
| 14 | "context": { "orderId": "ord_42" }, | |
| 15 | "environment": "production", | |
| 16 | "release": "web@1.2.3", | |
| 17 | "framework": "stacks", | |
| 18 | "host": "web-01", | |
| 19 | "timestamp": "2026-09-12T00:00:00.000Z", | |
| 20 | "traceId": "4bf92f3577b34da6a3ce929d0e0e4736", | |
| 21 | "requestId": "req-42", | |
| 22 | "sdk": { "name": "loghq.stacks", "version": "0.2.6" } | |
| 23 | } | |
| 24 | ] | |
| 25 | } | |
| 26 | }, | |
| 27 | { | |
| 28 | "name": "loghq/php", | |
| 29 | "path": "/logs", | |
| 30 | "headerKey": "loghq_php", | |
| 31 | "body": { | |
| 32 | "logs": [ | |
| 33 | { | |
| 34 | "project": "api", | |
| 35 | "level": "warning", | |
| 36 | "message": "queue latency high", | |
| 37 | "channel": "workers", | |
| 38 | "context": { "queue": "mail" }, | |
| 39 | "framework": "php", | |
| 40 | "timestamp": "2026-09-12T00:00:00.000Z", | |
| 41 | "sdk": { "name": "loghq.php", "version": "0.2.0" } | |
| 42 | } | |
| 43 | ] | |
| 44 | } | |
| 45 | }, | |
| 46 | { | |
| 47 | "name": "loghq/laravel", | |
| 48 | "path": "/logs", | |
| 49 | "headerKey": "loghq_laravel", | |
| 50 | "body": { | |
| 51 | "logs": [ | |
| 52 | { | |
| 53 | "project": "laravel-api", | |
| 54 | "level": "info", | |
| 55 | "message": "cache warmed", | |
| 56 | "channel": "loghq", | |
| 57 | "context": { "keys": 12 }, | |
| 58 | "framework": "laravel", | |
| 59 | "timestamp": "2026-09-12T00:00:00.000Z", | |
| 60 | "sdk": { "name": "loghq.laravel", "version": "0.2.0" } | |
| 61 | } | |
| 62 | ] | |
| 63 | } | |
| 64 | } | |
| 65 | ] | |
| 66 | } | |
| @@ -0,0 +1,27 @@ | ||
| 1 | import { describe, expect, test } from 'bun:test' | |
| 2 | import contracts from '../fixtures/sdk-ingest-contracts.json' | |
| 3 | import { normalizeBatch } from '../../app/Logs/normalize' | |
| 4 | ||
| 5 | describe('SDK ingest compatibility', () => { | |
| 6 | for (const client of contracts.clients) { | |
| 7 | test(`${client.name} emits an accepted v${contracts.version} batch`, () => { | |
| 8 | let id = 0 | |
| 9 | const normalized = normalizeBatch(client.body, { | |
| 10 | projectId: 'resolved-from-ingest-key', | |
| 11 | receivedAt: '2026-09-12T00:00:01.000Z', | |
| 12 | newId: () => `row-${++id}`, | |
| 13 | }) | |
| 14 | ||
| 15 | expect(client.path).toBe('/logs') | |
| 16 | expect(client.headerKey).toStartWith('loghq_') | |
| 17 | expect(normalized.skipped).toBe(0) | |
| 18 | expect(normalized.dropped).toBe(0) | |
| 19 | expect(normalized.rows).toHaveLength(client.body.logs.length) | |
| 20 | ||
| 21 | const row = normalized.rows[0]! | |
| 22 | expect(row.message).toBe(client.body.logs[0]!.message) | |
| 23 | expect(JSON.parse(row.sdk || '{}').name).toBe(client.body.logs[0]!.sdk.name) | |
| 24 | expect(row.project_id).toBe('resolved-from-ingest-key') | |
| 25 | }) | |
| 26 | } | |
| 27 | }) | |