Skip to content

fix(api): reject empty results arrays in /api/runs - #5

Closed
tdlxgpp wants to merge 1 commit into
AgentPostmortem:mainfrom
tdlxgpp:fix/reject-empty-results
Closed

fix(api): reject empty results arrays in /api/runs#5
tdlxgpp wants to merge 1 commit into
AgentPostmortem:mainfrom
tdlxgpp:fix/reject-empty-results

Conversation

@tdlxgpp

@tdlxgpp tdlxgpp commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Fixes #3: /api/runs accepted results: [], stored a run with total: 0, and returned shouldFail: false. A broken CI producer could therefore submit no evaluation cases and still get a passing gate.

Change

  • Extracted ingest payload validation into lib/validate-ingest.ts.
  • POST /api/runs now rejects an empty results array with HTTP 400 before any database write.
  • Non-empty payload behavior is unchanged.
  • Added node:test regression coverage in lib/validate-ingest.test.ts.
  • Documented the non-empty requirement in the informational GET /api/runs response.
  • Added npm test script.

Test

npm test
# 3 passing

Checklist

  • Empty results rejected before DB write
  • Non-empty behavior unchanged
  • Regression test added
  • GET docs updated

An empty results array currently creates a run with total=0 and
shouldFail=false, so a broken CI producer can still pass the gate.

Extract ingest payload validation into a small pure helper and reject
empty results with HTTP 400 before any database write. Add node:test
regression coverage for the empty-array case, and document the
non-empty requirement in the informational GET response.
@tdlxgpp

tdlxgpp commented Aug 23, 2026

Copy link
Copy Markdown
Author

Closing this as superseded by #4, which already implements the request-level regression test more completely. Thanks for the project and for the opportunity to try the good-first-issue flow.

@tdlxgpp tdlxgpp closed this Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reject empty result arrays so an empty eval run cannot pass CI

1 participant