Skip to content

feat(pinballmap): weekly sync report to Discord (PP-5qwx) - #2323

Draft
timothyfroehlich wants to merge 5 commits into
mainfrom
feat/PP-5qwx-sync-report
Draft

timothyfroehlich wants to merge 5 commits into
mainfrom
feat/PP-5qwx-sync-report

Conversation

@timothyfroehlich

Copy link
Copy Markdown
Owner

Summary

Implements docs/feature-specs/pinballmap-sync-report.md (spec merged in #2317).

  • Admin → Integrations → Pinball Map gets a Sync report channel field under Region alerts, with the same save-time Discord check, Send test message, and status readout (spec §2). The inline Discord channel check and test-send logic move into shared helpers both channels use (src/lib/discord/channel-check.ts, sendChannelTest).
  • Cron /api/cron/pinballmap-sync-report is scheduled at 0 23 * * 1 and 0 0 * * 2 (UTC). Only the run that reads Monday 18:xx in America/Chicago posts, so the report lands at 6 PM Central year-round (§3.1). The run claims the week (sync_report_last_week) before posting, so the other slot and Vercel's occasional duplicate delivery are no-ops (§3.3); a failed post is not retried (§3.4).
  • Content comes from loadLineupData() — the loader /m/pinball-map and the /m badge use — so counts always match; no Pinball Map calls (§4.1, CORE-PBM-001). Message copy is the version Tim approved in-session (recorded on PP-5qwx). Link previews suppressed; attribution links the tracked location (§4.8).
  • Migration 0098: five nullable/defaulted columns on pinballmap_state plus a status CHECK. Additive only.
  • No new env vars.

Screenshots

To follow (desktop / 430 / 320) — awaiting Tim's UI sign-off.

Test plan

  • pnpm run check
  • pnpm run preflight (2985 passed)
  • Unit: message formatter against approved copy, 2000-char cap, sanitization; schedule across CDT/CST
  • Integration: run posts once per week, off-slot no-op, no retry after failure, skip states; admin save/test actions for the new channel; region alert tests on the shared helpers
  • Manually saved a channel locally in Admin → Integrations

🤖 Generated with Claude Code

Posts the lineup page's review state to a configured Discord channel every
Monday at 6 PM Central (pinballmap-sync-report spec).

- Migration 0098: pinballmap_state gains the sync report channel, its status,
  last post time, and the claimed report week.
- /api/cron/pinballmap-sync-report runs at 23:00 UTC Monday and 00:00 UTC
  Tuesday; only the run that is 6 PM in America/Chicago posts, and it claims
  the week first so the other slot and duplicate deliveries are no-ops.
- Reads stored data through loadLineupData(), so its counts match
  /m/pinball-map and the /m badge; never calls Pinball Map (CORE-PBM-001).
- Admin Integrations > Pinball Map gets a Sync report channel field with
  the region-alert channel's save check, test message, and status readout.
  The Discord channel check and test send move into shared helpers both
  channels use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pin-point Ready Ready Preview Oct 1, 2026 12:57pm UTC

Request Review

timothyfroehlich and others added 2 commits October 1, 2026 07:50
- Keep the attribution footer when the length fallback trims the body.
- Share DISCORD_MAX_MESSAGE_LENGTH and truncateDiscordLabel from
  ~/lib/discord/messages instead of copying them per formatter.
- Channel-generic names for the shared admin types (DiscordChannelStatus,
  SaveDiscordChannelActionResult, SendDiscordChannelTestActionResult).
- Check the schedule before reading state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent (PP-5qwx)

Region alert and sync report saves ran as two concurrent transitions that
each set the shared announcement, so a success on one could overwrite a
failure on the other. One transition now saves whichever changed and
reports the combined outcome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — b2c1551d Deployed Oct 1, 2026 by vercel[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