refactor: remove unused test connection configurations and update rel…#1850
Conversation
📝 WalkthroughWalkthroughSaaS fallback test connections were narrowed to Postgres and SSH MySQL, and the allowed DTO types were restricted to ChangesSaaS test connection set
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR refactors the SaaS “test connections” setup to reduce the set of built-in test connection configurations (now effectively focusing on Postgres + MySQL) and updates SaaS AVA E2E tests to match the new connection counts.
Changes:
- Removed unused test connection configuration objects (e.g., Oracle/MSSQL/Mongo/IBM DB2) from
Constants. - Restricted
Constants.getTestConnectionsArr()to return only MySQL/Postgres test connections. - Updated multiple SaaS AVA E2E tests to expect fewer test connections in
/connections-related responses.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/test/ava-tests/saas-tests/user-with-table-only-permissions-e2e.test.ts | Updates expected /connections count after reducing test connections. |
| backend/test/ava-tests/saas-tests/user-table-different-group-connection-readonly-permissions-e2e.test.ts | Updates expected total connections and test-connection counts. |
| backend/test/ava-tests/saas-tests/user-group-edit-permissions-e2e.test.ts | Updates expected total connections and test-connection counts. |
| backend/test/ava-tests/saas-tests/user-e2e.test.ts | Updates expected connection counts affected by test-connection display mode/demo registration flows. |
| backend/test/ava-tests/saas-tests/user-admin-permissions-e2e.test.ts | Updates expected total connections and test-connection counts. |
| backend/test/ava-tests/saas-tests/connection-e2e.test.ts | Updates expected counts and adjusts assertions to reflect MySQL/Postgres-only test connections. |
| backend/test/ava-tests/saas-tests/company-info-e2e.test.ts | Updates expected connections count in company info flows. |
| backend/src/helpers/constants/constants.ts | Removes unused test connection DTOs and filters allowed test connection types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Only MySQL and Postgres are provided as test connections for registered users. | ||
| const allowedTestConnectionTypes: Array<ConnectionTypesEnum> = [ | ||
| ConnectionTypesEnum.mysql, | ||
| ConnectionTypesEnum.postgres, | ||
| ]; |
| const mysqlConnectionIndex = result.findIndex((e) => e.connection.type === ConnectionTypesEnum.mysql); | ||
| // eslint-disable-next-line security/detect-object-injection | ||
| t.is(Object.hasOwn(result[oracleConnectionIndex].connection, 'sid'), true); | ||
| t.is(Object.hasOwn(result[mysqlConnectionIndex].connection, 'host'), true); |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
backend/src/helpers/constants/constants.ts (1)
200-216: 🎯 Functional Correctness | 🔵 TrivialVerify intent for DSN-derived connection types
The concern that
TEST_SSH_CONNECTION_TO_MYSQLwould be filtered out is incorrect. It is defined withtype: ConnectionTypesEnum.mysql(Line 169 in constants.ts) and will successfully pass theallowedTestConnectionTypescheck, ensuring the expected two test connections are preserved.However, the new filter strictly discards any ConnectionDTOs returned by
getTestConnectionsFromDSN()that are not explicitlymysqlorpostgres. This means connections detected formssql,oracle,mongo, ordynamodbvia DSN will now be silently dropped from the test connections list. Confirm if this narrowing of allowed types is the intended behavior for DSN-derived connections.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/src/helpers/constants/constants.ts` around lines 200 - 216, The new filtering in the test-connections path is too restrictive for DSN-derived results: `allowedTestConnectionTypes` inside the test connection filter only permits `ConnectionTypesEnum.mysql` and `ConnectionTypesEnum.postgres`, so `getTestConnectionsFromDSN()` entries for other valid types will be dropped. Update the filtering in this constants helper to match the intended support for DSN-derived connection types, either by broadening `allowedTestConnectionTypes` or by handling DSN-generated entries separately, while keeping the `CreateConnectionDto` null check and the existing `TEST_SSH_CONNECTION_TO_MYSQL` behavior intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@backend/src/helpers/constants/constants.ts`:
- Around line 200-216: The new filtering in the test-connections path is too
restrictive for DSN-derived results: `allowedTestConnectionTypes` inside the
test connection filter only permits `ConnectionTypesEnum.mysql` and
`ConnectionTypesEnum.postgres`, so `getTestConnectionsFromDSN()` entries for
other valid types will be dropped. Update the filtering in this constants helper
to match the intended support for DSN-derived connection types, either by
broadening `allowedTestConnectionTypes` or by handling DSN-generated entries
separately, while keeping the `CreateConnectionDto` null check and the existing
`TEST_SSH_CONNECTION_TO_MYSQL` behavior intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4fd8f80c-d88c-476e-919b-7424c1f2be7b
📒 Files selected for processing (8)
backend/src/helpers/constants/constants.tsbackend/test/ava-tests/saas-tests/company-info-e2e.test.tsbackend/test/ava-tests/saas-tests/connection-e2e.test.tsbackend/test/ava-tests/saas-tests/user-admin-permissions-e2e.test.tsbackend/test/ava-tests/saas-tests/user-e2e.test.tsbackend/test/ava-tests/saas-tests/user-group-edit-permissions-e2e.test.tsbackend/test/ava-tests/saas-tests/user-table-different-group-connection-readonly-permissions-e2e.test.tsbackend/test/ava-tests/saas-tests/user-with-table-only-permissions-e2e.test.ts
…ated tests
Summary by CodeRabbit
Bug Fixes
Tests