chore: disable Golden Honey Badger feature (PR1/2)#791
Conversation
WalkthroughThis pull request removes the "Golden Honey Badger" feature from the application. The changes eliminate the environment variable, remove conditional logic that generated a special image and fee structure for badger orders, simplify fee calculations, and delete related messaging and image caching code across multiple files. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
bot/modules/orders/takeOrder.ts (1)
78-78: Nit: unnecessaryawaiton a synchronous call.
generateRandomImage(util/index.tsL567-571) returnsimageCache.generateRandomImage(nonce)synchronously — there's no Promise to await. Mirrors howbot/ordersActions.tsL119 calls it withoutawait. Drop theawaitfor consistency.♻️ Proposed change
- const { randomImage } = await generateRandomImage(user._id.toString()); + const { randomImage } = generateRandomImage(user._id.toString());🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bot/modules/orders/takeOrder.ts` at line 78, generateRandomImage returns synchronously (calls imageCache.generateRandomImage), so remove the unnecessary await in bot/modules/orders/takeOrder.ts by changing the destructuring call that assigns randomImage (currently "const { randomImage } = await generateRandomImage(user._id.toString());") to a plain synchronous call without await, mirroring how generateRandomImage is used in bot/ordersActions.ts and preserving the variable name randomImage.util/imageCache.ts (1)
50-77: Follow-up: drop the now-staticisGoldenHoneyBadgerfrom the return shape.
isGoldenHoneyBadgeris hardcoded tofalseand never reassigned, so callers no longer get any signal from it. Once the consumers (bot/ordersActions.ts,bot/modules/orders/takeOrder.ts,bot/commands.ts→messages.showHoldInvoiceMessage) stop reading the flag, consider trimming this fromgenerateRandomImage's return type so the API truthfully reflects what the function does.Same applies to
cache.honeybadgerImage(lines 10, 17, 116) and thehoneybadgerCachedfield ingetStats(line 116) — they're now permanentlynull/false. Reasonable to defer to PR2/3 or PR3/3, just flagging so it isn't forgotten.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@util/imageCache.ts` around lines 50 - 77, generateRandomImage currently returns a hardcoded isGoldenHoneyBadger=false and the cache still contains honeybadgerImage/honeybadgerCached fields that are always null/false; remove the unused boolean from generateRandomImage's return type and its return value, delete or deprecate the now-unused cache.honeybadgerImage and honeybadgerCached usages (references in generateRandomImage, cache initialization and getStats), and update all callers (e.g., bot/ordersActions.ts, bot/modules/orders/takeOrder.ts, bot/commands.ts → messages.showHoldInvoiceMessage) to stop expecting that flag so the function signature and cache API truthfully reflect current behavior.bot/ordersActions.ts (1)
48-49:isGoldenHoneyBadgeris now unused inbuildDescription— consider removing.
BuildDescriptionArguments.isGoldenHoneyBadger(L48) is destructured at L209 but never referenced insidebuildDescription, and the only call site (L149) passes a hardcodedfalse. Dropping the field from the interface, the destructure, and the L149 argument would remove the dead surface area without any behavior change. Fine to defer if PR2/3 will sweep this up.♻️ Proposed cleanup
interface BuildDescriptionArguments { user: UserDocument; type: string; amount: number; fiatAmount: number[]; fiatCode: string; paymentMethod: string; priceMargin: any; priceFromAPI: boolean; currency: IFiat; - isGoldenHoneyBadger?: boolean; }description: buildDescription(descriptionI18n, { user, type, amount, fiatAmount, fiatCode, paymentMethod, priceMargin, priceFromAPI, currency, - isGoldenHoneyBadger: false, }),{ user, type, amount, fiatAmount, fiatCode, paymentMethod, priceMargin, priceFromAPI, currency, - isGoldenHoneyBadger, }: BuildDescriptionArguments,Also applies to: 149-149, 209-209
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bot/ordersActions.ts` around lines 48 - 49, BuildDescriptionArguments.isGoldenHoneyBadger is dead: remove the isGoldenHoneyBadger property from the BuildDescriptionArguments interface, remove it from the destructuring in buildDescription (the parameter list where BuildDescriptionArguments is unpacked), and remove the hardcoded false argument at the buildDescription call site so the function and its interface no longer carry that unused flag; after edits, run TypeScript to ensure no other references remain and adjust any remaining call sites or types that referenced isGoldenHoneyBadger.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@bot/modules/orders/takeOrder.ts`:
- Line 78: generateRandomImage returns synchronously (calls
imageCache.generateRandomImage), so remove the unnecessary await in
bot/modules/orders/takeOrder.ts by changing the destructuring call that assigns
randomImage (currently "const { randomImage } = await
generateRandomImage(user._id.toString());") to a plain synchronous call without
await, mirroring how generateRandomImage is used in bot/ordersActions.ts and
preserving the variable name randomImage.
In `@bot/ordersActions.ts`:
- Around line 48-49: BuildDescriptionArguments.isGoldenHoneyBadger is dead:
remove the isGoldenHoneyBadger property from the BuildDescriptionArguments
interface, remove it from the destructuring in buildDescription (the parameter
list where BuildDescriptionArguments is unpacked), and remove the hardcoded
false argument at the buildDescription call site so the function and its
interface no longer carry that unused flag; after edits, run TypeScript to
ensure no other references remain and adjust any remaining call sites or types
that referenced isGoldenHoneyBadger.
In `@util/imageCache.ts`:
- Around line 50-77: generateRandomImage currently returns a hardcoded
isGoldenHoneyBadger=false and the cache still contains
honeybadgerImage/honeybadgerCached fields that are always null/false; remove the
unused boolean from generateRandomImage's return type and its return value,
delete or deprecate the now-unused cache.honeybadgerImage and honeybadgerCached
usages (references in generateRandomImage, cache initialization and getStats),
and update all callers (e.g., bot/ordersActions.ts,
bot/modules/orders/takeOrder.ts, bot/commands.ts →
messages.showHoldInvoiceMessage) to stop expecting that flag so the function
signature and cache API truthfully reflect current behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ea79731f-e528-4372-9e3e-39054770ee3c
📒 Files selected for processing (7)
.env-samplebot/commands.tsbot/messages.tsbot/modules/orders/takeOrder.tsbot/ordersActions.tsutil/imageCache.tsutil/index.ts
💤 Files with no reviewable changes (2)
- .env-sample
- bot/messages.ts
Stop assigning the Golden Honey Badger image and zero-fee bypass to new orders, drop the user-facing congratulatory messages, and remove the type definitions and signatures the feature relied on. Existing orders in the database keep working since their fee was already calculated at creation time. - imageCache: remove probability check, honeybadger cache slot, honeybadgerCached stat, and isGoldenHoneyBadger from generateRandomImage return - getFee: drop isGoldenHoneyBadger parameter and conditional logic - ordersActions: hard-code is_golden_honey_badger to false and drop isGoldenHoneyBadger from BuildDescriptionArguments - takeOrder: hard-code is_golden_honey_badger to false; drop the unnecessary await on synchronous generateRandomImage - messages: drop congratulatory blocks and isGoldenHoneyBadger param from showHoldInvoiceMessage - showHoldInvoice: always charge full fee - .env-sample: drop GOLDEN_HONEY_BADGER_PROBABILITY Refs #790 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9898ede to
648ebd5
Compare
Stop assigning the Golden Honey Badger image and zero-fee bypass to new orders, and remove the user-facing congratulatory messages. Existing orders in the database keep working since their fee was already calculated at creation time.
Closes #790
Summary by CodeRabbit
Removed Features
Updates