Fix: Implement pipeline error handling

Implement comprehensive error handling and robustness measures across the entire pipeline as per the detailed plan. This includes database-level security, client-side validation, scheduled maintenance, and fallback mechanisms for edge function failures.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-07 04:50:17 +00:00
parent 03aab90c90
commit a74b8d6e74
9 changed files with 513 additions and 64 deletions

View File

@@ -411,6 +411,39 @@ async function submitCompositeCreation(
}
}
// CRITICAL: Validate all temp refs were properly resolved
const validateTempRefs = () => {
const errors: string[] = [];
if (uploadedPrimary.type === 'park') {
if ('_temp_operator_ref' in primaryData && primaryData._temp_operator_ref === undefined) {
errors.push('Invalid operator reference - dependency not found');
}
if ('_temp_property_owner_ref' in primaryData && primaryData._temp_property_owner_ref === undefined) {
errors.push('Invalid property owner reference - dependency not found');
}
} else if (uploadedPrimary.type === 'ride') {
if ('_temp_park_ref' in primaryData && primaryData._temp_park_ref === undefined) {
errors.push('Invalid park reference - dependency not found');
}
if ('_temp_manufacturer_ref' in primaryData && primaryData._temp_manufacturer_ref === undefined) {
errors.push('Invalid manufacturer reference - dependency not found');
}
if ('_temp_designer_ref' in primaryData && primaryData._temp_designer_ref === undefined) {
errors.push('Invalid designer reference - dependency not found');
}
if ('_temp_ride_model_ref' in primaryData && primaryData._temp_ride_model_ref === undefined) {
errors.push('Invalid ride model reference - dependency not found');
}
}
if (errors.length > 0) {
throw new Error(`Temp reference validation failed: ${errors.join(', ')}`);
}
};
validateTempRefs();
submissionItems.push({
item_type: uploadedPrimary.type,
action_type: 'create' as const,