Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 4c4f717bd37db0e81b4c36309339ca6c40cbdf6a
parent 9d831764b194a57a074a10b4c6f01e18da0a5049
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sat, 21 Nov 2026 19:53:39 -0500

common: the Instagram pacing test settles its channels' report regenerations before it removes them

Every job's end asks for its channel's report: a refresh-report one second
later (the "fast" debounce), which writes into the channel's dir. The tests
take one to four seconds each, so at every reset the regeneration of the
last test's channels was still armed (seen: the timer set, the channels
dirty, at five of seven resets), and on a loaded full run it fired while the
next reset, or the final cleanup, was removing those dirs: ENOTEMPTY on the
channels the previous tests had fetched. reset() and the after hook now drop
the pending regeneration (resetSnapshotScheduler) and wait out any already
started before they remove anything.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mcommon/jobs/instagramPacing.test.ts | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/common/jobs/instagramPacing.test.ts b/common/jobs/instagramPacing.test.ts @@ -180,7 +180,22 @@ async function runCount(): Promise<number> { } } +// EVERY JOB'S END ASKS FOR ITS CHANNEL'S REPORT (jobs/snapshotScheduler.ts): +// a refresh-report a second later, which writes into the channel's dir. Left +// alone it lands in the next test's reset — or the final cleanup — while that +// removes the dir: ENOTEMPTY under a loaded run. Before either, the pending +// regeneration is dropped and any one already started is waited out. +const { resetSnapshotScheduler } = await import("./snapshotScheduler"); +const { getRegistry } = await import("./registry"); +async function settleReports(): Promise<void> { + resetSnapshotScheduler(); + const busy = () => getRegistry().list().some((j) => j.kind === "refresh-report" && (j.status === "queued" || j.status === "running")); + for (let i = 0; i < 400 && busy(); i += 1) await new Promise((r) => setTimeout(r, 25)); + assert.equal(busy(), false, "a channel report still regenerating after 10 s"); +} + async function reset(cookies: string | null = "firefox:ig-profile"): Promise<void> { + await settleReports(); clearQueueGaps(); cdn.length = 0; await rm(RUNS, { force: true }); @@ -194,6 +209,7 @@ async function readLog(jobId: string): Promise<string> { } test.after(async () => { + await settleReports(); await rm(ROOT, { recursive: true, force: true }); });