https://sonarly.com/issue/4058?type=bug
A bug in `setupOptimisticCache` in v1.18.1 causes the optimistic view field maps to be empty during the workspace migration build, causing all view field creation operations on existing views with existing fields to throw `BUILDER_INTERNAL_SERVER_ERROR`.
Fix: **No code changes needed — the fix is already in the codebase.**
The root cause was two bugs in v1.18.1 that were fixed in commit `af0af0a237` ("Fix cross app installation (#18151)"), merged 2026-02-23:
1. **`setupOptimisticCache` bug** (in `workspace-migration-build-orchestrator.service.ts`): The old code had `isDefined(allFlatEntityMaps[currFlatMaps])` in a guard clause that always evaluated to `true` because `createEmptyAllFlatEntityMaps()` creates non-null empty objects for every metadata type. This prevented the actual `fromToAllFlatEntityMaps.from` data from being applied, leaving the operated-on entity type's maps empty. **Fix**: Added an early-return path when `dependencyAllFlatEntityMaps` is defined, bypassing the broken reduce loop entirely.
2. **Missing entity type in dependency maps** (in `workspace-migration-validate-build-and-run-service.ts`): The old `computeAllRelatedFlatEntityMaps` computed `dependencyAllFlatEntityMaps` only from **related** metadata names (e.g., `view`, `fieldMetadata`, `objectMetadata`) but not the **operated-on** type itself (e.g., `viewField`). **Fix**: Changed to use `allMetadataNameCacheToCompute` which includes both the operated-on type and its related types, plus added application ID filtering via `getSubFlatEntityMapsByApplicationIdsOrThrow`.
To resolve this Sentry error in production, deploy a release that includes commit `af0af0a237` or later.