Skip to content

Menu/navigation hardening, referral onboarding, tooltips loader, and 30 SC manual bonus admin flow with tests - #106

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

Menu/navigation hardening, referral onboarding, tooltips loader, and 30 SC manual bonus admin flow with tests#106
gamblecodezcom merged 2 commits into
mainfrom
codex/perform-full-audit-and-implementation-for-runewager-bot-wi8wfz

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 26, 2026

Copy link
Copy Markdown
Owner

User description

Motivation

  • Make the bot UI more deterministic by enforcing a single-active-menu model and avoiding stacked/stale menu cards.
  • Improve pending-input safety with labelled timeouts and explicit escape routes to reduce stuck states and accidental data loss.
  • Add a referral-onboarding flow with one-time code entry and dual 7-day boost semantics, plus admin tooling for group linking and bonus review auditing.
  • Provide an operational way to seed system tooltips and document required runtime env keys for production deployments.

Description

  • .env.example updated to document BOT_PRIVACY_MODE, HTTPS cert/key envs, Telegram links, LOG_LEVEL ordering and other runtime keys used by the app.
  • index.js additions and refactors: added unwrapTelegramUrl/getDiscordLink, unified play/link helpers (getPlayMode, getPlayLink, getPlayButton, playButtonMarkup), and made Play buttons deterministic for browser vs mini-app modes.
  • Implemented single-active-menu helpers: clearOldMenus, replyMenu, replyMenu usage across settings/main menu flows, and callback hygiene middleware to delete source callback cards when replying.
  • Pending-action timeout handling improved via ACTION_LABELS and evaluatePendingActionTimeout with exact-15-minute boundary semantics and slash-command escape handling (/cancel, /menu, /start, /help).
  • Referral onboarding: applyOnboardingReferralCode, shareable HTML, referral store persistence and dual-boost application for owner+referred user; onboarding prompts added (onboard_ref_yes/onboard_ref_no).
  • 30 SC bonus flow: switched to manual-review policy, added user-facing submenu (w30_menu_*), admin review tools (w30_admin_menu), and an append-only admin audit sink bonus_admin.log via appendBonusAdminLog.
  • Group linking tools: admin-facing group link UI, link/view/remove/test actions, auto-registration from forwarded messages, and persistent approved group store usage.
  • Tooltips: load path preference for /var/www/html/Runewager/data/tooltips.json in loadHelpfulMessages, and added load_tooltips.sh to seed/ignore and populate tooltips.json with 15 approved entries.
  • Test and quality: extended static and unit smoke tests to cover new helpers, pending-action semantics, play-button determinism, referral menus, group linking, and testall summary warning count; many test helpers added or adjusted in test/*.test.js.

Testing

  • Ran the repo automated test suites (test/unit.test.js and test/smoke.test.js) locally via the project's test runner; all unit and smoke tests passed.
  • Exercised the updated /testall logic via the smoke test harness to verify environment/link checks, pending-action boundary behavior, and the new summary line; the smoke suite reported no failures.
  • Verified JSON output of the load_tooltips.sh target using python -m json.tool in the script as part of the script’s self-check (script writes and validates tooltips.json).

Codex Task


CodeAnt-AI Description

Make tooltip pipeline fail fast and skip empty commits during deployment

What Changed

  • Script now runs in strict mode so errors stop the pipeline early instead of continuing silently
  • If there are no staged changes, the script skips committing and pushing to avoid creating empty commits or unnecessary pushes
  • Ensures tooltip data file and .gitignore are created/updated before attempting to commit, so deployments have the expected tooltip state

Impact

✅ Fewer failed deployments due to hidden errors
✅ No empty commits or unnecessary pushes
✅ More reliable tooltip updates during deployment

💡 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.

@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

@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 1 minutes and 16 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 12e0b58 and 3d6fbf2.

📒 Files selected for processing (1)
  • load_tooltips.sh
✨ 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-wi8wfz

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.

@gamblecodezcom
gamblecodezcom merged commit 0ef3f17 into main Feb 26, 2026
3 checks passed
@gamblecodezcom
gamblecodezcom deleted the codex/perform-full-audit-and-implementation-for-runewager-bot-wi8wfz branch February 26, 2026 23:49
@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

  • Automatic commit & push
    The script stages .gitignore, then potentially commits and pushes directly to origin main. Automated commits/pushes from an operational host can cause accidental changes to main, require credentials, and risk leaking secrets or creating forceful history changes. This should be gated (env guard, approval step) or converted to create a PR instead of pushing to main.

  • Remote pull risk
    The script performs an unconditional git pull from origin main. Pulling remote changes and then continuing to run local logic can introduce supply-chain/code-execution risks or unexpected merge conflicts. The pull should be done with safer flags or followed by validation before proceeding.

  • Hardcoded path
    The script uses an absolute directory path (cd /var/www/html/Runewager). That assumes the repository layout and permissions on every host where this runs and makes the script brittle in alternate environments (CI, dev machines, containers). Consider making the path configurable or validating it before proceeding.

Comment thread load_tooltips.sh
Comment on lines +27 to +31
if git diff --cached --quiet; then
echo "[8] No changes to commit; skipping git commit/push."
else
echo "[8] Committing..."
git commit -m "GCZ: ensure tooltips.json exists, ignore it, and run load_tooltips.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The script claims to stage and commit only the ignore rule, but git commit without a path will include any other already-staged files in the repo, potentially causing unintended commits; restricting both the diff check and the commit to .gitignore ensures only the intended file is pushed. [logic error]

Severity Level: Major ⚠️
- ❌ Script can push unrelated staged changes to origin main.
- ⚠️ Bypasses usual code review protections for those staged changes.
Suggested change
if git diff --cached --quiet; then
echo "[8] No changes to commit; skipping git commit/push."
else
echo "[8] Committing..."
git commit -m "GCZ: ensure tooltips.json exists, ignore it, and run load_tooltips.sh"
if git diff --cached --quiet -- .gitignore; then
echo "[8] No changes to commit; skipping git commit/push."
else
echo "[8] Committing..."
git commit -m "GCZ: ensure tooltips.json exists, ignore it, and run load_tooltips.sh" .gitignore
Steps of Reproduction ✅
1. In `/var/www/html/Runewager` (path used at `load_tooltips.sh:7`), modify a tracked file
such as `index.js` and stage it manually with `git add index.js`, leaving it in the index.

2. From the same repository root, execute the operational script `./load_tooltips.sh`
(script content confirmed at `/workspace/Runewager/load_tooltips.sh:1-63`).

3. The script executes the block at `load_tooltips.sh:24-25`, printing `"[7] Staging
.gitignore only..."` and running `git add .gitignore`, which adds `.gitignore` alongside
the already-staged `index.js`.

4. The conditional at `load_tooltips.sh:27` calls `git diff --cached --quiet` without a
pathspec, which detects any staged changes (including `index.js`), so it enters the `else`
branch and runs `git commit -m ...` at `load_tooltips.sh:31`, committing both `.gitignore`
and the unrelated `index.js` changes.

5. Immediately after, the script pushes this commit to `origin main` via `git push origin
main` at `load_tooltips.sh:34`, causing unintended, unreviewed changes from `index.js` (or
any other pre-staged files) to be pushed along with the `.gitignore` update.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** load_tooltips.sh
**Line:** 27:31
**Comment:**
	*Logic Error: The script claims to stage and commit only the ignore rule, but `git commit` without a path will include any other already-staged files in the repo, potentially causing unintended commits; restricting both the diff check and the commit to `.gitignore` ensures only the intended file is pushed.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

@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