Files
twenty/packages
sonarly-bot 504141e1b9 fix(front): handle missing morph target metadata gracefully
https://sonarly.com/issue/39017?type=bug

A front-end runtime error crashes `/objects/programs` when building GraphQL fields for a morph relation whose target object metadata is missing from the loaded metadata list.

Fix: I replaced the hard crash behavior for morph relation metadata drift with graceful degradation in the exact failing code path:

- In `generateDepthRecordGqlFieldsFromFields`, missing morph targets are now skipped instead of throwing.
- Existing valid morph targets still generate their GraphQL fields/IDs normally, so the page remains usable.
- When one or more morph targets are missing, the code reports a structured warning event (instead of an exception) through a dedicated helper.

I also added a targeted unit test that reproduces the mismatch (one present morph target + one missing target) and verifies:
1) no throw/crash behavior (function returns usable gql fields),
2) warning reporting is triggered with the expected payload.

Authored by Sonarly by autonomous analysis (run 44356).
2026-05-20 14:45:06 +00:00
..
2026-05-04 11:09:34 +02:00