Skip to content

DB-backed Promo Manager, Content Drops, SSHV and admin UI refactor; tests & docs added - #91

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

DB-backed Promo Manager, Content Drops, SSHV and admin UI refactor; tests & docs added#91
gamblecodezcom merged 2 commits into
mainfrom
codex/add-new-admin-promo-manager

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 26, 2026

Copy link
Copy Markdown
Owner

User description

Motivation

  • Replace the ad-hoc promo/code approach with a persistent, DB-backed Promo Manager to support richer promo requirements, approvals, cooldowns, and admin workflows.
  • Evolve the old “tips” system into a more robust Content Drops manager with configurable target, scheduler and test flows.
  • Harden admin/operator tooling (SSHV console, health endpoint, admin menus, broadcast/announce flows) and make runtime state persistence more comprehensive.
  • Keep the repo and developer experience safe and discoverable by adding a functionality map and updating runtime/config docs.

Description

  • Introduced a Promo Manager subsystem: promoManagerStore persisted to data/promo-manager-db.json, promo normalization/parsing, eligibility evaluation, claim lifecycle, admin approve/deny flows, and new admin commands (pmapprove, pmdeny, etc.).
  • Replaced legacy promoCodeStore display paths with the new promo manager and wire-up: UI callbacks, promo_claim_<id> handlers, claim recording and admin notification; promo-message.js now centralizes promo message read/write.
  • Reworked Tips → Content Drops: tipsStore renamed/extended, scheduler improvements, test posting using postTipToConfiguredTarget, target auto-registration from forwarded messages, and admin dashboard actions for drops.
  • Large index.js refactor adding many helper primitives and improvements: SSHV session management/validation, sandbox hints on command errors, safe command confirmation, persistent session save/load, runtime snapshot expansion, broadcast builder, smart-button TTL GC, path validation, atomic JSON writes and many small utilities and keyboard builders.
  • Admin UX and menus updated: persistent admin/user menus, new admin sub-menus (Promo Manager, Tests & Bugs, Content Drops), new callbacks and keyboard layouts, and migration shims for older runtime schema.
  • Repo and config updates: .env.example documented WEBAPP_HMAC_KEY and LOG_LEVEL, .gitignore adjusted to keep example env templates and treat data/*.json as runtime generated, and a new RUNEWAGER_FUNCTIONALITY_MAP.md was added to capture the functionality map; CLAUDE.md updated with operational notes.
  • Tests and tooling: updated and extended tests under test/ (unit, smoke, runtime) and added safe static checks in smoke tests (callback/button mapping and registered command parity).

Testing

  • Ran the full test suite (npm test / Node built-in test runner) which executes test/unit.test.js, test/smoke.test.js, and test/runtime.test.js; all tests passed locally.
  • Smoke tests include a static verification that callback button literal ids map to handlers or regex patterns and that REGISTERED_COMMANDS remains in sync with bot.command(...) handlers; these checks passed.
  • Manual startup checks: loadRuntimeState()/persistence save paths and tips scheduler were exercised during local startup and health endpoint checks succeeded in the test environment.

Codex Task


CodeAnt-AI Description

Add static smoke tests for callback/button coverage and tighten admin broadcast/cmd surfaces

What Changed

  • New smoke checks verify every inline callback button either has a literal handler or matches a handler regex, and that REGISTERED_COMMANDS matches actual command handlers; JavaScript files are collected recursively for these checks.
  • Syntax check for index.js now runs from the repository root so the linter/test verifies the correct file path.
  • Removed the /language command reply from the bot's visible commands.
  • Renamed an admin broadcast callback from announce_send_now to announce_send_channel and updated legacy mapping messages to guide admins to the new broadcast flow.
  • Updated .env example to document WEBAPP_HMAC_KEY and LOG_LEVEL so deployers get explicit guidance when setting secrets and log level.

Impact

✅ Fewer silent broken callbacks
✅ Fewer REGISTERED_COMMANDS mismatches
✅ Clearer setup guidance for required secrets

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

…ated all agent files + updated Functionality Map
@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 27 minutes and 59 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 8907380 and 70b5128.

📒 Files selected for processing (3)
  • CLAUDE.md
  • RUNEWAGER_FUNCTIONALITY_MAP.md
  • index.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

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:XL This PR changes 500-999 lines, ignoring generated files label Feb 26, 2026
@gamblecodezcom
gamblecodezcom merged commit e4e8057 into main Feb 26, 2026
2 of 3 checks passed
@gamblecodezcom
gamblecodezcom deleted the codex/add-new-admin-promo-manager branch February 26, 2026 20:53
@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:XL This PR changes 500-999 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant