Skip to content

feat: filter builds by CI build id - #355

Merged
pashidlos merged 1 commit into
Visual-Regression-Tracker:masterfrom
nGervasyuk:feat/search-builds-by-ci-build-id
Jul 27, 2026
Merged

feat: filter builds by CI build id#355
pashidlos merged 1 commit into
Visual-Regression-Tracker:masterfrom
nGervasyuk:feat/search-builds-by-ci-build-id

Conversation

@nGervasyuk

@nGervasyuk nGervasyuk commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

What & why

GET /builds only supports pagination, so finding a specific run in a project with a long history means paging through the build list. This adds an optional server-side filter on the CI build id, which the UI can use to search the whole history instead of the loaded page.

Changes

  • New optional ciBuildId query param on GET /builds. It matches a case-insensitive substring (contains + mode: insensitive).
  • The where clause is built once and passed to both count and findMany, so total stays consistent with the filtered page and pagination doesn't lie.
  • An empty or omitted value means no filter, so existing clients (CI agents, SDKs) are unaffected. Documented in Swagger with @ApiQuery({ required: false }).

No schema change and no new index: ILIKE '%x%' can't use the existing @@unique([projectId, ciBuildId]) b-tree anyway, and the scan is bounded by one project's builds (default maxBuildAllowed is 100).

Notes for reviewers

Prisma's contains does not escape LIKE wildcards, so % and _ typed by a user act as wildcards. That's a false-positive match, not an injection — the query stays parameterised. Happy to escape them if you'd prefer strict literal matching.

Testing

  • npm run build and eslint clean.
  • Unit tests: 175/175 pass, including two new findMany cases (filter applied to both queries; empty value ignored).
  • Verified against a local instance with 40 builds: no filter → 40, REGRESSION → 10 (case-insensitive), 19.5 → 2, no match → 0, empty value → unfiltered, invalid projectId → 400.

Screenshots

Screen.Recording.2026-07-27.at.11.11.14.mov
Screenshot 2026-07-27 at 11 11 53 Screenshot 2026-07-27 at 11 12 10 Screenshot 2026-07-27 at 11 12 19

Add an optional ciBuildId query param to GET /builds. It matches a case
insensitive substring and is applied to both the count and the page
query, so pagination stays consistent with the filtered result.

@pashidlos pashidlos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGM

@pashidlos
pashidlos merged commit 267bb23 into Visual-Regression-Tracker:master Jul 27, 2026
1 of 2 checks passed
@nGervasyuk
nGervasyuk deleted the feat/search-builds-by-ci-build-id branch July 27, 2026 18:41
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.

2 participants