Skip to content

Fix admin claims query failures against persisted Neon claim tables#299

Merged
GsCommand merged 1 commit into
mainfrom
codex/fix-admin_claims_query_failed-error
May 23, 2026
Merged

Fix admin claims query failures against persisted Neon claim tables#299
GsCommand merged 1 commit into
mainfrom
codex/fix-admin_claims_query_failed-error

Conversation

@GsCommand
Copy link
Copy Markdown
Contributor

Motivation

  • The admin claims endpoints were failing with ADMIN_CLAIMS_QUERY_FAILED when reading persisted Neon tables because the code assumed a different query shape and column casing than the actual snake_case schema.
  • The UI expects camelCase fields, so responses must map DB snake_case columns to the API shape.

Description

  • Rewrote GET /api/admin/claims (api/admin/claims.js) to use a single safe grouped SQL query against snake_case columns with left join and count(ca.id)::int as agent_count, and map rows to the expected camelCase response fields.
  • Simplified GET /api/admin/claim detail queries (api/admin/claim.js) to use schema-aligned select * queries for claim_requests, claim_agents, and claim_events, and standardized ordering for agents and events.
  • Added safe error logging for both endpoints that only emits error.message and error.code and returns stable failure payloads without exposing secrets.
  • Updated tests/api-admin-claims.test.js to mock snake_case DB row fields and assert the camelCase API mapping produced by the handler.

Testing

  • Ran npm test at repo root and all automated tests passed (67 tests executed, 0 failures).
  • Ran cd examples/webhook-auto-verify && npm run check and the example checks completed successfully.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
commandlayer-commandlayer-org Ready Ready Preview, Comment May 23, 2026 3:52pm
commandlayer-org Ready Ready Preview, Comment May 23, 2026 3:52pm
commandlayer-org111 Ready Ready Preview, Comment May 23, 2026 3:52pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant