fix(bots): guard possibly-undefined route param, bump arena image to 1.2.11
CI / check (push) Failing after 6m6s
CI / check (push) Failing after 6m6s
tsc --noEmit (run standalone, not filtered through a shell wrapper that
silently swallowed the real exit code) caught what my own verification
missed the first time: c.req.param('name') is typed possibly-undefined
in this Hono router's inferred route map, and the podman build's own
`pnpm --filter server build` step (which runs the real tsc, unlike a
loosely-configured local check) failed on it — 1.2.10 was never
actually built with the :name/ai-config routes as a result. Added an
explicit guard (matches the 404 semantics of a missing param) to all
three new handlers.
Also bumps docker-compose.arena.yml to the 1.2.11 tag being built next.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
services:
|
||||
botfights-arena:
|
||||
image: localhost:3000/lfg2025/botfights:1.2.9
|
||||
image: localhost:3000/lfg2025/botfights:1.2.11
|
||||
container_name: botfights-arena
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
|
||||
@@ -210,6 +210,7 @@ botsRouter.delete('/ai-config', async (c) => {
|
||||
// because ordering is load-bearing here.
|
||||
botsRouter.get('/:name/ai-config', async (c) => {
|
||||
const name = c.req.param('name')
|
||||
if (!name) return c.json({ error: 'Bot not found.' }, 404)
|
||||
const rows = await db.select({ id: schema.bots.id })
|
||||
.from(schema.bots)
|
||||
.where(eq(sql`LOWER(${schema.bots.name})`, name.toLowerCase()))
|
||||
@@ -225,6 +226,7 @@ botsRouter.get('/:name/ai-config', async (c) => {
|
||||
|
||||
botsRouter.post('/:name/ai-config', rateLimit(60_000, 10), async (c) => {
|
||||
const name = c.req.param('name')
|
||||
if (!name) return c.json({ error: 'Bot not found.' }, 404)
|
||||
const rows = await db.select({ id: schema.bots.id })
|
||||
.from(schema.bots)
|
||||
.where(eq(sql`LOWER(${schema.bots.name})`, name.toLowerCase()))
|
||||
@@ -251,6 +253,7 @@ botsRouter.post('/:name/ai-config', rateLimit(60_000, 10), async (c) => {
|
||||
|
||||
botsRouter.delete('/:name/ai-config', async (c) => {
|
||||
const name = c.req.param('name')
|
||||
if (!name) return c.json({ error: 'Bot not found.' }, 404)
|
||||
const rows = await db.select({ id: schema.bots.id })
|
||||
.from(schema.bots)
|
||||
.where(eq(sql`LOWER(${schema.bots.name})`, name.toLowerCase()))
|
||||
|
||||
Reference in New Issue
Block a user