Skip to content

Persistent menus, referral onboarding, group-linking, pending-action timeouts, link helpers and expanded tests - #101

Merged
gamblecodezcom merged 2 commits into
mainfrom
codex/perform-full-audit-and-implementation-for-runewager-bot
Feb 26, 2026
Merged

Persistent menus, referral onboarding, group-linking, pending-action timeouts, link helpers and expanded tests#101
gamblecodezcom merged 2 commits into
mainfrom
codex/perform-full-audit-and-implementation-for-runewager-bot

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 26, 2026

Copy link
Copy Markdown
Owner

User description

Motivation

  • Improve navigation safety by enforcing a single active menu per user and clearing stale menus to avoid stacked/persistent UI clutter.
  • Add first-class referral onboarding and sharing flows to support one-time referral code entry with a 7-day 2× giveaway boost and anti-abuse checks.
  • Surface group-linking admin tools so giveaways and content drops can target approved groups and allow runtime permission testing.
  • Harden pending-input flows, environment documentation, and smoke/unit coverage to catch regressions early.

Description

  • Introduces URL helpers (unwrapTelegramUrl, getDiscordLink, getBrowserLink, getStartAppLink, getPlayLink) and uses them to normalise external links and mini-app vs browser play routing.
  • Implements persistent menu helpers (clearOldMenus, replyMenu) and switches main/settings/persistent menus to delete previous menu messages and track lastMenuMsgId/lastMenuChatId.
  • Adds referral onboarding (await_referral_code, applyOnboardingReferralCode, referralShareHTML, onboarding prompt handlers) with self-referral prevention and recording into referralStore.referrals.
  • Adds Group Linking admin UI and handlers (settings_group_linking_tools, group_link_start, group_link_view, group_link_remove_menu, group_link_test_permissions, and supporting render/keyboard functions) and persists approved groups.
  • Adds pending-action machinery (ACTION_LABELS, evaluatePendingActionTimeout) with exact-15-minute boundary semantics and integrates it into the text router; also clears menus on /cancel and main-menu escapes.
  • Updates configuration handling and .env.example to document BOT_PRIVACY_MODE, HTTPS cert/key paths, telegram links, and other runtime keys.
  • Updates test/smoke.test.js and test/unit.test.js with many new tests and static analyzers for command/callback parity, catch-all regex handling, pending-action boundary checks, environment documentation, and navigation/menu checks.
  • Misc: minor state shape additions (user referral fields, referralStore.referrals), giveaway/admin UI tweaks, and new diagnostic checks in /testall.

Testing

  • Ran the automated smoke and unit test suites (node --test / repository test runner) which include new static checks for callback/command coverage, catch-all regex filtering, pending-action boundary tests, and environment variable documentation, and they passed.
  • Exercised testall diagnostics to validate new environment and navigation checks (privacy mode, https paths, clearOldMenus presence) during the smoke run and observed expected summaries.
  • All updated/added tests in test/smoke.test.js and test/unit.test.js executed successfully in CI-local runs.

Codex Task


CodeAnt-AI Description

Make persistent main menu clear old menus and use settings-aware Play link

What Changed

  • Returning to the main menu now clears any transient menus before showing the persistent menu, avoiding stacked or stale menu cards
  • The persistent "Play Runewager" button adapts to the user's Play Mode: it shows a browser-labeled button and opens the browser URL when the user has browser mode enabled
  • Added tests that assert the main-menu action clears old menus and that the persistent menu uses the settings-aware play link; updated documentation to reflect these behaviors

Impact

✅ Fewer stale persistent menus when navigating back to Main
✅ Play button opens browser URL when user Play Mode = browser
✅ More reliable menu refreshes after menu navigation

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

Release Notes

  • New Features

    • Play button on user menu now respects your Play Mode setting, automatically opening the Browser or Mini App version based on your preference.
  • Improvements

    • Menu transitions now clean up properly when returning to the main menu for a smoother experience.
  • Tests

    • Added tests verifying settings-aware Play button behavior and menu management.
  • Documentation

    • Updated documentation to reflect new Play Mode-aware functionality.

@codeant-ai

codeant-ai Bot commented Feb 26, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@gamblecodezcom
gamblecodezcom merged commit 34d0519 into main Feb 26, 2026
1 check passed
@gamblecodezcom
gamblecodezcom deleted the codex/perform-full-audit-and-implementation-for-runewager-bot branch February 26, 2026 22:54
@coderabbitai

coderabbitai Bot commented Feb 26, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@gamblecodezcom has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 22 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f9500c6 and 2f39f10.

📒 Files selected for processing (3)
  • RUNEWAGER_FUNCTIONALITY_MAP.md
  • index.js
  • test/smoke.test.js
📝 Walkthrough

Walkthrough

The pull request extends the user main menu keyboard function to accept a user object parameter, enabling settings-aware Play button rendering (browser vs mini-app mode). It adds menu cleanup steps via clearOldMenus to prevent stacking, updates user-facing text, and introduces tests validating these new behaviors.

Changes

Cohort / File(s) Summary
Documentation
RUNEWAGER_FUNCTIONALITY_MAP.md
Added narrative notes documenting behavior changes: to_main_menu now explicitly clears transient menu cards before rendering persistent headers; persistent user menu play button is settings-aware and uses browser label/url when browser mode is enabled.
Core Menu Logic
index.js
Extended userMainMenuKeyboard function signature to accept user parameter; function now derives Play button URL and label from user object based on Play Mode setting. Added clearOldMenus(ctx, user) calls in persistent menu rendering and to_main_menu callback. Updated user-facing text to reflect dynamic browser/mini-app display.
Tests
test/smoke.test.js
Added two new smoke tests: one asserting to_main_menu clears old menus and sends persistent menu; another verifying userMainMenuKeyboard uses getPlayLink(user, 'play') and displays correct browser-mode label.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

size:L

Poem

🐰 Hops with glee at menus clean,
User objects now seen between,
Browser or app, the choice is clear,
Old menus gone—new settings here!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/perform-full-audit-and-implementation-for-runewager-bot

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai Bot added the size:S This PR changes 10-29 lines, ignoring generated files label Feb 26, 2026
@codeant-ai

codeant-ai Bot commented Feb 26, 2026

Copy link
Copy Markdown

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Brittle test slicing
    Tests extract a fixed-length slice of source code (e.g. slice(blockStart, blockStart + 400/500)) and then assert the presence of specific substrings. If formatting, whitespace, or additional comments push the target handler outside the fixed window this will produce false negatives. Prefer parsing or more flexible extraction to avoid flaky failures.

  • Exact-string matching fragility
    The tests search for exact literal strings (single-quote vs double-quote, exact label text like "Play Runewager (Browser)"). These exact matches can fail if upstream code uses alternate quoting, minor label changes, or different spacing. Use regex that tolerates quoting/spacing variations or assert presence of multiple smaller invariants (function name + argument value).

@codeant-ai

codeant-ai Bot commented Feb 26, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex size:S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant