Skip to content

feat(runemetrics_scraper): emit players.banned on ban transition#155

Open
extreme4all-ai wants to merge 1 commit into
developfrom
feat/runemetrics-ban-emit
Open

feat(runemetrics_scraper): emit players.banned on ban transition#155
extreme4all-ai wants to merge 1 commit into
developfrom
feat/runemetrics-ban-emit

Conversation

@extreme4all-ai

Copy link
Copy Markdown
Contributor

⚠️ Stacked on #154 (base: feat/worker-ban-migration). Merge #154 first.

Summary

Implements PR 3 of the Report Data Retention & Ban Archival spec. This makes the end-to-end ban-archival pipeline live by emitting the players.banned event at the moment of detection.

The reactive trigger is what resolves the prune/migration race: by archiving at detection time (within the 90-day prune window), the location data is copied before the prune job (PR #153) can delete it.

Changes

  • runemetrics_scraper/core.py
    • main(): add a players.banned producer via QueueFactory (mirrors the existing players.scraped producer), started and passed into each work() task.
    • work(): capture old_label = player_data.label_jagex before update_player(), then emit a PlayerBannedStruct only on the transition old != 2 → new == 2.
  • test/.../runemetrics_scraper/test_core.py — parametrized transition matrix:
    old scrape result emits?
    1 NOT_A_MEMBER (→2)
    0 NOT_A_MEMBER (→2)
    2 NOT_A_MEMBER (→2)
    0 no error (→0)
    0 NO_PROFILE (→1)
    1 no error (→0)
    • Existing work() tests updated for the new player_banned_producer param.

After merge

The worker_ban_migration consumer (from #154) starts receiving events, and newly-detected Jagex bans are archived into report_archive. Historical banned players remain uncovered until PR 4 (backfill).

Test plan

  • uv run ruff check — clean
  • uv run pytest test/bases/bot_detector/runemetrics_scraper/ — 19 passed (6 new transition cases)

Implements PR 3 of the report-data-retention spec — makes the end-to-end
ban-archival pipeline live by emitting the players.banned event at the moment
of detection.

- core.main(): add players.banned producer (QueueFactory, mirrors players.scraped)
- core.work(): capture old label_jagex before update_player; emit
  PlayerBannedStruct only on the transition old != 2 -> new == 2
- tests: parametrized transition matrix — emits on 0->2 and 1->2, no emit on
  2->2, 0->0, 0->1, or non-ban successes

Stacked on PR 2 (needs PlayerBannedStruct + players.banned topic). After merge
the worker_ban_migration consumer activates and newly-detected bans are
archived into report_archive.
@extreme4all-ai extreme4all-ai force-pushed the feat/runemetrics-ban-emit branch from e7a5f43 to 78674f2 Compare July 9, 2026 22:25
@extreme4all-ai extreme4all-ai changed the base branch from feat/worker-ban-migration to develop July 9, 2026 22:26
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