twenty/packages
Charles Bochet 9a95cd02ed
Fix applications query cartesian product causing read timeouts (#19892)
## Summary

Same fix pattern as #19511 (`rolesPermissions` cartesian product).

The `Settings > Applications` page was hitting query read timeouts in
production. The offending SQL came from
`ApplicationService.findManyApplications` / `findOneApplication`, which
loaded **5 `OneToMany` children** in a single query via TypeORM
`relations`:

```
logicFunctions × agents × frontComponents × objects × applicationVariables
```

Postgres returns the Cartesian product of all five — e.g. 20 logic
functions × 5 agents × 30 front components × 100 objects × 10 variables
= **3M rows for ~165 distinct records**, which trivially exceeds the
read timeout.

## Changes

- **`findManyApplications`** — dropped all `OneToMany` relations. The
frontend `FIND_MANY_APPLICATIONS` query only selects scalar fields and
the `applicationRegistration` ManyToOne, so joining the children was
pure waste at the list level.
- **`findOneApplication`** — kept the cheap `ManyToOne` / `OneToOne`
joins (`packageJsonFile`, `yarnLockFile`, `applicationRegistration`) on
the main query and fetched the 5 `OneToMany` children in parallel via
`Promise.all`, reattaching them on the entity. Same shape as
`WorkspaceRolesPermissionsCacheService.computeForCache` after #19511.
- **`application.module.ts`** — registered the 5 child entity
repositories via `TypeOrmModule.forFeature`.

The other internal caller (`front-component.service.ts →
findOneApplicationOrThrow`) only reads
`application.universalIdentifier`, so the extra parallel single-key
lookups remain far cheaper than the previous 8-way join with row
explosion.
2026-04-20 17:04:10 +00:00
..
create-twenty-app Bump twenty-sdk, twenty-client-sdk, create-twenty-app to 1.23.0-canary.9 (#19883) 2026-04-20 13:21:00 +00:00
twenty-apps perf(sdk): split twenty-sdk barrel into per-purpose subpaths to cut logic-function bundle ~700x (#19834) 2026-04-18 19:38:34 +02:00
twenty-cli 1774 extensibility v1 create an exhaustive documentation readme or dedicated section in twenty contributing doc (#16751) 2025-12-22 15:19:11 +01:00
twenty-client-sdk Bump twenty-sdk, twenty-client-sdk, create-twenty-app to 1.23.0-canary.9 (#19883) 2026-04-20 13:21:00 +00:00
twenty-companion Migrate twenty-companion from npm to yarn workspaces (#18946) 2026-03-25 10:45:43 +01:00
twenty-docker Add twenty-managed Docker target with AWS CLI for EKS deployments (#19816) 2026-04-17 17:54:10 +00:00
twenty-docs i18n - docs translations (#19880) 2026-04-20 12:51:54 +02:00
twenty-e2e-testing shouldIncludeRecordPageLayouts deprecation (#19774) 2026-04-17 11:32:10 +00:00
twenty-emails i18n - translations (#18956) 2026-03-25 14:23:30 +01:00
twenty-front fix(ui): make CardPicker hover cover the whole card and align content left (#19884) 2026-04-20 17:00:12 +02:00
twenty-front-component-renderer perf(sdk): split twenty-sdk barrel into per-purpose subpaths to cut logic-function bundle ~700x (#19834) 2026-04-18 19:38:34 +02:00
twenty-oxlint-rules add workspaceId to indirect entities (#19522) 2026-04-09 19:30:28 +00:00
twenty-sdk Bump twenty-sdk, twenty-client-sdk, create-twenty-app to 1.23.0-canary.9 (#19883) 2026-04-20 13:21:00 +00:00
twenty-server Fix applications query cartesian product causing read timeouts (#19892) 2026-04-20 17:04:10 +00:00
twenty-shared feat(sdk): support viewSorts in app manifests (#19881) 2026-04-20 14:31:06 +02:00
twenty-ui fix(ui): make CardPicker hover cover the whole card and align content left (#19884) 2026-04-20 17:00:12 +02:00
twenty-utils Refactor dependency graph for SDK, client-sdk and create-app (#18963) 2026-03-26 10:56:52 +00:00
twenty-website Add AI as a public feature flag in the Lab (#19277) 2026-04-02 15:56:27 +00:00
twenty-website-new Cleanup files that were committed with website PR, but should not be there. (#19891) 2026-04-20 17:46:10 +02:00
twenty-zapier Deprecate legacy RICH_TEXT field metadata type (#18623) 2026-03-13 17:25:40 +01:00