fix(e2e): non-mutating reverse in CleanupRegistry

Array.reverse mutates in place — a defensive double-run() would have
re-reversed the items. Iterate over a copy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-05-28 19:41:42 +02:00
parent f4cd883d76
commit 79c8db2cb7

View File

@@ -32,7 +32,10 @@ export class CleanupRegistry {
if (this.items.length === 0) return;
const api = await adminApi();
try {
for (const item of this.items.reverse()) {
// Copy-then-reverse so a defensive double-`run()` (or a
// caller that inspects the registry after a partial
// teardown) doesn't see the items in a re-reversed order.
for (const item of [...this.items].reverse()) {
try {
await item(api);
} catch {