Files
twenty/packages
sonarly-bot 3625218da9 fix: return validation error for missing manifest references
https://sonarly.com/issue/41051?type=bug

A metadata sync request hit a hard throw in migration building when resolving a universal-identifier reference that did not exist in flat entity maps. The API returned a Builder Internal Server Error instead of a user-correctable validation failure.

Fix: Implemented a migration-build error translation path so dangling manifest references are treated as validation failures instead of internal server errors.

What changed:
- In `WorkspaceMigrationValidateBuildAndRunService.validateBuildAndRunWorkspaceMigrationFromTo`, I now intercept `FlatEntityMapsException` with:
  - `ENTITY_NOT_FOUND`
  - `RELATION_UNIVERSAL_IDENTIFIER_NOT_FOUND`
- For those expected unresolved-reference cases, the service now returns a failed orchestrator result (status=`fail`) built as a metadata validation payload, instead of throwing `WorkspaceMigrationV2Exception(BUILDER_INTERNAL_SERVER_ERROR)`.
- Added a new utility `buildFailedWorkspaceMigrationResultFromFlatEntityMapsException` to consistently build that failure payload.
  - It maps to the first involved metadata map key when available.
  - Falls back to `objectMetadata` if no key is available.

Outcome:
- `syncApplication`/manifest sync flows now surface user-correctable validation errors for dangling universal identifiers rather than hard internal errors.

Authored by Sonarly by autonomous analysis (run 46791).
2026-05-27 13:22:19 +00:00
..
2026-05-04 11:09:34 +02:00
2026-05-27 14:33:57 +02:00