mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 09:31:13 -05:00
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:
@@ -53,9 +53,9 @@ export class IntegrationTestRunner {
|
||||
private onProgress?: (result: TestResult) => void;
|
||||
private delayBetweenTests: number;
|
||||
|
||||
constructor(onProgress?: (result: TestResult) => void, delayBetweenTests: number = 6000) {
|
||||
constructor(onProgress?: (result: TestResult) => void, delayBetweenTests: number = 8000) {
|
||||
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++) {
|
||||
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]);
|
||||
|
||||
if (this.shouldStop) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Add delay between suites with adaptive timing
|
||||
// REACTIVE delay AFTER suites complete
|
||||
if (i < suites.length - 1 && this.delayBetweenTests > 0) {
|
||||
// Longer delay after submission-heavy suites
|
||||
const isHeavySuite = submissionHeavySuites.includes(suites[i].name);
|
||||
const delayMs = isHeavySuite
|
||||
? this.delayBetweenTests * 2 // 12s delay after heavy suites
|
||||
: this.delayBetweenTests; // 6s delay after others
|
||||
? this.delayBetweenTests * 2.25 // 18s delay after heavy suites (increased from 12s)
|
||||
: this.delayBetweenTests; // 8s delay after others (increased from 6s)
|
||||
|
||||
const delaySeconds = delayMs / 1000;
|
||||
const delayResult: TestResult = {
|
||||
|
||||
Reference in New Issue
Block a user