Skip to content

feat(builds): accept the API key for GET /builds/:id - #493

Open
DoraGenc wants to merge 1 commit into
Visual-Regression-Tracker:masterfrom
DoraGenc:builds-get-by-id-api-key
Open

DoraGenc wants to merge 1 commit into
Visual-Regression-Tracker:masterfrom
DoraGenc:builds-get-by-id-api-key

Conversation

@DoraGenc

@DoraGenc DoraGenc commented Nov 11, 2026 •

Copy link
Copy Markdown

Why

A client that holds only an API key, such as a CI integration that reports a build's result back to the code host, can already read a build: PATCH /builds/:id accepts the key and returns the whole BuildDto. But every such read writes the build (updatedAt) and emits build_updated to all connected clients, and the key needs the admin or editor role. Polling a build that way turns each check into a write.

Accepting the key on GET /builds/:id lets that client read without writing. The key reads what its user can already read after logging in; nothing new is exposed.

What changes

  • GET /builds/:id uses MixedGuard (JWT or API key) instead of JwtAuthGuard, and documents api_key in Swagger
  • Without credentials it now answers 403 instead of 401, matching PATCH /builds/:id
  • e2e: 200 api and 403 cases for GET /builds/:id

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • The build details endpoint now supports API-key authentication alongside bearer authentication, providing an additional way to access build information.
  • Bug Fixes
    • Added coverage to verify the endpoint’s API-key access and its response to unauthenticated requests.

A client holding only an API key can read a build today, but only through
PATCH /builds/:id, which writes the build and emits build_updated on every
call. Accepting the key on GET lets such a client, for example a CI
integration that reports a build's result, read without writing. The key
reads what its user can already read after logging in.

Without credentials GET /builds/:id now answers 403 instead of 401, as
PATCH /builds/:id already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The GET /builds/:id endpoint now uses mixed-guard authentication and declares API-key security alongside bearer authentication. E2e tests check access with an API key and rejection of an empty JWT token.

Changes: Build retrieval authentication

Layer / File(s) Summary
Endpoint authentication and validation
src/builds/builds.controller.ts, test/builds.e2e-spec.ts
The endpoint now uses MixedGuard and declares API-key security alongside bearer authentication. E2e tests check that an API-key request returns the created build with HTTP 200, and that an empty JWT token returns HTTP 403.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Suggested reviewers: pashidlos

Merge Risk: Minimal · up to c3477

The endpoint now accepts an API key in addition to a JWT, matching PATCH /builds/:id. Unauthenticated requests receive 403 instead of 401. E2e tests cover both cases. No actionable merge risk remains.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: allowing API-key authentication for GET /builds/:id.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1f0426b and c3477f3.

Files selected for processing: 2

  • src/builds/builds.controller.ts
  • test/builds.e2e-spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@DoraGenc
DoraGenc marked this pull request as ready for review November 11, 2026 14:27
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.

1 participant