Skip to content

fix(jobs): takedown.ts — single-channel domain stays active forever after 3 permanent provider failures, no escalation #211

Description

@walidboulanouar

Problem

In packages/jobs/src/takedown.ts, a domain's status is only promoted to taken_down if filed > 0:

if (filed > 0) {
  await db.update(schema.domains).set({ status: 'taken_down' })...;
}
// ← no else branch for all-channels-failed case

If a domain has only one channel and it permanently returns 404 (registrar not found), all 3 Trigger.dev maxAttempts exhaust with identical permanent failures. The domain stays status: 'active' indefinitely. No alert, no escalation, no status: 'takedown_failed' state. The org's dashboard shows the domain as unactioned forever.

Fix

After all retries exhausted and filed === 0, set a terminal failure status and notify:

if (filed === 0 && channels.length > 0) {
  await db.update(schema.domains)
    .set({ status: 'takedown_failed' })
    .where(eq(schema.domains.id, domain.id));
  // Alert org via Knock: 'takedown.all_channels_failed'
}

Requires adding 'takedown_failed' to the domainStatusEnum.

Severity

MEDIUM — piracy domains silently remain active if all channels permanently fail; org has no visibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions