alonso.torres 62bcd022d3 🚧 Save Phase 4 random harness and grid fixes in progress
Save Stage 2 structure, text, geometry and layout generation, independent
oracle checks, frontend seeded replay and plugin visible-value checks.
Include pending grid sync and deletion fixes with focused regressions.

WIP validation: component sync 21 tests / 106 assertions; move shapes
6 tests / 33 assertions. Earlier plugin checks passed 68 full cases,
11 unit tests and types. The final generated replay, golden check,
5000-case gate, full suites and live WASM check remain unfinished.
Stages 3 (swaps/variants) and 4 (library files) have not started.

F124 benchmark ratios against Phase 1e: main 10/100/1000 copies
0.48/0.52/0.54; three levels 0.53; chain 0.56; library 0.52;
many shapes 0.42; variant switch 0.64. No regression flag.
The F125 deletion change still needs its final benchmark.

Save the detailed resume checklist and logs in the local stabilization
plan. Keep that workflow document out of the commit.

AI-assisted-by: GPT-6
2026-10-23 09:50:53 +02:00

30 lines
1.1 KiB
TypeScript

/**
* Timing utilities for the composable tests.
*/
export class PenpotSync {
/**
* Waits for component-change propagation to settle. Reads can otherwise race
* ahead of the propagation a preceding edit triggers. A deadline fails the operation instead of checking a partly synced file.
*/
static async awaitPropagation(timeoutMs = 10000): Promise<void> {
const api = penpot as typeof penpot & { waitForLayoutUpdate(): Promise<void> };
if (!api.waitForLayoutUpdate) {
throw new Error("PenpotSync.awaitPropagation: waitForLayoutUpdate is not available");
}
let timer: ReturnType<typeof setTimeout> | undefined;
try {
await Promise.race([
api.waitForLayoutUpdate(),
new Promise<never>((_, reject) => {
timer = setTimeout(
() => reject(new Error(`Component propagation did not settle in ${timeoutMs}ms`)),
timeoutMs
);
}),
]);
} finally {
clearTimeout(timer);
}
}
}