Skip to content

Add Promo Manager, Content‑Drops, SSHV improvements and major admin/menu refactor; update tests & docs - #94

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

Add Promo Manager, Content‑Drops, SSHV improvements and major admin/menu refactor; update tests & docs#94
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

  • Move promo handling from a single hard-coded promo to a DB-backed Promo Manager with richer eligibility, cooldowns, claim tracking and admin approval workflows.
  • Improve admin/operator tooling (persistent admin menu, SSHV console with editor, command safety, backups, and announcer builder) and stabilize runtime persistence and telemetry.
  • Make content drops (formerly "tips") more robust (target registration, scheduler, test/send, import/export) and simplify onboarding / promo UX.
  • Surface the new functionality and developer expectations in documentation (RUNEWAGER_FUNCTIONALITY_MAP.md, updated CLAUDE.md) and provide safer default env/gitignore handling.

Description

  • Core runtime refactor and feature additions in index.js: introduced promoManagerStore (DB file data/promo-manager-db.json), promo normalization/parsing, promo claim lifecycle (claims, approval, cooldowns), broadcast/announcement builder, content-drops manager (renamed from tips) with scheduler and target resolution, enhanced SSHV console (editor, locking, sandbox hints), persistent user/admin main menus, pending-action timeout (15m), and many helper utilities (serialize/deserialize, validate paths, save/load JSON, safe button dedupe, etc.).
  • Promo and messaging helpers: updated promo-message.js with safe read/write and exported getPromoMessage/setPromoMessage API.
  • Config and repo hygiene: enhanced .env.example with docs for WEBAPP_HMAC_KEY and LOG_LEVEL, updated .gitignore to allow example env templates and to generically ignore data/*.json and backups.
  • Admin & UX: reorganized admin keyboards and dashboards (Promo Manager, Content Drops, Tests & Bugs, System Tools), added announcement builder UI and targets (DM/channel/group), persistent menus (user/admin), and improved health/metrics handling (HTTP/HTTPS detection and safety checks).
  • Onboarding & promos: new promo evaluation (evaluatePromoEligibility), promo rendering/preview, claims queue with optional auto-approve, and user-facing promo menu that only shows eligible promos.
  • Safety & operations: write-atomic helpers, runtime backups, improved GC timers (smart button, sshv), robust path validation and sandbox-hint detection for SSHV operations.
  • Documentation & governance: added RUNEWAGER_FUNCTIONALITY_MAP.md (comprehensive feature map) and updated CLAUDE.md with an AI coder contract section; clarified many behaviors in index.js doc comments.
  • Tests and smoke checks: updated tests to reflect new structures and safety checks, added static validations for command/callback coverage and stricter file traversal logic in smoke tests.

Testing

  • Ran unit tests (node:test suite in test/unit.test.js) covering core pure functions (bonus state machine, serialization helpers, username normalization, markdown escaping); all unit tests passed.
  • Ran smoke tests (test/smoke.test.js) that validate JS syntax, registered command parity, and callback/button coverage; smoke tests passed locally with the updated static analysis of callbacks and regex handlers.
  • Ran runtime scripts tests (test/runtime.test.js) for backup/restore scripts; the backup and restore checks passed.

Codex Task


CodeAnt-AI Description

Enforce 15-minute pending-action timeout and add menu/callback integrity checks

What Changed

  • Pending input states now auto-expire after 15 minutes; users receive a timeout message and a Main Menu/Cancel quick-recovery prompt.
  • While a pending step exists, sending /cancel clears the pending state; /menu, /start, and /help also clear pending state and return users to the main menu.
  • Added smoke tests that verify every inline callback button maps to a handler (literal or regex) and that the REGISTERED_COMMANDS list stays in sync with actual command handlers to prevent broken menus and missing commands.
  • Updated example environment docs to explain the WEBAPP_HMAC_KEY and LOG_LEVEL entries.

Impact

✅ Fewer stuck input sessions
✅ Clearer timeout recovery to Main Menu
✅ Fewer broken menu buttons or missing commands

💡 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 23 minutes and 44 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 7a61409 and c358a40.

📒 Files selected for processing (2)
  • 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 commented Feb 26, 2026

Copy link
Copy Markdown

Sequence Diagram

Shows the new global pending-action timeout (15 minutes) and how slash commands (/cancel, /menu, /start, /help) escape or clear pending input states. This PR added the timeout, expiration reply, and slash-escape handling in the text message flow.

sequenceDiagram
    participant User
    participant Bot
    participant RuntimeStore

    User->>Bot: Send text while waiting for input (user.pendingAction)
    Bot->>RuntimeStore: Check user.pendingAction.createdAt and PENDING_ACTION_TIMEOUT_MS
    alt pendingAction expired (>15m)
        RuntimeStore-->>Bot: expired
        Bot->>RuntimeStore: clear user.pendingAction
        Bot-->>User: "Your pending step timed out..." + Main Menu / Cancel buttons
    else pendingAction not expired and text starts with '/'
        Bot->>Bot: parse slash command (cancel/menu/start/help)
        alt command == /cancel
            Bot->>RuntimeStore: clear user.pendingAction
            Bot-->>User: "Pending action cancelled." + Main Menu
        else command in (menu,start,help)
            Bot->>RuntimeStore: clear user.pendingAction
            Bot->>User: sendMainMenu
        else
            Bot->>Bot: continue handling pendingAction or pass-through
        end
    end
Loading

Generated by CodeAnt AI

@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 2aafaa8 into main Feb 26, 2026
1 check failed
@gamblecodezcom
gamblecodezcom deleted the codex/add-new-admin-promo-manager branch February 26, 2026 21:26
@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