adventure: stay out of the room when TwinBee already said it

gogobee announces treasure finds, duels, mischief contracts and the
Siege to the games room in TwinBee's voice, and files the same moments
here as facts. Both land in the same room, so the realm heard every one
of them twice, in two voices, minutes apart.

Hold those types back from Matrix. They are stored and published on the
site exactly as before, and the push alerts still fire; only the live
priority beat and the digest sweep skip them, retired against the digest
the same way a no_push backfill is. Types with no room announce behind
them (zone clears, arrivals, deaths, milestones) are untouched and stay
Pete's to report.

room_silent_types overrides the default set; an explicit empty list
turns the suppression off.
This commit is contained in:
prosolis
2026-07-25 10:21:43 -07:00
parent 5b07199631
commit 15e229b6c3
4 changed files with 111 additions and 10 deletions
+26 -7
View File
@@ -76,6 +76,13 @@ const advSource = "Pete"
// Matrix; the row exists only so the digest skips it.
const advBackfillEvent = "adv-backfill"
// advRoomSilentEvent is the synthetic post_log event id used to retire a
// dispatch whose event type gogobee announces in the games room itself. Like
// advBackfillEvent it never went to Matrix; the row exists so the digest skips
// it, and the distinct id keeps "TwinBee said it" separable from "backfilled"
// when reading post_log later.
const advRoomSilentEvent = "adv-room-silent"
// handleAdventureIngest receives a game-event fact from gogobee, templates it
// into a deterministic story, publishes it to the /adventure section, and posts
// PRIORITY beats live to Matrix. Bearer-authed; idempotent on the fact GUID.
@@ -210,13 +217,25 @@ func (s *Server) handleAdventureIngest(w http.ResponseWriter, r *http.Request) {
slog.Info("adventure ingest: published", "guid", f.GUID, "event_type", f.EventType, "tier", f.Tier)
// NoPush (cold-start backfill) means "never goes to Matrix". Suppressing only
// the live post isn't enough: the digest collects adventure rows that carry no
// post_log entry, so a backfilled bulletin would still be swept into the next
// roundup — the back-catalogue dump NoPush exists to prevent. Retire the guid
// against the digest up front instead.
if f.NoPush {
storage.MarkAdventureDigested([]string{f.GUID}, advBackfillEvent)
// Two reasons a dispatch never reaches Matrix, both retired the same way:
//
// - NoPush: a cold-start backfill, the back-catalogue dump it exists to
// prevent.
// - A room-silent type: gogobee already announced this exact moment to the
// games room in TwinBee's voice, and relaying it is the room hearing one
// beat twice in two voices.
//
// Suppressing only the live post isn't enough: the digest collects adventure
// rows that carry no post_log entry, so a held-back bulletin would still be
// swept into the next roundup. Retire the guid against the digest up front
// instead. The row was stored above either way, so the site, the permalink
// and the push alerts keep the full record.
if f.NoPush || s.roomSilent[f.EventType] {
retiredAs := advBackfillEvent
if !f.NoPush {
retiredAs = advRoomSilentEvent
}
storage.MarkAdventureDigested([]string{f.GUID}, retiredAs)
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("ok"))
return