Skip to content

Promo Manager, Content Drops, Announce Builder, admin UI updates and smoke-test expansions - #89

Merged
gamblecodezcom merged 2 commits into
mainfrom
codex/add-new-admin-promo-manager-kmv9q5
Feb 26, 2026
Merged

Promo Manager, Content Drops, Announce Builder, admin UI updates and smoke-test expansions#89
gamblecodezcom merged 2 commits into
mainfrom
codex/add-new-admin-promo-manager-kmv9q5

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 26, 2026

Copy link
Copy Markdown
Owner

User description

Motivation

  • Replace the legacy one-off promo/code handling with a DB-backed Promo Manager to support multiple promos, claims, cooldowns and admin approvals.
  • Provide a safer, more flexible announcements/broadcast flow and a more robust Content Drops (tips) system with better target discovery and failover.
  • Improve admin UX and operational safety for SSHV, health checks and persistent menus, and add a machine-readable functionality map for future AI-driven edits.

Description

  • Added RUNEWAGER_FUNCTIONALITY_MAP.md as the authoritative functionality map and updated CLAUDE.md with an AI coder contract requirement.
  • Moved promo logic to a new promoManagerStore persisted to data/promo-manager-db.json with functions to list promos, evaluate eligibility, create claims, and admin approve/deny via /pmapprove and /pmdeny.
  • Reworked user promo flows to show only DB-backed promos and replaced legacy promoStore/promoCodeStore paths, including new claim lifecycle, cooldowns, requirements and admin queue (admin_pm_* handlers and menus).
  • Reworked Content Drops (formerly Tips) subsystem: renamed UI text, added target auto-registration from forwarded messages, resilient posting with fallback targets, postTipToConfiguredTarget, register_chat command, and improved scheduler and admin dashboard.
  • Implemented a new announcement/broadcast builder (/announce + inline builder UI), with target toggles (DM/Channel/Group), parse-mode toggle, and unified announce_send_now implementation that reports send results.
  • Admin and user menu/UI improvements and renames (persistent menus, help content updates, new admin Test & Bugs menu, many callback ids and handlers added or re-mapped).
  • SSHV and health improvements: sandbox restriction hinting, safer nano editor handling, editor save error handling, TLS-aware local health checks, GC timer unref for smart-button and SSHV timers, and additional admin logging for SSHV actions.
  • Misc housekeeping: .env.example docs for WEBAPP_HMAC_KEY, .gitignore adjustments to allow example env files and ignore runtime backups, and minor link/env fallbacks in index.js.
  • Expanded smoke/unit test coverage and tooling: enhanced test/smoke.test.js to statically verify that literal callback button IDs map to handlers (including regex patterns) and that REGISTERED_COMMANDS matches bot.command(...) handlers.

Testing

  • Performed a syntax check with node --check index.js as part of the smoke validations and updated test/smoke.test.js to run static handler/command parity checks; the smoke tests passed locally.
  • Ran the repository test suite (npm test) which executed the smoke tests including the new callback/handler and REGISTERED_COMMANDS parity checks; all automated tests succeeded.
  • Exercised scheduler and announcement flows via the new tips/announce test actions and verified content-drop posting fallback and admin notification paths in local test runs.

Codex Task


CodeAnt-AI Description

Add smoke tests for command/callback parity, register new admin commands, and publish functionality map & AI coder contract

What Changed

  • New smoke tests validate: JavaScript syntax, that inline callback button IDs have matching handlers (literal or regex), and that REGISTERED_COMMANDS matches actual bot.command handlers; test scans all .js files.
  • Added four admin-facing commands visible to users: pmapprove, pmdeny, register_chat, verify_bot_setup; added a simple /language command that reports detected language.
  • Published a comprehensive RUNEWAGER_FUNCTIONALITY_MAP.md and added mandatory AI coder contract text to CLAUDE.md; expanded .env.example with guidance for WEBAPP_HMAC_KEY.

Impact

✅ Fewer silent command/callback mismatches
✅ Clearer bot setup verification for admins
✅ Easier developer setup with HMAC guidance

💡 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

  • Documentation

    • Added comprehensive functionality map documentation for the bot system.
    • Enhanced environment configuration with setup guidance and security notes.
  • Tests

    • Added smoke tests to verify callback ID coverage and command registration consistency.
  • Chores

    • Updated version control rules to track environment templates while ignoring generated data files.

@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 19 minutes and 40 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 dca4f5c and 261c00e.

📒 Files selected for processing (4)
  • CLAUDE.md
  • RUNEWAGER_FUNCTIONALITY_MAP.md
  • index.js
  • test/smoke.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/add-new-admin-promo-manager-kmv9q5

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:L This PR changes 100-499 lines, ignoring generated files label Feb 26, 2026
@gamblecodezcom
gamblecodezcom merged commit 714fa43 into main Feb 26, 2026
1 check passed
@gamblecodezcom
gamblecodezcom deleted the codex/add-new-admin-promo-manager-kmv9q5 branch February 26, 2026 20:28
@codeant-ai

codeant-ai Bot commented Feb 26, 2026

Copy link
Copy Markdown

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • IO robustness
    The new file-walking and file-reading logic walks the entire repo (excluding some dirs) and reads every .js file without handling FS errors or very large files. Unreadable files, permission errors, symlink cycles, or huge files could cause the test to crash or OOM. Consider adding try/catch around readdir/readFile and limiting file size or skipping certain paths.

  • Regex parsing gaps
    The action-regex extraction uses a simple pattern (bot.action(/.../flags)) that doesn't account for escaped slashes or more complex regex literal forms, so some handler patterns may be missed. This can lead to false positives in the "uncovered callback handlers" check.

  • Quoting assumptions
    The REGISTERED_COMMANDS and bot.command detection only handle single-quoted strings (/'([^']+)'/). If the code uses double quotes or backticks for commands, the test will miss them and report incorrect misses/extras. The matching should accept all string quote types or use a JS parser for reliability.

@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:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant