Skip to content

feat(store): kyc read skips a deleted organization - #1994

Merged
rohilsurana merged 2 commits into
mainfrom
feat/kyc-read-skips-deleted-org
Oct 14, 2026
Merged

rohilsurana merged 2 commits into
mainfrom
feat/kyc-read-skips-deleted-org

Conversation

@rohilsurana

Copy link
Copy Markdown
Member

Summary

Reading the KYC record of an organization now also checks that the organization is live. If the organization is deleted, the read returns "not exist", even when a live KYC row is still stored under it.

Changes

  • GetByOrgID joins the organizations table and only returns the KYC row when the organization is not deleted.
  • Added a test for a deleted organization that still has a live KYC row.

Technical Details

  • The live check for the organization sits in the join On, the same way List does it.
  • The query still selects only the KYC columns, so the scan target is unchanged.
  • This follows the same rule as the other child reads. It closes the one path where a stray live KYC row under a deleted organization could still be read.

Test Plan

  • New test TestGetByOrgIDSkipsDeletedOrg failed before the change and passes after it
  • go test ./internal/store/postgres/ ./core/kyc/...
  • go build ./...
  • golangci-lint run ./internal/store/postgres/... reports 0 issues
  • gofmt reports nothing

SQL Safety

  • Values go through goqu.Record and goqu.Ex
  • ToSQL callers forward params
  • No ? placeholders inside quoted literals in goqu.L
  • No new nolint annotations

@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
frontier Ready Ready Preview Oct 13, 2026 11:14am UTC

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: raystack/frontier/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8739ad72-bcaa-4ce5-8a6b-4bf8c64eb295
📥 Commits

Reviewing files that changed from the base of the PR and between 7d1a3d3 and 257f112.

📒 Files selected for processing: 2
  • internal/store/postgres/kyc_repository.go
  • internal/store/postgres/kyc_repository_test.go

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

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • KYC lookups now return “not found” when the associated organization has been deleted, rather than returning its KYC record. This keeps results consistent with the organization’s current status.

GetByOrgID now joins live organizations to live KYC records. A new test checks that the lookup returns kyc.ErrNotExist when the organization is soft-deleted but its KYC record remains live.

Changes: KYC organization lookup

Layer / File(s) Summary
Live organization filter
internal/store/postgres/kyc_repository.go, internal/store/postgres/kyc_repository_test.go
GetByOrgID joins live organizations to live KYC records. A test verifies the kyc.ErrNotExist result for a soft-deleted organization.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: whoabhisheksah

Merge Risk: ⚪ Minimal · up to 257f1

Lookups now treat KYC records under soft-deleted organizations as absent, without changing the existing response behavior. No material merge risk was identified.

Pre-merge checks: Passed 2
Passed Passed checks: 2 passed
Check name Status Explanation
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.
  • 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

Comment @coderabbitai help to get the list of available commands.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 38388822954

Coverage increased (+0.005%) to 54.896%

Details

  • Coverage increased (+0.005%) from the base build.
  • Patch coverage: 8 of 8 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 41544
Covered Lines: 22806
Line Coverage: 54.9%
Coverage Strength: 19.01 hits per line

💛 - Coveralls

@rohilsurana
rohilsurana marked this pull request as ready for review October 14, 2026 07:54
@rohilsurana
rohilsurana merged commit 8b210cc into main Oct 14, 2026
8 checks passed
@rohilsurana
rohilsurana deleted the feat/kyc-read-skips-deleted-org branch October 14, 2026 08:50

This branch was successfully deployed

1 active deployment
Preview — 257f112a Deployed Oct 13, 2026 by vercel[bot]
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.

3 participants