fix(server): surface validation errors in 2-14 fix-standard-relation-field-labels-icons upgrade command (#21658)
## Problem
The \`2-14:fix-standard-relation-field-labels-icons\` workspace upgrade
command threw a generic error on migration build failure:
\`\`\`ts
if (result.status === 'fail') {
throw new Error(\`Migration failed for workspace \${workspaceId} while
healing standard relation field labels/icons\`);
}
\`\`\`
This discarded \`result.report\` entirely — the structured per-field
validation failures (\`code\`, \`message\`, \`value\`, offending field)
— making real-world upgrade failures impossible to diagnose from logs.
On a recent staging/app-main upgrade, 13 workspaces failed here with no
actionable detail.
## Change
Flatten \`result.report\` into both the logged error and the thrown
message, so failures now print the actual validation errors per field,
e.g.:
\`\`\`
[fieldMetadata] <universalIdentifier> -> SOME_VALIDATION_CODE: <real
reason>
\`\`\`
No behavior change beyond logging/error content — the command still
aborts on failure as before.
## Notes
- Dry-run still returns before the build step, so this only surfaces on
real runs (unchanged).
<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/21658?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
+16
-1
@@ -136,8 +136,23 @@ export class FixStandardRelationFieldLabelsIconsCommand extends ActiveOrSuspende
|
||||
);
|
||||
|
||||
if (result.status === 'fail') {
|
||||
const failureDetails = Object.values(result.report)
|
||||
.flat()
|
||||
.map((failedValidation) => {
|
||||
const errorMessages = failedValidation.errors
|
||||
.map((error) => `${error.code}: ${error.message}`)
|
||||
.join('; ');
|
||||
|
||||
return `[${failedValidation.metadataName}] ${failedValidation.flatEntityMinimalInformation.universalIdentifier ?? failedValidation.flatEntityMinimalInformation.id ?? 'unknown'} -> ${errorMessages}`;
|
||||
})
|
||||
.join('\n');
|
||||
|
||||
this.logger.error(
|
||||
`Migration build failed for workspace ${workspaceId} while healing standard relation field labels/icons:\n${failureDetails}`,
|
||||
);
|
||||
|
||||
throw new Error(
|
||||
`Migration failed for workspace ${workspaceId} while healing standard relation field labels/icons`,
|
||||
`Migration failed for workspace ${workspaceId} while healing standard relation field labels/icons:\n${failureDetails}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user