You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deleting an org should also delete its KYC record. No end to end test checked this. This PR adds one.
Changes
New e2e test TestOrganizationDeleteHidesItsKyc.
The API regression suite now opens a database connection, so a test can look at rows the API does not show.
Technical Details
The test sets KYC on an org and deletes the org. It then checks four things.
The deleted org is not in the KYC list.
Reading the KYC of the deleted org gives an error, or an empty record.
The organizations_kyc row is still in the database, with deleted_at set and no live row left.
Setting KYC on the deleted org is refused, and a new org with the same name starts with no KYC.
The database check is the one that matters. The org is soft deleted too, so the API alone cannot tell whether the cascade deleted the KYC row. I made the org delete skip the KYC step for a moment. Only the database check failed, which shows it works. I then removed that change.
This test passes on main already. It documents current behaviour and guards it.
Test Plan
go test ./test/e2e/regression -run TestEndToEndAPIRegressionTestSuite -testify.m TestOrganizationDeleteHidesItsKyc passes
Same test fails when the org delete skips the KYC delete (change reverted)
Reviewing files that changed from the base of the PR and between 22db2fd and ea0b626.
📒 Files selected for processing: 1
test/e2e/regression/api_test.go
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
📝 Summary
Summary by CodeRabbit
Tests
Added regression coverage verifying that deleting an organization hides its KYC information and prevents access to it.
Verified KYC updates are rejected for deleted organizations, and that recreating an organization under the same name does not restore its prior KYC information. These checks confirm the expected behavior across organization deletion and recreation.
The regression suite now owns a database client. A new test checks KYC behavior when an organization is deleted and recreated with the same name.
The suite opens and closes a database client. The new test checks that organization deletion hides KYC, leaves a soft-deleted database row, rejects KYC updates to the deleted organization, and does not restore KYC when the organization is recreated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deleting an org should also delete its KYC record. No end to end test checked this. This PR adds one.
Changes
TestOrganizationDeleteHidesItsKyc.Technical Details
The test sets KYC on an org and deletes the org. It then checks four things.
organizations_kycrow is still in the database, withdeleted_atset and no live row left.The database check is the one that matters. The org is soft deleted too, so the API alone cannot tell whether the cascade deleted the KYC row. I made the org delete skip the KYC step for a moment. Only the database check failed, which shows it works. I then removed that change.
This test passes on main already. It documents current behaviour and guards it.
Test Plan
go test ./test/e2e/regression -run TestEndToEndAPIRegressionTestSuite -testify.m TestOrganizationDeleteHidesItsKycpassesgo vet ./test/e2e/...golangci-lint run ./test/e2e/...reports 0 issuesgofmt -l test/e2ereports nothing