Skip to content

Conversation

@dobrac
Copy link
Contributor

@dobrac dobrac commented Sep 25, 2025

Refactor template request common methods (just moved around).

@dobrac dobrac self-assigned this Sep 25, 2025
@dobrac dobrac added the go Pull requests that update go code label Sep 25, 2025
@dobrac dobrac removed their assignment Sep 25, 2025
cursor[bot]

This comment was marked as outdated.

@dobrac
Copy link
Contributor Author

dobrac commented Sep 25, 2025

Telemetry Misreports Errors After Build Failures

Valid issues, but not new here. They'll be fixed in another PR (#1249)

@ValentaTomas ValentaTomas self-assigned this Sep 25, 2025
@dobrac dobrac enabled auto-merge (squash) September 25, 2025 22:00
@ValentaTomas ValentaTomas removed the request for review from jakubno September 25, 2025 22:01
cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Variable Shadowing and Error Reporting Issues

The template variable shadows the imported template package in both template_request_build_v2.go and template_request_build.go, causing a compilation error. Additionally, telemetry reporting in both files logs the body parsing error (err) instead of the actual template build error (apiError.Err), leading to misleading error information.

packages/api/internal/handlers/template_request_build_v2.go#L78-L84

template, apiError := template.RegisterBuild(ctx, a.templateBuildsCache, a.db, a.sqlcDB, buildReq)
if apiError != nil {
a.sendAPIStoreError(c, apiError.Code, apiError.ClientMsg)
telemetry.ReportCriticalError(ctx, "invalid request body", err)
return
}

packages/api/internal/handlers/template_request_build.go#L104-L110

template, apiError := template.RegisterBuild(ctx, a.templateBuildsCache, a.db, a.sqlcDB, buildReq)
if apiError != nil {
a.sendAPIStoreError(c, apiError.Code, apiError.ClientMsg)
telemetry.ReportCriticalError(ctx, "build template request failed", err)
return nil
}

Fix in Cursor Fix in Web


Bug: Template Shadowing and Telemetry Error

The TemplateRequestBuild function introduces a compilation error where the template variable shadows the imported template package. It also incorrectly reports build failures to telemetry by using an unrelated error variable.

packages/api/internal/handlers/template_request_build.go#L104-L108

template, apiError := template.RegisterBuild(ctx, a.templateBuildsCache, a.db, a.sqlcDB, buildReq)
if apiError != nil {
a.sendAPIStoreError(c, apiError.Code, apiError.ClientMsg)
telemetry.ReportCriticalError(ctx, "build template request failed", err)

Fix in Cursor Fix in Web


@dobrac dobrac merged commit 0e45063 into main Sep 25, 2025
25 checks passed
@dobrac dobrac deleted the refactor-template-request branch September 25, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants