commit be043b961d9997af184d1b38b83a04b3439a0693
parent a81051b9a44607e3edf15cd3cdd4406733d9717e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 21 Nov 2026 19:06:47 -0500
common: the trending cooldown test pins the one X stop (a clean answer does not end it)
The x-sittings lane ruled that a 429 from any X reader records ONE 15-minute
X stop and that nothing but the operator's confirmed "Clear the X stop" ends
it early. The test still expected a clean answer to settle the trending
read's cooldown. The code already honours the ruling: recordPlatformCooldown
on twitter is recordXStop, xTrendingHeld reads that same entry, and
clearBackoff keeps a running stop. The test now pins it: the read's cooldown
is the stop the guard reads (xStopRemainingMs), a clean answer and Clear hold
leave it, an unconfirmed clear removes nothing, a confirmed one ends it.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/common/controller/xTrendingCooldown.test.ts b/common/controller/xTrendingCooldown.test.ts
@@ -1,6 +1,7 @@
// X's cooldown after a trending read met a rate limit (lane x-trending, review
// 1 SHOULD 5), on the real state file of a temp corpus: 15 minutes on the
-// `twitter` platform entry, read back by the read's own held check.
+// `twitter` platform entry — X's one stop (lane x-sittings) — read back by the
+// read's own held check.
//
// Run with: pnpm --filter yt-dlp-transcript-common exec tsx --test controller/xTrendingCooldown.test.ts
@@ -16,10 +17,16 @@ writeFileSync(path.join(ROOT, "settings.json"), "{}");
after(() => rmSync(ROOT, { recursive: true, force: true }));
const { getPaths } = await import("../lib/paths");
-const { platformCooldownRemainingMs, recordPlatformClean, recordPlatformCooldown } = await import("../jobs/downloadBackoff");
+const { clearXStop, clearPlatformHold, platformCooldownRemainingMs, recordPlatformClean, recordPlatformCooldown, xStopRemainingMs } = await import(
+ "../jobs/downloadBackoff"
+);
const { X_RATE_LIMIT_HOLD_MS, xTrendingHeld } = await import("./readXTrending");
-test("no cooldown: a read may start; after a 429: refused until the minute it names; a clean answer settles it", async () => {
+// THE ONE X STOP (lane x-sittings): a trending read's 429 is X's 15-minute
+// stop, the same entry every X job's guard reads — not a cooldown of the
+// read's own — and NOTHING ends it early but the operator's "Clear the X
+// stop" (clearXStop, confirmed): not a clean answer, not Clear hold.
+test("no cooldown: a read may start; after a 429: refused until the minute it names; only the operator's clear ends it early", async () => {
const paths = getPaths();
assert.equal(await xTrendingHeld(paths), null);
const now = Date.now();
@@ -37,8 +44,25 @@ test("no cooldown: a read may start; after a 429: refused until the minute it na
assert.equal(await platformCooldownRemainingMs("bluesky", paths), 0);
// A second, shorter cooldown never brings the end forward.
assert.equal(await recordPlatformCooldown("twitter", 60_000, paths, now), until);
+ // It is the X stop itself, as the guard of every X job reads it.
+ const stop = await xStopRemainingMs(paths, now);
+ assert.equal(stop, until - now);
+ // A clean answer does not clear it, nor does Clear hold: the read stays refused.
await recordPlatformClean("twitter", paths);
- assert.equal(await xTrendingHeld(paths), null);
+ assert.equal(await xStopRemainingMs(paths, now), stop);
+ assert.ok(await xTrendingHeld(paths, now));
+ await clearPlatformHold("twitter", paths);
+ assert.equal(await xStopRemainingMs(paths, now), stop);
+ assert.ok(await xTrendingHeld(paths, now));
+ // The operator's clear, unconfirmed, removes nothing.
+ const asked = await clearXStop(paths, { confirm: false, by: "test", now });
+ assert.equal(asked.ok, false);
+ assert.ok(await xTrendingHeld(paths, now));
+ // Confirmed, it ends the stop, and a read may start again.
+ const cleared = await clearXStop(paths, { confirm: true, by: "test", now });
+ assert.ok(cleared.ok && cleared.cleared?.until === until);
+ assert.equal(await xStopRemainingMs(paths, now), 0);
+ assert.equal(await xTrendingHeld(paths, now), null);
});
// Review 2 N4: a clean trending read settles nothing on the platform. The