Skip to content

fix(controlplane): stop masking transient org-lookup errors as not found#3302

Merged
javirln merged 1 commit into
chainloop-dev:mainfrom
javirln:javier/pfm-6775-stop-masking-transient-org-lookup-errors-as-organization-not
Jul 23, 2026
Merged

fix(controlplane): stop masking transient org-lookup errors as not found#3302
javirln merged 1 commit into
chainloop-dev:mainfrom
javirln:javier/pfm-6775-stop-masking-transient-org-lookup-errors-as-organization-not

Conversation

@javirln

@javirln javirln commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

MembershipRepo.FindByOrgNameAndUser masked any non-NotFound failure of the organization query as a fabricated "organization not found" error that was neither a biz.NotFound nor a wrap of the real cause. This discarded the underlying DB error and made ContextService.Current return a captured gRPC 500 for what was actually a transient failure against an organization that exists.

Now only ent.IsNotFound maps to biz.NewErrNotFound; every other error is returned wrapped with %w, so the true root cause (SQLSTATE, statement/pool timeout, context cancellation) reaches logs and Sentry with an accurate fingerprint. The client-facing masking is unchanged — it still happens downstream in handleUseCaseErr/LogAndMaskErr, so the internal error is never exposed to the client. A genuinely missing organization still returns biz.NotFound and degrades gracefully.

Fixes PFM-6775. Root-cause fix for PFM-6773.

AI assistance

This change was produced with the assistance of Claude Code.

Review in cubic

MembershipRepo.FindByOrgNameAndUser masked any non-NotFound failure of
the org query as a fabricated "organization not found" error that was
neither a biz.NotFound nor a wrap of the real cause. This discarded the
underlying DB error and made ContextService.Current return a captured
gRPC 500 for what was actually a transient failure against an org that
exists.

Only ent.IsNotFound now maps to biz.NewErrNotFound; every other error is
returned wrapped with %w so the true root cause (SQLSTATE, statement or
pool timeout, context cancellation) reaches logs and Sentry, while the
client-facing masking still happens downstream in handleUseCaseErr.

Assisted-by: Claude Code
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>

Chainloop-Trace-Sessions: 421c4127-1b07-498e-aff5-0d3fef860c3c
@chainloop-platform

Copy link
Copy Markdown
Contributor

AI Session Analysis

Missing AI Coding Sessions

We detected commits in this PR that were AI-assisted, but the matching Chainloop Trace session(s) could not be found in Chainloop.

Please make sure the AI coding session evidence has been sent by the Chainloop CLI, or add the skip-ai-session label to this PR to bypass this check.

Learn more about Chainloop Trace.


Powered by Chainloop and Chainloop Trace

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@javirln
javirln marked this pull request as ready for review July 22, 2026 09:19
@javirln
javirln requested a review from a team July 22, 2026 09:19
@javirln
javirln merged commit c3e36e4 into chainloop-dev:main Jul 23, 2026
15 of 16 checks passed
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