Skip to content

refactor: remove unused test connection configurations and update rel…#1850

Merged
Artuomka merged 1 commit into
mainfrom
backend_test_connections_removing
Jun 25, 2026
Merged

refactor: remove unused test connection configurations and update rel…#1850
Artuomka merged 1 commit into
mainfrom
backend_test_connections_removing

Conversation

@Artuomka

@Artuomka Artuomka commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

…ated tests

Summary by CodeRabbit

  • Bug Fixes

    • Reduced the set of built-in test database connections shown in SaaS mode.
    • Only Postgres and MySQL SSH test connections are now available as fallback options.
    • Connection lists and test-connection counts are now consistent across connection-related screens and permissions flows.
  • Tests

    • Updated end-to-end checks to match the smaller connection set and revised counts.

Copilot AI review requested due to automatic review settings June 25, 2026 08:54
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

SaaS fallback test connections were narrowed to Postgres and SSH MySQL, and the allowed DTO types were restricted to mysql and postgres. The related e2e tests were updated to expect the smaller connection lists and the MySQL-specific field check.

Changes

SaaS test connection set

Layer / File(s) Summary
Constants catalog update
backend/src/helpers/constants/constants.ts
The exported SaaS test-connection presets for MSSQL, Oracle, MongoDB, and IBM DB2 are removed, and getTestConnectionsArr() now keeps only Postgres and SSH MySQL DTOs.
Connection list expectations
backend/test/ava-tests/saas-tests/connection-e2e.test.ts, backend/test/ava-tests/saas-tests/user-admin-permissions-e2e.test.ts, backend/test/ava-tests/saas-tests/user-group-edit-permissions-e2e.test.ts, backend/test/ava-tests/saas-tests/user-table-different-group-connection-readonly-permissions-e2e.test.ts, backend/test/ava-tests/saas-tests/user-with-table-only-permissions-e2e.test.ts
GET /connections assertions now expect smaller result sets in the connection and permission scenarios, and the Oracle-specific check in connection-e2e.test.ts is replaced with a MySQL host assertion.
Display and demo flow expectations
backend/test/ava-tests/saas-tests/company-info-e2e.test.ts, backend/test/ava-tests/saas-tests/user-e2e.test.ts
The company display toggle and demo-registration tests now assert the smaller connections arrays returned by the updated SaaS defaults.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • lyubov-voloshko

Poem

A rabbit hopped through constants bright,
Then tucked away the extras out of sight.
Postgres and MySQL now lead the run,
The test suite hops along—still done! 🐇

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: removing unused test connection configs and updating related tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Security Check ✅ Passed PASS: The change only narrows SaaS test connections to MySQL/Postgres and filters other types; no new user-controlled paths or privilege changes were added.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backend_test_connections_removing

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +200 to +204
// Only MySQL and Postgres are provided as test connections for registered users.
const allowedTestConnectionTypes: Array<ConnectionTypesEnum> = [
ConnectionTypesEnum.mysql,
ConnectionTypesEnum.postgres,
];
Comment on lines +134 to +136
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);

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
backend/src/helpers/constants/constants.ts (1)

200-216: 🎯 Functional Correctness | 🔵 Trivial

Verify intent for DSN-derived connection types

The concern that TEST_SSH_CONNECTION_TO_MYSQL would be filtered out is incorrect. It is defined with type: ConnectionTypesEnum.mysql (Line 169 in constants.ts) and will successfully pass the allowedTestConnectionTypes check, ensuring the expected two test connections are preserved.

However, the new filter strictly discards any ConnectionDTOs returned by getTestConnectionsFromDSN() that are not explicitly mysql or postgres. This means connections detected for mssql, oracle, mongo, or dynamodb via 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

📥 Commits

Reviewing files that changed from the base of the PR and between 95595f5 and 2f63522.

📒 Files selected for processing (8)
  • backend/src/helpers/constants/constants.ts
  • backend/test/ava-tests/saas-tests/company-info-e2e.test.ts
  • backend/test/ava-tests/saas-tests/connection-e2e.test.ts
  • backend/test/ava-tests/saas-tests/user-admin-permissions-e2e.test.ts
  • backend/test/ava-tests/saas-tests/user-e2e.test.ts
  • backend/test/ava-tests/saas-tests/user-group-edit-permissions-e2e.test.ts
  • backend/test/ava-tests/saas-tests/user-table-different-group-connection-readonly-permissions-e2e.test.ts
  • backend/test/ava-tests/saas-tests/user-with-table-only-permissions-e2e.test.ts

@Artuomka Artuomka enabled auto-merge June 25, 2026 09:02
@Artuomka Artuomka merged commit caea992 into main Jun 25, 2026
17 of 18 checks passed
@Artuomka Artuomka deleted the backend_test_connections_removing branch June 25, 2026 09:03
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