Add menu/menu-hygiene, referral & bonus admin flows, tooltip loader, env docs, and extensive tests - #104
Conversation
|
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 · |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…for-runewager-bot-owp4vy
|
|
||
| echo "=== GCZ — TOOLTIP PIPELINE EXECUTION ===" | ||
|
|
||
| cd /var/www/html/Runewager || exit 1 | ||
|
|
||
| echo "[1] Pulling latest from origin main..." | ||
| git pull origin main || exit 1 | ||
|
|
||
| echo "[2] Ensuring data directory exists..." | ||
| mkdir -p /var/www/html/Runewager/data | ||
|
|
||
| echo "[3] Ensuring tooltips.json exists..." | ||
| if [ ! -f /var/www/html/Runewager/data/tooltips.json ]; then | ||
| echo "[]" > /var/www/html/Runewager/data/tooltips.json | ||
| echo "Created empty tooltips.json" | ||
| fi | ||
|
|
||
| echo "[6] Adding data/tooltips.json to .gitignore if missing..." | ||
| grep -qxF "data/tooltips.json" .gitignore || echo "data/tooltips.json" >> .gitignore | ||
|
|
||
| echo "[7] Staging .gitignore only..." | ||
| git add .gitignore | ||
|
|
||
| echo "[8] Committing..." | ||
| git commit -m "GCZ: ensure tooltips.json exists, ignore it, and run load_tooltips.sh" | ||
|
|
||
| echo "[9] Pushing to origin main..." | ||
| git push origin main | ||
|
|
||
| echo "=== GCZ — DONE ===" | ||
|
|
||
| set -euo pipefail |
There was a problem hiding this comment.
Suggestion: The script enables set -euo pipefail only after running git pull, git add, git commit, and git push, so failures in those git commands (for example, authentication issues or rejected pushes) will be silently ignored while the script still prints a successful completion message; moving strict error handling to the top and only committing/pushing when there are staged changes ensures that genuine failures stop the pipeline instead of leaving the repo in an inconsistent state. [logic error]
Severity Level: Major ⚠️
- ⚠️ Tooltip seeding script may report success despite push failure.
- ⚠️ Remote origin/main may miss .gitignore tooltip entry.
- ⚠️ Operators may assume repo synced when it is not.| echo "=== GCZ — TOOLTIP PIPELINE EXECUTION ===" | |
| cd /var/www/html/Runewager || exit 1 | |
| echo "[1] Pulling latest from origin main..." | |
| git pull origin main || exit 1 | |
| echo "[2] Ensuring data directory exists..." | |
| mkdir -p /var/www/html/Runewager/data | |
| echo "[3] Ensuring tooltips.json exists..." | |
| if [ ! -f /var/www/html/Runewager/data/tooltips.json ]; then | |
| echo "[]" > /var/www/html/Runewager/data/tooltips.json | |
| echo "Created empty tooltips.json" | |
| fi | |
| echo "[6] Adding data/tooltips.json to .gitignore if missing..." | |
| grep -qxF "data/tooltips.json" .gitignore || echo "data/tooltips.json" >> .gitignore | |
| echo "[7] Staging .gitignore only..." | |
| git add .gitignore | |
| echo "[8] Committing..." | |
| git commit -m "GCZ: ensure tooltips.json exists, ignore it, and run load_tooltips.sh" | |
| echo "[9] Pushing to origin main..." | |
| git push origin main | |
| echo "=== GCZ — DONE ===" | |
| set -euo pipefail | |
| set -euo pipefail | |
| echo "=== GCZ — TOOLTIP PIPELINE EXECUTION ===" | |
| cd /var/www/html/Runewager || exit 1 | |
| echo "[1] Pulling latest from origin main..." | |
| git pull origin main | |
| echo "[2] Ensuring data directory exists..." | |
| mkdir -p /var/www/html/Runewager/data | |
| echo "[3] Ensuring tooltips.json exists..." | |
| if [ ! -f /var/www/html/Runewager/data/tooltips.json ]; then | |
| echo "[]" > /var/www/html/Runewager/data/tooltips.json | |
| echo "Created empty tooltips.json" | |
| fi | |
| echo "[6] Adding data/tooltips.json to .gitignore if missing..." | |
| grep -qxF "data/tooltips.json" .gitignore || echo "data/tooltips.json" >> .gitignore | |
| echo "[7] Staging .gitignore only..." | |
| git add .gitignore | |
| 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" | |
| echo "[9] Pushing to origin main..." | |
| git push origin main | |
| fi | |
| echo "=== GCZ — DONE ===" |
Steps of Reproduction ✅
1. On the deployment host, ensure `/var/www/html/Runewager` is a git clone with `origin`
pointing at the main repo (script entrypoint at
`/workspace/Runewager/load_tooltips.sh:1-31`).
2. Create a condition where `git push origin main` will fail (for example, revoke push
permissions or misconfigure credentials) so that `git push` at `load_tooltips.sh:28-29`
exits with a non-zero status.
3. Run `bash load_tooltips.sh` from the repo root; observe that `git push origin main`
prints an error but the script continues because `set -euo pipefail` is only enabled later
at `load_tooltips.sh:33` and there is no `|| exit 1` on the push or commit.
4. Observe that the script prints `=== GCZ — DONE ===` (line 31) and then proceeds to
write `/var/www/html/Runewager/data/tooltips.json` and print `✅ Tooltips loaded
successfully into $OUT` (lines 35-59), while the remote `origin/main` does not contain the
new `.gitignore` change, leaving local and remote states inconsistent even though the
script reported success.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** load_tooltips.sh
**Line:** 2:33
**Comment:**
*Logic Error: The script enables `set -euo pipefail` only after running `git pull`, `git add`, `git commit`, and `git push`, so failures in those git commands (for example, authentication issues or rejected pushes) will be silently ignored while the script still prints a successful completion message; moving strict error handling to the top and only committing/pushing when there are staged changes ensures that genuine failures stop the pipeline instead of leaving the repo in an inconsistent state.
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 finished reviewing your PR. |
User description
Motivation
Description
unwrapTelegramUrl,getDiscordLink,getPlayMode,getPlayLink,getPlayButton, andplayButtonMarkupand switched menu play buttons to use them.clearOldMenus(ctx)andreplyMenu(ctx, user, ...)to enforce a single persistent/transient menu per user (stores last menu IDs on user objects).ACTION_LABELSandevaluatePendingActionTimeout, with exact-15-minute boundary semantics and escape handling for/cancel,/menu,/start, and/help.referralCodeForUser,referralShareHTML, andapplyOnboardingReferralCodeto enforce one-time onboarding-only referral entry, self-referral prevention, and dual 7-day boost assignment recorded inreferralStore.referrals.checkBonusEligibility, admin actions (bonusAdminApprove,bonusAdminDeny,bonusAdminSent) log to/var/www/html/Runewager/logs/bonus_admin.logviaappendBonusAdminLog, and added a user-facing bonus submenu (w30_*) and admin submenu (w30_admin_menu).approvedGroupsStoreand helper UIs wired into Settings and Admin menus./var/www/html/Runewager/data/tooltips.json(loaded inloadHelpfulMessages), and included theload_tooltips.shoperational script to seed and managetooltips.json(and update .gitignore)..env.exampleto documentBOT_PRIVACY_MODE, HTTPS cert/key envs, Telegram link vars, and moved some keys for clarity.RUNEWAGER_FUNCTIONALITY_MAP.mdandCLAUDE.mdto reflect the new behaviors/agent contract and operational notes.test/smoke.test.jsandtest/unit.test.jsto cover menu hygiene, pending-action timeouts, play-mode behavior, referral flows, group-linking tools, admin bonus admin paths, and smoke-test expectations.Testing
evaluatePendingActionTimeout,getPlayLink/getPlayButton,getDiscordLinkunwrapping, referral logic, and static analysis helpers used by smoke checks, and confirmed they succeed.load_tooltips.shcreates and validates/var/www/html/Runewager/data/tooltips.jsonin CI-like validation (script syntax and JSON tool formatting).Codex Task
CodeAnt-AI Description
Escape referral codes in bot messages, harden pending-action timeout handling, and ensure tooltip data exists
What Changed
Impact
✅ Prevents referral HTML injection✅ Fewer false pending-action expirations✅ Tooltip data file reliably present during deployments💡 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:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
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:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
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.