fix(api): downgrade team-limit build errors to warnings and dedupe logs#2635
Conversation
Client-side validation failures (e.g. memory exceeds team limits) were logged twice as errors: once inside RegisterBuild and again in the handlers. Drop the inner log and route the outer log through ReportErrorByCode so 4xx responses emit a single Warn while 5xx responses still emit an Error.
PR SummaryLow Risk Overview It removes a few Reviewed by Cursor Bugbot for commit b39dd89. Bugbot is set up for automated code reviews on this repo. Configure here. |
❌ 9 Tests Failed:
View the full list of 11 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Small telemetry-only change that correctly downgrades client-side validation failures to Warn and de-duplicates logging; the only bug noted is a pre-existing inconsistency in adjacent code.
Extended reasoning...
Overview
Three files touched, all in the API package: packages/api/internal/template/register_build.go (removes one inner ReportCriticalError for the team-limit branch) and the two handler files deprecated_template_request_build.go and template_request_build_v3.go (switches outer log from ReportCriticalError to ReportErrorByCode, which delegates to Warn for 4xx and Error for 5xx). Net effect: client-side validation failures (e.g. memory exceeds team limits) emit one Warn instead of two Errors at different severities; 500-class failures still log as Error.
Security risks
None. This is purely an observability/logging severity change — no auth, crypto, request-handling, or data-path logic is modified. Worst plausible regression is a missed Error log if RegisterBuild is invoked from a future non-handler caller without its own logging (noted by cursor[bot]); not a concern for the current code.
Level of scrutiny
Low. The change is mechanical, the diff is ~5 lines of meaningful change, and the semantics of the new function (ReportErrorByCode) are already well-established in the codebase. The earlier gemini-code-assist comment about missing WithTemplateID on the v3 handler was already addressed in commit ebb13a1.
Other factors
The bug-hunter flagged a co-located nit: two other 4xx paths inside RegisterBuild (the 409 alias-conflict at line 258 and the 403 alias-already-used at line 320) still call ReportCriticalError internally, so the dedupe goal is only partially achieved. This is a pre-existing inconsistency not introduced by this PR, and the inline comment already conveys it to the author as a follow-up. Not a blocker.
…gs (#2635) Client-side validation failures (e.g. memory exceeds team limits) were logged twice as errors: once inside RegisterBuild and again in the handlers. Drop the inner log and route the outer log through ReportErrorByCode so 4xx responses emit a single Warn while 5xx responses still emit an Error. --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Client-side validation failures (e.g. memory exceeds team limits) were logged twice as errors: once inside RegisterBuild and again in the handlers. Drop the inner log and route the outer log through ReportErrorByCode so 4xx responses emit a single Warn while 5xx responses still emit an Error.