Skip to content

Feat/summary readiness gate - #1

Merged
mikezupper merged 3 commits into
mainfrom
feat/summary-readiness-gate
May 29, 2026
Merged

Feat/summary readiness gate#1
mikezupper merged 3 commits into
mainfrom
feat/summary-readiness-gate

Conversation

@mikezupper

Copy link
Copy Markdown
Contributor

No description provided.

mikezupper and others added 3 commits May 29, 2026 11:00
Daily/weekly/monthly summaries were posted the moment the period closed,
before the explorer finished indexing/enriching/deriving it — yielding
"0 winning tickets / 0 ETH" rollups that were then permanently watermarked
and never corrected.

Gate each post behind, in order:
1. Settlement floor — never post before period_close + settle_<cadence>.
2. Enrichment — usd_rows_priced >= ticket_count.
3. Local cross-check — rollup ticket_count must be >= the WinningTicketRedeemed
   events the bot already ingested for the window.
4. Stability — figures unchanged since the previous poll (summary_snapshots).

The watermark is written only on a ready (or backstop) post. Past
SUMMARY_MAX_DEFER_SECS a period posts anyway with an "incomplete" footer
rather than being skipped silently. New settle/defer env vars are optional
and default to 6h/12h/24h/48h.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI's clippy step (run with -D warnings) has been red on main, unrelated to
the summary readiness work:
- orchestrator.rs: move period_window above the #[cfg(test)] mod tests block
  (items_after_test_module)
- tests/embeds.rs: allow too_many_arguments on the stored_event_fixture_at
  test helper

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…scribe

Subscriptions were silently DELETED after DM_FAILURE_AUTO_UNSUB consecutive
DM 403s (Discord "Cannot send messages to this user" — DMs disabled, no
mutual guild, or blocked bot). Users lost subscriptions days later with no
notice and no way to tell why.

Now the row is retained and a dm_blocked flag is raised instead:
- migration 0005 adds subscriptions.dm_blocked
- repo: set_dm_blocked(), clear_dm_failure() also clears the flag, all
  SELECTs hydrate dm_blocked via a shared row mapper
- reward_poller / subscriber_digest_poster: flag instead of delete, and
  log the Discord JSON error code (50007 = privacy/no-mutual-guild)
- discord_bot: DmError::DmsClosed now carries the error code
- /subscriptions surfaces "⚠️ DM-blocked" with a fix-your-settings hint
- /subscribe warns up front that notifications are DMs and require
  server-member DMs enabled

Delivery and the flag clear automatically on the next successful DM.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mikezupper
mikezupper merged commit 55d6533 into main May 29, 2026
2 checks passed
@mikezupper
mikezupper deleted the feat/summary-readiness-gate branch May 29, 2026 15:54
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