fix(api): reject empty results arrays in /api/runs - #5
Closed
tdlxgpp wants to merge 1 commit into
Closed
Conversation
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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3:
/api/runsacceptedresults: [], stored a run withtotal: 0, and returnedshouldFail: false. A broken CI producer could therefore submit no evaluation cases and still get a passing gate.Change
lib/validate-ingest.ts.POST /api/runsnow rejects an emptyresultsarray with HTTP 400 before any database write.node:testregression coverage inlib/validate-ingest.test.ts.GET /api/runsresponse.npm testscript.Test
Checklist
resultsrejected before DB write