Skip to content

Syndication: enforce DZone Friday-only rule and prune stale queue tasks#5245

Open
shai-almog wants to merge 1 commit into
masterfrom
fix-dzone-friday-only
Open

Syndication: enforce DZone Friday-only rule and prune stale queue tasks#5245
shai-almog wants to merge 1 commit into
masterfrom
fix-dzone-friday-only

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Problem

DZone (like Foojay) is supposed to receive only the weekly Friday digest post. But queue_browser_syndication.py queued every eligible post, so Monday's modern-advertising-api was queued for DZone and the browser drain tool submitted it to moderation.

The earlier Friday-only edit also never actually took effect, for two reasons:

  1. It was uncommitted/unpushed, so CI ran the old unfiltered code.
  2. Even live, it only filtered at enqueue time — the offending DZone task was already in the queue, and the drain tool submits whatever is in the queue.

Fix (two layers)

  • Enqueue filter: WEEKLY_FRIDAY_PLATFORMS gates which posts a Friday-only platform accepts (post.date.weekday() == 4), mirroring FoojayAdapter.accepts.
  • Queue prune: every run now drops already-queued tasks that the rules no longer allow (queued before the filter existed, or added by hand). This is what actually prevents a stray task from reaching moderation. A task whose post date is unknown is kept — never silently dropped.

Testing

  • Unit: stale Monday dzone: task → pruned; medium: → kept; Friday dzone: → kept; unknown slug → kept.
  • End-to-end against a seeded queue: the Monday DZone task is pruned, Medium retained.
  • py_compile clean.

🤖 Generated with Claude Code

DZone (like Foojay) should only receive the weekly Friday digest post, but
queue_browser_syndication.py queued every eligible post, so Monday's
modern-advertising-api was submitted to DZone moderation.

Two-part fix:
- Filter at enqueue time: WEEKLY_FRIDAY_PLATFORMS gates which posts a
  Friday-only platform accepts (post.date.weekday() == 4), mirroring
  FoojayAdapter.accepts.
- Prune at queue time: each run now drops already-queued tasks that the
  rules no longer allow. The browser drain tool submits whatever sits in
  the queue, so enqueue-time filtering alone could not stop a task that
  was queued before the filter existed (or added by hand).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant