---
title: Wire transaction-event-triggered refresh for league_team_player_seasonlogs
type: task
status: draft
description: >-
  Draft task to refresh league_team_player_seasonlogs per (lid, year) when qualifying transactions
  land, keeping the nightly cron as a backstop.
base_uri: user:task/league/wire-league-team-player-seasonlogs-event-refresh.md
created_at: '2026-05-19T17:51:27.586Z'
entity_id: efb628e9-ac46-49fa-9ac6-356ef6ec9c8e
observations:
  - ████████████████████████████████████████████████
owner_identity_uri: █████████████████████████
priority: Low
public_read: true
relations:
  - follows [[████████████████████-██████-████-██████-█████████████]]
  - relates [[███████████████████████-█████-█████████-████████]]
  - follows [[█████████████████████-██████-█████-███████-█████-██████████]]
tags:
  - user:tag/league-xo-football.md
  - user:tag/home-dynasty-league.md
updated_at: '2026-10-26T05:00:43.845Z'
visibility_analyzed_at: '2026-11-05T23:50:38.704Z'
---

## Background

`████████████████████████████████████████████████` ships a nightly cron and an optional weekly `--with-optimal` cron for `league_team_player_seasonlogs`. During a 2026-05-19 audit of `libs-server/` and `api/routes/` no general-purpose transaction-event hook surface was found in the xo.football codebase: `submit-acquisition.mjs`, `process-release.mjs`, `process-poach.mjs`, and the trade-processing routes all write `transactions` rows directly without emitting an in-process event or enqueuing a downstream job. Adding a generic event surface was out of scope for the shipping task.

## Scope

- Audit the codebase a second time, prioritizing API routes that record `TRADE`, `DRAFT`, `AUCTION_PROCESSED`, `EXTENSION`, `ROSTER_ADD`. Confirm absence (or surface what was missed).
- Design the smallest event surface that allows `generate-league-team-player-seasonlogs.mjs` to be enqueued per-league per-affected-season after qualifying transactions land.
- Implement and wire. Cap regeneration scope to the affected `(lid, year)` slice (the generator already supports this via `--lid --year`).
- Update the nightly cron registration to reflect that the table is now incrementally maintained, with nightly serving as a backstop.

## Notes

- Likely shape: a small `emit_transaction_event({ lid, type, pid, year, tid })` helper called alongside the `transactions` insert, with a per-event subscriber list living in `libs-server/transaction-events/`. Keep the dispatch synchronous-best-effort with try/catch so a regeneration failure cannot block the underlying transaction commit.
- Avoid building generic message-queue infrastructure for one consumer.
