feat: credit the triggering chatter on the timewarp overlay#888
Open
dmerrick wants to merge 2 commits into
Open
feat: credit the triggering chatter on the timewarp overlay#888dmerrick wants to merge 2 commits into
dmerrick wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When a viewer runs
!timewarpor 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:
guessCmd/timewarpCmd→a.timewarp(ctx, user.Username)App.Onscreens.ShowTimewarp(ctx, username)→ onscreens-client publishestimewarp.showtimewarp.showgraduates from the emptyCommandenvelope to its ownTimewarpShow{Username}payload — exactly what theCommanddoc comment always anticipated for "any event that grows a field"handleTimewarpShowdecodes it and stores the username on the overlay'sContentContenton the showing rising-edge and renders@username, animating in with the wordmarkThe credit line is hidden (via
:emptyCSS) 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:TestHandleTimewarpShowasserts the username lands onContent; newTestHandleTimewarpShow_NoUsernamecovers the empty-envelope back-compat pathchatbot: therecordingOnscreensfake now captures the username;TestTimewarpCmd_*andTestGuessCmd_CorrectGuess_*assert the caller is creditedonscreens-client: publish-subject test updated for the new signatureAll four touched packages pass under
task test:macos. (pkg/serverhas a pre-existing unrelated build failure —renderProfileundefined, left over from the panel removal in #886 — untouched here.)Feature flag
The credit is gated behind the
chatbot.timewarp_creditfeature flag (evaluated inApp.timewarp()with the standardEvalContext). The warp itself always runs — only the credit line is gated, so the flag can never affect playback.FALSEper platform in migration021(one row per platform, per the019convention), so the credit ships off and stays off until verified on stream.STREAM_PLATFORMrows), this is exactly the lever for the "Twitch for now" note: enablechatbot.timewarp_creditontwitch, leaveyoutubeoff.TestTimewarpCmd_CreditFlagOff_NoUsernameproves 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.