[2026] fix a few wire shapes

This commit is contained in:
Devin Zuczek
2026-10-13 12:13:40 -04:00
parent bf817977ec
commit 6d4156bd67
6 changed files with 85 additions and 18 deletions
@@ -48,12 +48,13 @@ const app = new Hono<App>()
return c.json([])
})
// Sampling configuration, asked for once per session (`?sessionId=<guid>`). An empty
// object carries no per-event overrides, which the client reads as "sample everything
// at the built-in default rates". Since the events are discarded anyway, the rate it
// picks makes no difference here.
// Sampling configuration, asked for once per session (`?sessionId=<guid>`). A BARE ARRAY
// of `{ EventType, ShouldBeSampled }` entries (the client decodes a `List<EventDTO>`),
// e.g. `[{ "EventType": "player_join", "ShouldBeSampled": true }]` — not an object: the
// `{}` this once served made the client's decoder throw. Empty says "sample nothing",
// which is the right answer since the events are discarded anyway.
.get('/sampling', async (c) => {
return c.json({})
return c.json([])
})
export default app
@@ -49,7 +49,7 @@ it('acknowledges an unreadable body on both event paths', async () => {
it('serves an empty sampling configuration', async () => {
const res = await SELF.fetch(`${ORIGIN}/sampling?sessionId=e9a899ce-ce46-447d-bb22-11e82ed68f8d`)
expect(res.status).toBe(200)
expect(await res.json()).toEqual({})
expect(await res.json()).toEqual([])
})
// The client always sends `sessionId`, but nothing here reads it, so a missing one must
@@ -57,5 +57,5 @@ it('serves an empty sampling configuration', async () => {
it('serves the sampling configuration without a sessionId', async () => {
const res = await SELF.fetch(`${ORIGIN}/sampling`)
expect(res.status).toBe(200)
expect(await res.json()).toEqual({})
expect(await res.json()).toEqual([])
})