commit bdd7d9395d35a9fdbf8c2259772576b90f332bbe
parent 00cefdd5e4517b54d9ac8cb381c646d5c618d979
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 18 Nov 2026 15:46:11 -0500
review 1 nits: a restart never re-queues an Instagram job; the deleted-posts sweep says it is not built for Instagram; the env record names who reads E2E_TEST_ROUTES
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
5 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/common/controller/checkPostAvailability.ts b/common/controller/checkPostAvailability.ts
@@ -104,6 +104,13 @@ export function selectPostsToCheck(
return candidates.slice(0, Math.max(0, limit));
}
+// Instagram (lane instagram): there is one way to read it and it has no
+// per-post liveness probe yet — "switch the scraping method" would be advice
+// with nowhere to go.
+export const INSTAGRAM_NO_AVAILABILITY_CHECK =
+ "Instagram posts are not checked for deletion yet: a check is a logged-in request per post, and comes with a later slice. " +
+ "Nothing was asked of Instagram, and nothing is marked deleted.";
+
export async function checkPostAvailability(
opts: CheckPostAvailabilityOptions,
): Promise<CheckPostAvailabilityResult> {
@@ -150,6 +157,9 @@ export async function checkPostAvailability(
if (!fetcher) {
return { ok: false, ...empty, error: `No post fetcher configured for ${slug}.` };
}
+ if (fetcher.platform === "instagram") {
+ return { ok: false, ...empty, error: INSTAGRAM_NO_AVAILABILITY_CHECK };
+ }
if (!fetcher.checkAvailability) {
// Better to say so than to guess. gallery-dl, for instance, has no cheap
// per-post liveness probe, so its channels should switch fetcher to sweep.
diff --git a/common/jobs/instagramPacing.test.ts b/common/jobs/instagramPacing.test.ts
@@ -119,6 +119,7 @@ const { runManagedFunction } = await import("./streamCommand");
const { fetchPosts, fetcherPlatformMismatch, INSTAGRAM_ONLY_AS_A_JOB, INSTAGRAM_RETRY_REFUSAL } = await import("../controller/fetchPosts");
const { runInJobContext } = await import("../lib/jobContext");
const { capturePosts } = await import("../controller/capturePosts");
+const { checkPostAvailability, INSTAGRAM_NO_AVAILABILITY_CHECK } = await import("../controller/checkPostAvailability");
const { getSettings } = await import("../lib/settings");
const { setQueueGapClock, clearQueueGaps } = await import("./queueGap");
const { readServiceCookieState, serviceCookiesFile } = await import("../lib/serviceCookies-server");
@@ -229,6 +230,10 @@ test("a channel with no cookie source of its own is refused, and gallery-dl neve
assert.equal(fetcherPlatformMismatch("x", { platform: "twitter" }, { platform: "twitter", label: "X", id: "x-gallery-dl" }), null);
assert.equal(fetcherPlatformMismatch("x", { url: "https://x.com/example" }, { platform: "twitter", label: "X", id: "x-nitter" }), null);
assert.equal(fetcherPlatformMismatch("x", {}, { platform: "bluesky", label: "B", id: "b" }), null, "a channel that names no platform is not judged");
+ // The deleted-posts sweep says it is not built for Instagram, and asks nothing.
+ const sweep = await checkPostAvailability({ paths, slug: SLUGS[0] });
+ assert.deepEqual([sweep.ok, sweep.error], [false, INSTAGRAM_NO_AVAILABILITY_CHECK]);
+ assert.equal(await runCount(), 0);
// capture-posts takes no screenshot of an Instagram post and asks nothing.
const cap = await capturePosts({ paths, slug: SLUGS[0], settings: {}, ids: ["3500000000000000001"] } as never);
assert.equal(cap.ok, false);
diff --git a/common/jobs/resumeInterrupted.test.ts b/common/jobs/resumeInterrupted.test.ts
@@ -232,3 +232,25 @@ test("the boot's running pass then the resume: what it closed is what it resumes
await rm(fx.root, { recursive: true, force: true });
}
});
+
+// Lane instagram: a restart never asks Instagram.
+test("an interrupted Instagram fetch is not re-queued by a boot: it waits for the next scheduled or pressed sync", async () => {
+ const spec: JobSpec = { kind: "fetch-posts", slug: "example-ig", params: {} };
+ const fx = await fixture([
+ { id: "IG1", kind: "fetch-posts", queueKey: "platform:instagram", channelSlug: "example-ig", spec },
+ { id: "X1", kind: "fetch-posts", queueKey: "platform:twitter", channelSlug: "example-x", spec: { kind: "fetch-posts", slug: "example-x", params: {} } },
+ ]);
+ try {
+ const { calls, requeue } = recorder();
+ const out = await resumeInterruptedJobs({ paths: fx.paths, requeue, ids: ["IG1", "X1"], now: NOW });
+ const ig = out.find((o) => o.id === "IG1")!;
+ assert.equal(ig.action, "not-resumed");
+ assert.match((ig as { reason: string }).reason, /an Instagram job is not started by a restart/);
+ // X's fetch resumes as it did.
+ assert.equal(out.find((o) => o.id === "X1")!.action, "resumed");
+ assert.deepEqual(calls.map((c) => c.slug), ["example-x"]);
+ assert.match((await fx.read("IG1")).cancelReason ?? "", /not resumed: an Instagram job is not started by a restart/);
+ } finally {
+ await rm(fx.root, { recursive: true, force: true });
+ }
+});
diff --git a/common/jobs/resumeInterrupted.ts b/common/jobs/resumeInterrupted.ts
@@ -47,6 +47,11 @@ import { runWithResumeTag } from "./resumeTag";
// is "interrupted twice in a row" and is left for the operator.
export const MAX_RESUMES_IN_A_ROW = 1;
+// Instagram's queue, and why a job interrupted on it is left.
+export const INSTAGRAM_QUEUE_KEY = "platform:instagram";
+export const INSTAGRAM_NOT_RESUMED =
+ "an Instagram job is not started by a restart — its place is saved, and the next scheduled sync (or a press) continues from it";
+
// How far back the by-hand command looks (the boot looks only at what it just
// closed).
export const RESUME_WINDOW_MS = 24 * 60 * 60 * 1000;
@@ -177,6 +182,14 @@ export async function resumeInterruptedJobs(opts: ResumeInterruptedOpts): Promis
await decline(meta, "kind", `${jobKindLabel(meta.kind)} does not resume on a re-run`);
continue;
}
+ // AN INSTAGRAM JOB IS NEVER STARTED BY A RESTART (lane instagram): every
+ // one is a logged-in read, and a boot that re-queued it would ask
+ // Instagram at a moment nobody chose. Its resume point is on disk; the
+ // next scheduled sync, or a press, continues from it.
+ if (meta.queueKey === INSTAGRAM_QUEUE_KEY) {
+ await decline(meta, "not-resumable", INSTAGRAM_NOT_RESUMED);
+ continue;
+ }
if (!meta.spec) {
await decline(meta, "no-spec", "it has no replay descriptor");
continue;
diff --git a/common/lib/envVars.ts b/common/lib/envVars.ts
@@ -228,7 +228,7 @@ const DECLARED: EnvVarDecl[] = [
{ name: "ARCHILYZER_NO_NETWORK_LOG", audience: "internal", default: "unset (no log)", readBy: "common/lib/noNetwork.mjs", doc: "A file. Under `ARCHILYZER_NO_NETWORK`, each refused door adds one JSON line to it: the door, the target and the process's argv. It finds the tests that reach for the network even when their code swallows the failure." },
{ name: "DO_NOT_TRACK", audience: "internal", default: "unset", readBy: "common/lib/noNetwork.mjs", doc: "The common opt-out of CLI telemetry. Set to `1` for the run's children when `ARCHILYZER_NO_NETWORK` is on, unless already set." },
{ name: "HYPERFRAMES_NO_TELEMETRY", audience: "internal", default: "unset (HyperFrames sends usage telemetry)", readBy: "common/lib/noNetwork.mjs (for the HyperFrames CLI umtool renders through)", doc: "`1`: the HyperFrames CLI sends no telemetry. Set to `1` for the run's children when `ARCHILYZER_NO_NETWORK` is on, unless already set. Outside test runs, nothing sets it." },
- { name: "E2E_TEST_ROUTES", audience: "test", default: "off", readBy: "editor/app/api/test/_guard.ts, editor/instrumentation.ts", doc: "`1` opens the editor's `/api/test/*` routes and marks a test server at boot. Set by `editor/playwright.config.ts` on its test server, and by nothing else." },
+ { name: "E2E_TEST_ROUTES", audience: "test", default: "off", readBy: "editor/app/api/test/_guard.ts, editor/instrumentation.ts, common/social/instagramMedia.ts, common/social/fakeXProfileBrowser.ts", doc: "`1` opens the editor's `/api/test/*` routes and marks a test server at boot. Under it Instagram's media CDN is played back, never asked (`fakeInstagramMediaDeps`). Set by `editor/playwright.config.ts` on its test server, and by nothing else." },
{ name: "E2E_MODE", audience: "test", default: "`start`", readBy: "editor/playwright.config.ts, umtool/playwright.config.ts, scripts/e2e-stamp.mjs", doc: "`start`: the editor and umtool suites run against `next start` from a build `scripts/e2e-stamp.mjs` vouches for, rebuilt through the heavy slot when the tree moved. `dev`: against `next dev`, for iterating on one spec. The export and homepage suites always run `next dev` (static exports) and say so when asked for `start`." },
{ name: "E2E_NEXT_DIST_DIR", audience: "test", default: "`.next`", readBy: "editor/next.config.ts, export/next.config.ts", doc: "The editor's build directory for the e2e suite's start mode (`.next/e2e`), so a test build never replaces the `.next` a running editor serves from. Set by `scripts/e2e-stamp.mjs` for its build and by `editor/playwright.config.ts` for its test server — and for the editor suite's export dev server (`.next/e2e-editor`), which then runs beside the export suite's own (Next allows one `next dev` per dist dir)." },
{ name: "E2E_MODEL_LOG_SHOTS", audience: "test", default: "unset (no screenshots)", readBy: "umtool/e2e/model-log.spec.ts, editor/e2e/report-draft.spec.ts", doc: "A directory: the model log's e2e (demo epic D3) saves its 1366×768 screenshots of the panel there — the run page live and done, a call opened, the Iterations tab, a media draft, the settings table, the editor's job page — for a lane's report. Unset, none is taken." },