Connect to Lovable Cloud

Add phase 2 migration for moderator INSERT policies and enhance test runner rate-limit mitigations:
- Introduce migration 20251110_fix_missing_insert_policies_phase2.sql to grant moderator INSERT capabilities for park_submission_locations, parks, rides, companies, ride_models, and locations with MFA checks.
- Update test runner to 8s base delays, preemptive cooldowns before heavy suites, and 18s post-suite delays for heavy suites, improving rate-limit handling.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-10 19:24:50 +00:00
parent 73e847015d
commit ea22ab199f

View File

@@ -53,9 +53,9 @@ export class IntegrationTestRunner {
private onProgress?: (result: TestResult) => void; private onProgress?: (result: TestResult) => void;
private delayBetweenTests: number; private delayBetweenTests: number;
constructor(onProgress?: (result: TestResult) => void, delayBetweenTests: number = 6000) { constructor(onProgress?: (result: TestResult) => void, delayBetweenTests: number = 8000) {
this.onProgress = onProgress; this.onProgress = onProgress;
this.delayBetweenTests = delayBetweenTests; // Default 6 seconds to prevent rate limiting this.delayBetweenTests = delayBetweenTests; // Default 8 seconds to prevent rate limiting
} }
/** /**
@@ -198,19 +198,53 @@ export class IntegrationTestRunner {
]; ];
for (let i = 0; i < suites.length; i++) { for (let i = 0; i < suites.length; i++) {
const isHeavySuite = submissionHeavySuites.includes(suites[i].name);
// PREEMPTIVE delay BEFORE heavy suites start (prevents rate limit buildup)
if (isHeavySuite && i > 0) {
const preemptiveDelayMs = 8000; // 8s "cooldown" before heavy suite
const delaySeconds = preemptiveDelayMs / 1000;
const delayResult: TestResult = {
id: `preemptive-delay-${Date.now()}`,
name: `⏳ Pre-suite cooldown: ${delaySeconds}s (preparing for ${suites[i].name})`,
suite: 'System',
status: 'running',
duration: 0,
timestamp: new Date().toISOString(),
details: {
reason: 'Preemptive rate limit prevention before submission-heavy suite',
nextSuite: suites[i].name
}
};
if (this.onProgress) {
this.onProgress(delayResult);
}
await this.delay(preemptiveDelayMs);
if (this.onProgress) {
this.onProgress({
...delayResult,
status: 'skip',
duration: preemptiveDelayMs,
details: { reason: 'Cooldown completed' }
});
}
}
await this.runSuite(suites[i]); await this.runSuite(suites[i]);
if (this.shouldStop) { if (this.shouldStop) {
break; break;
} }
// Add delay between suites with adaptive timing // REACTIVE delay AFTER suites complete
if (i < suites.length - 1 && this.delayBetweenTests > 0) { if (i < suites.length - 1 && this.delayBetweenTests > 0) {
// Longer delay after submission-heavy suites // Longer delay after submission-heavy suites
const isHeavySuite = submissionHeavySuites.includes(suites[i].name);
const delayMs = isHeavySuite const delayMs = isHeavySuite
? this.delayBetweenTests * 2 // 12s delay after heavy suites ? this.delayBetweenTests * 2.25 // 18s delay after heavy suites (increased from 12s)
: this.delayBetweenTests; // 6s delay after others : this.delayBetweenTests; // 8s delay after others (increased from 6s)
const delaySeconds = delayMs / 1000; const delaySeconds = delayMs / 1000;
const delayResult: TestResult = { const delayResult: TestResult = {