Skip to content

claude code vibe feat(nudges): unified registry-driven nudge framework#315

Open
functionstackx wants to merge 1 commit intomasterfrom
claude/issue-271-20260505-0421
Open

claude code vibe feat(nudges): unified registry-driven nudge framework#315
functionstackx wants to merge 1 commit intomasterfrom
claude/issue-271-20260505-0421

Conversation

@functionstackx
Copy link
Copy Markdown
Contributor

Closes #271.

Replaces eight one-off engagement-nudge implementations (banners, modals, toasts) with a single registry-driven framework. Each nudge declares its trigger, audience, dismissal behavior, persistence policy, and optional schedule in one place; the framework handles route matching, exclusivity, storage, and analytics uniformly.

Migrated nudges (10 original files deleted)

  • launch-banner-dsv4 — banner, landing, forever
  • dsv4-launch-modal — modal, landing, forever, priority 100
  • github-star-modal — modal, landing, 1-week cooldown, priority 50
  • reproducibility-nudge — toast, dashboard, session
  • star-nudge — toast, event-triggered, session
  • export-nudge — toast, copy-on-tooltip, session
  • gradient-label-nudge — toast, event-triggered, session
  • eval-samples-nudge — toast, /evaluation, 1-week cooldown

Framework capabilities

  • Declarative triggers: mount, mount-delay, or event with per-event thresholds, window/document targets, optional CSS selector matching (used for copy-on-chart-tooltip), optional debounce
  • Persistence policies: session, forever, cooldown with durationMs (expiring timestamps preserve the 1-week re-show cadence)
  • Optional schedule with showAfter/hideAfter ISO bounds so time-bound campaigns don't need code changes to retire
  • Priority-based slot manager gives one-modal-at-a-time and one-banner-at-a-time, with higher-priority nudges preempting lower
  • externalDismissEvents for state-driven hide (inferencex:starred hides both star nudges without persisting)
  • Unified analytics: nudge_shown, nudge_dismissed, nudge_action_clicked with { id, kind } properties
  • Adding a new nudge = one entry in registry.ts, no other wiring

Tests

  • lib/nudges/persistence.test.ts, scheduling.test.ts, should-show.test.ts, components/nudges/registry.test.ts
  • All 1745 app unit tests pass, typecheck clean, oxlint clean
  • Cypress test files (20) updated to use new inferencex-nudge:* storage keys

Browser verification (dev server, Playwright)

  • Landing: banner + dsv4 modal both render; dsv4 priority wins over star modal; after dsv4 dismissed + reload, star modal appears
  • /inference: reproducibility-nudge fires and persists session, does not re-show after refresh
  • /evaluation: eval-samples-nudge wins (priority 10) over reproducibility-nudge
  • Persistence keys match: dsv4-launch-modal stores "1" (forever), github-star-modal/eval-samples-nudge store numeric timestamps (cooldown)

What I kept separate

  • mtp-engine-conflict-toast — transient state-driven feedback, not engagement
  • unofficial-run-provider — complex data-overlay state machine (issue explicitly allows this)

Generated with Claude Code

Replace eight one-off engagement-nudge implementations (banners, modals,
toasts) with a single registry-driven framework. Each nudge declares its
trigger, audience, dismissal behavior, persistence policy, and optional
schedule in one place; the framework handles route matching, exclusivity,
storage, and analytics uniformly.

Migrated: launch-banner-dsv4, dsv4-launch-modal, github-star-modal,
reproducibility-nudge, star-nudge, export-nudge, gradient-label-nudge,
eval-samples-nudge. Old per-nudge components and storage modules are
deleted; cypress tests now reference the new dismissal-storage keys
(`inferencex-nudge:<id>`).

Key features:
- Registry entry per nudge with declarative trigger (mount, mount-delay,
  event with thresholds and optional DOM selector matching)
- Persistence policies: session, forever, cooldown (with timestamp
  expiry — preserves the 1-week re-show cadence for star/eval-samples)
- Optional schedule (showAfter / hideAfter) for time-bound campaigns
- Priority-based slot manager so dsv4-modal preempts github-star-modal,
  and page-scoped eval-samples-nudge preempts always-on toasts on
  /evaluation
- External-dismiss events for state-driven hide (e.g. STARRED_EVENT
  hides the star nudges without persisting)
- Unified analytics: nudge_shown / nudge_dismissed /
  nudge_action_clicked, each carrying { id, kind }

Co-authored-by: functionstackx <functionstackx@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

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

Project Deployment Actions Updated (UTC)
inferencemax-app Ready Ready Preview, Comment May 5, 2026 4:48am

Request Review

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.

Unified nudge framework

1 participant