Skip to content

feat: credit the triggering chatter on the timewarp overlay#888

Open
dmerrick wants to merge 2 commits into
developfrom
feat/timewarp-credit-username
Open

feat: credit the triggering chatter on the timewarp overlay#888
dmerrick wants to merge 2 commits into
developfrom
feat/timewarp-credit-username

Conversation

@dmerrick

@dmerrick dmerrick commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

What

When a viewer runs !timewarp or guesses the state correctly with !guess, their username now appears as a credit line under the TIMEWARP wordmark on the full-screen warp overlay (e.g. @viewer1).

How it flows

The username travels the existing onscreens NATS command surface end-to-end:

  1. guessCmd / timewarpCmda.timewarp(ctx, user.Username)
  2. App.Onscreens.ShowTimewarp(ctx, username) → onscreens-client publishes timewarp.show
  3. timewarp.show graduates from the empty Command envelope to its own TimewarpShow{Username} payload — exactly what the Command doc comment always anticipated for "any event that grows a field"
  4. onscreens-server's handleTimewarpShow decodes it and stores the username on the overlay's Content
  5. the browser source reads Content on the showing rising-edge and renders @username, animating in with the wordmark

The credit line is hidden (via :empty CSS) when no username is attributable, so the warp still plays cleanly for any caller without a user — and the decode is lenient, so the old empty-envelope wire shape still triggers the warp (just with no credit).

Platform note

This is platform-agnostic plumbing — whatever username the chat command carries gets credited. In practice that's Twitch for now; if/when the YouTube bot runs these interactive commands, it'll credit YouTube chatters too with no further changes.

Tests

  • onscreens-server: TestHandleTimewarpShow asserts the username lands on Content; new TestHandleTimewarpShow_NoUsername covers the empty-envelope back-compat path
  • chatbot: the recordingOnscreens fake now captures the username; TestTimewarpCmd_* and TestGuessCmd_CorrectGuess_* assert the caller is credited
  • onscreens-client: publish-subject test updated for the new signature

All four touched packages pass under task test:macos. (pkg/server has a pre-existing unrelated build failure — renderProfile undefined, left over from the panel removal in #886 — untouched here.)

Feature flag

The credit is gated behind the chatbot.timewarp_credit feature flag (evaluated in App.timewarp() with the standard EvalContext). The warp itself always runs — only the credit line is gated, so the flag can never affect playback.

  • Seeded FALSE per platform in migration 021 (one row per platform, per the 019 convention), so the credit ships off and stays off until verified on stream.
  • Because the flag client is platform-scoped (each bot loads only its STREAM_PLATFORM rows), this is exactly the lever for the "Twitch for now" note: enable chatbot.timewarp_credit on twitch, leave youtube off.
  • New tests: TestTimewarpCmd_CreditFlagOff_NoUsername proves the warp still fires with no credit when the flag is off; the existing timewarp/guess tests enable the flag and assert the caller is credited.

dmerrick and others added 2 commits June 18, 2026 14:01
When a user runs !timewarp or guesses the state correctly, surface their
username as a credit line under the TIMEWARP wordmark on the full-screen
warp overlay.

The username rides from the chat command through the onscreens NATS
command surface: timewarp.show graduates from the empty Command envelope
to its own TimewarpShow{Username} payload (as the Command doc comment
always anticipated), onscreens-server stores it on the overlay's Content,
and the browser source renders it as "@username" — animating in with the
wordmark and hidden (via :empty) when no username is attributable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wrap the on-overlay username credit in the chatbot.timewarp_credit
feature flag, evaluated in App.timewarp() with the standard EvalContext
(username / channel / env). The warp itself always runs; only the credit
line is gated, so flipping the flag never affects playback.

Seeded FALSE per platform (migration 021, one row per platform per the
019 convention) so the credit stays off until verified on stream — and
because the flag client is platform-scoped, it can be enabled on Twitch
while staying off on YouTube.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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