Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export const customConnectionRepositoryExtension: IConnectionRepository &
.leftJoinAndSelect('connection.groups', 'group')
.leftJoinAndSelect('group.users', 'user')
.leftJoinAndSelect('connection.connection_properties', 'connection_properties')
.andWhere('user.id = :userId', { userId: userId });
.andWhere('user.id = :userId', { userId: userId })
.orderBy('connection.createdAt', 'DESC');
Comment on lines 41 to +43

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

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

Ordering solely by createdAt can be nondeterministic when multiple connections share the same timestamp (e.g., bulk inserts / same DB transaction timestamp). Consider adding a secondary deterministic sort key (via addOrderBy) to ensure stable results when createdAt ties.

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +43

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

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

This change introduces a user-visible ordering contract (newest connections first) but existing e2e tests around GET /connections don’t appear to assert ordering. Adding/adjusting an e2e assertion would prevent regressions (especially around test vs non-test connections).

Copilot uses AI. Check for mistakes.
if (!includeTestConnections) {
connectionQb.andWhere('connection.isTestConnection = :isTest', { isTest: false });
}
Expand All @@ -54,7 +55,8 @@ export const customConnectionRepositoryExtension: IConnectionRepository &
.leftJoinAndSelect('group.users', 'user')
.leftJoinAndSelect('connection.connection_properties', 'connection_properties')
.andWhere('user.id = :userId', { userId: userId })
.andWhere('connection.isTestConnection = :isTest', { isTest: true });
.andWhere('connection.isTestConnection = :isTest', { isTest: true })
.orderBy('connection.createdAt', 'DESC');
Comment on lines 57 to +59

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

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

Same as above: ordering only by createdAt can produce unstable ordering when timestamps tie. Add a secondary deterministic ordering (e.g., addOrderBy) here as well so test-connection lists are stable.

Copilot uses AI. Check for mistakes.
const connections = await connectionQb.getMany();
await decryptConnectionsCredentialsAsync(connections);
return connections;
Expand Down
Loading