Skip to content

[v5] Add a batch resolution endpoint for regressions - #678

Open
NopeCharon wants to merge 1 commit into
llvm:mainfrom
NopeCharon:v5-regressions-resolve
Open

NopeCharon wants to merge 1 commit into
llvm:mainfrom
NopeCharon:v5-regressions-resolve

Conversation

@NopeCharon

Copy link
Copy Markdown

Fixes #305.

Adds POST /api/projects/{project}/suites/{suite}/regressions/resolve, modelled on POST .../commits/resolve (E3), so a client holding the regression UUIDs returned by the indicator lookup can read their title, state and commit in one request.

  • The body is {"regressions": ["<uuid>", ...]}: 1 to I2's maximum page size UUIDs, matched case-insensitively, duplicates ignored.
  • The response is {"results": {"<uuid>": {...}}, "not_found": [...]}. Each result is a regression as the list returns it (so it includes machine_count and test_count, which the issue left open; there is no request-level filter for them to disagree with). UUIDs that match no regression are reported in not_found instead of a 404. A NUL in a UUID is still a 400 (D5).
  • read scope, not paginated. The UUIDs are bound as one array parameter, so the statement text is the same whatever the request size (as for commits).
  • Updated: the E8 design doc, llms.txt, and the generated client types (schema.d.ts).

I did not switch the Graph's regression annotations (GR12/GR14) over to the new endpoint; that can be a follow-up.

Tests (test_regressions.py, test_docs.py): response shape equal to the list item, no notes/indicators, case-insensitive match, dedupe and request order, not_found, over-long values, NUL, size bounds, invalid bodies, no credential needed, one statement for any request size, unknown suite, and the OpenAPI document checks (documented operation, 404/409, request example, response samples).

Checked locally against PostgreSQL 18: ruff check, ruff format --check, mypy, test_regressions.py (226 passed), test_docs.py, the OpenAPI generation, and schema.d.ts regenerated with openapi-typescript.

The indicator lookup (`POST .../regressions/indicators/query`) returns
each indicator with only the UUID of its regression. A client that needs
the title, state or commit of the regressions it found had to fetch each
one's detail, or walk `GET /regressions` and join on the UUID.

Add `POST /api/projects/{project}/suites/{suite}/regressions/resolve`,
modelled on `POST .../commits/resolve` (E3). The body is
`{"regressions": ["<uuid>", ...]}`, from 1 to I2's maximum page size
UUIDs, matched case-insensitively and deduplicated. The response is
`{"results": {...}, "not_found": [...]}`: `results` maps each UUID that
was found (in lowercase) to the regression as the list returns it, and
UUIDs that match no regression are reported in `not_found` rather than
answered with a 404, so a client resolving the results of an earlier
lookup can simply drop ones deleted in between. A NUL in a UUID is still
a 400, as everywhere else (D5).

The endpoint is `read`-scoped and not paginated, as the response is
bounded by the request. The lookup binds the UUIDs as a single array
parameter, so the statement text, and the driver's prepared-statement
cache entry, are the same whatever the size of the request.

The results carry `machine_count` and `test_count`, as the list items
do: the request body names the regressions, so there is no request-level
filter for the counts to disagree with.

The design document (E8), `llms.txt` and the client's generated API types
are updated, and the endpoint is covered by tests for the response shape,
case-insensitive matching, deduplication and ordering, `not_found`, the
request bounds, the NUL rejection, the single prepared statement, the
missing suite, and the lack of a credential requirement.

Fixes llvm#305

This branch has not been deployed

No deployments
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.

[v5] Add a batch resolution endpoint for regressions

1 participant