Skip to content

LVT-382: Preserve event freshness during scheduled worker runs - #133

Merged
jackshim415 merged 3 commits into
mainfrom
codex/lvt-382-railway-rollout
Nov 19, 2026
Merged

jackshim415 merged 3 commits into
mainfrom
codex/lvt-382-railway-rollout

Conversation

@jackshim415

Copy link
Copy Markdown
Contributor

What changed

Cron rollout needs to preserve minute-level freshness for the November 21 event without relying on a manual event-day switch. Add WORKER_MODE=scheduled: six-hour Cron starts drain a finite batch outside competition dates, keep the continuous loop running during event-local competition dates, and drain/exit when all current event dates end. A catalog batch discovering an active event enters continuous mode immediately.

IaC requires six-hour Cron for scheduled mode. Daily batch and standalone continuous modes retain their existing behavior. Record live production resource/latency baselines and the isolated verification setup.

Areas affected

  • Worker
  • Shared documentation, CI, or deployment

Contracts and data

  • No API, report-schema, authentication, deep-link, season-metric, or database contract changed
  • Tenant and source-team visibility was reviewed
  • No credentials, production data, or private scouting notes are included

Verification

  • Worker typecheck and 72 tests passed against disposable local PostgreSQL.
  • IaC typecheck and six graph tests passed.
  • Repository structure and git diff --check passed.
  • Railway sleep/cold-start/queue tests continue in the dedicated lvt-382-verification environment. Production Cron remains unchanged until those gates pass.

Deployment

No migrations or Railway credentials in Worker. Use both local IaC inputs RAILWAY_WORKER_CRON='0 */6 * * *' and RAILWAY_WORKER_MODE=scheduled for the current upcoming-event window. Production Postgres already has sleep enabled; actual sleep and billing evidence is still pending. Related: LVT-382, implementation PR #132.

Six-hour Cron starts enter the minute-level event loop on local competition dates, then drain and exit when events finish. This makes the November rollout safe without a manual event-day mode switch. Record the production baseline and private preview verification setup.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T16:41:11.119461Z 8f545af PR opened
🔒 Security Review ✅ Completed 2026-11-19T16:41:03.273608Z 8f545af PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@railway-app

railway-app Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the lovat-pr-133 environment in lovat

Service Status Web Updated
api ✅ Success (View Logs) Web Nov 19, 2026 at 4:49 pm UTC
worker ✅ Success (View Logs) Nov 19, 2026 at 4:49 pm UTC
website ✅ Success (View Logs) Web Nov 19, 2026 at 4:49 pm UTC
learn 😴 Sleeping (View Logs) Web Nov 19, 2026 at 4:48 pm UTC
dashboard 😴 Sleeping (View Logs) Web Nov 19, 2026 at 4:47 pm UTC
1 service not affected by this PR
  • support

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Lovat AI review

Status: completed · Model: z-ai/glm-5.3-flash · Findings: 0

Reviewed commit: 02b28d75d1ea365002ed4e136628bfb3ad086244

Critical: 0 · High: 0 · Medium: 0 · Low: 0

Overall assessment

The pull request successfully implements a new scheduled worker mode to handle event-aware, finite runs, which is critical for preserving event freshness. The logic in apps/worker/src/scheduled-window.ts correctly manages the transition from batch processing to continuous mode and subsequent shutdown. No functional defects, security vulnerabilities, or database misuse were identified in the provided changes.

No high-confidence issues were found in the reviewed changes.

Review details

  • Review batches: 1
  • Diff characters reviewed: 21,433
  • Tokens: 8,007 prompt + 3,015 completion
  • Estimated inference cost: $0.0018

Limitations

  • The reviewer examined only changed lines and their diff context, not the whole repository.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f545af3ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/worker/src/scheduled-window.ts Resolved
@github-actions

Copy link
Copy Markdown
Contributor

📱 Connect your app to this PR deployment

Scan a QR code to use this PR's Server API. Worker changes use the same API;
the Worker has no public app endpoint.

Server URL: https://api-lovat-pr-133.up.railway.app

Lovat Collection

QR code — Lovat Collection

lovat-collection://set-url?u=https%3A%2F%2Fapi-lovat-pr-133.up.railway.app

Lovat Dashboard

QR code — Lovat Dashboard

com.frc8033.lovatdashboard:///set-url?u=https%3A%2F%2Fapi-lovat-pr-133.up.railway.app

github-actions[bot]

This comment was marked as outdated.

@railway-app
railway-app Bot temporarily deployed to lovat / lovat-pr-133 November 19, 2026 16:48 Destroyed

@jackshim415 jackshim415 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed event-local transitions, stopping batch claims on active-event discovery, draining and production/rollback IaC defaults. The discovery/backlog finding is fixed and tested; the suggestion to leave a Cron process's Prisma pool open was rejected because each execution owns and must close its pool. Required CI, Worker and IaC checks pass; local verification includes 73 Worker and seven IaC tests. The isolated Railway batch completed in 25.7 seconds, maintenance and a season import succeeded, failed imports retained retry delays, and Worker has zero running replicas. Production Cron is staged only; activation remains gated on the final preview sleep/wake request.

@jackshim415
jackshim415 merged commit 7df804b into main Nov 19, 2026
26 checks passed

This branch is being deployed

1 in progress deployment
lovat / lvt-382-verification — 02b28d75 Deployed Nov 19, 2026 by railway-app[bot]
lovat / lovat-pr-133 — 02b28d75 Deployed Nov 19, 2026 by railway-app[bot]
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