Skip to content

Conversation

@HashEngineering
Copy link
Collaborator

@HashEngineering HashEngineering commented Jan 30, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Enabled debug mode support across data sources for enhanced diagnostic logging
    • Improved merchant data tracking with location-based filtering by country
    • Enhanced debug command-line guidance with detailed logging information
  • Chores

    • Updated build version to 6
    • Increased deployment timeout for improved stability

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

This pull request introduces a debug mode feature across the data processing layer. The base DataSource class now accepts a debugMode parameter that cascades to all concrete implementations (CTXSpendDataSource, CoinAtmRadarDataSource, DCGDataSource, PiggyCardsDataSource), enabling conditional logging behavior. The build version increments from 5 to 6, deployment timeout extends to 600 seconds, and minor messaging updates occur in the main application entry point.

Changes

Cohort / File(s) Summary
Deployment Configuration
deploy-gcf.sh
Google Cloud Function deployment timeout increased from 300s to 600s.
Application Entry Point
src/main/kotlin/org/dash/mobile/explore/sync/MainApp.kt, src/main/kotlin/org/dash/mobile/explore/sync/SyncProcessor.kt
Help message for debug argument updated to mention "BODY logging"; BUILD constant incremented from 5 to 6; all four DataSource constructors updated to accept debugMode parameter.
Base DataSource Class
src/main/kotlin/org/dash/mobile/explore/sync/process/DataSource.kt
Constructor signature extended to accept debugMode parameter; loggingLevel configuration introduced that switches between BODY and HEADERS based on debug mode.
DataSource Implementations
src/main/kotlin/org/dash/mobile/explore/sync/process/CTXSpendDataSource.kt, src/main/kotlin/org/dash/mobile/explore/sync/process/CoinAtmRadarDataSource.kt
Constructor signatures updated to accept and pass debugMode parameter to superclass DataSource.
Advanced DataSource Implementations
src/main/kotlin/org/dash/mobile/explore/sync/process/DCGDataSource.kt
Constructor updated with debugMode parameter; data processing logic refined to track merchant names, continue on non-merchant rows instead of breaking, and include merchant count in Slack messages.
PiggyCards DataSource
src/main/kotlin/org/dash/mobile/explore/sync/process/PiggyCardsDataSource.kt
Constructor updated with debugMode parameter; new Location data class added with country filtering for physical merchant locations; gift card aggregation logic adjusted; logging level configuration applied.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A debug flag hops through the sources,
Logging flows like flowery courses,
Version five now turns to six so bright,
DataSources shine with debugMode light! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'improve debug' and 'ignore blank lines in excel merchant list', but the primary changes involve adding debug parameter support across data sources and increasing deployment timeout; blank line handling is not evident in the summaries. Revise title to accurately reflect the main changes: consider 'feat: add debug parameter to data sources and increase GCF timeout' or similar to better represent the actual changeset.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/improve-debug-ignore-blanks

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
deploy-gcf.sh (1)

15-22: ⚠️ Potential issue | 🔴 Critical

Fix timeout for Pub/Sub trigger compatibility.

This script uses --trigger-topic (Pub/Sub trigger), which has a max timeout of 540s for both gen1 and gen2. The current 600s timeout will fail deployment. Reduce to 540s.

Fix
-TIMEOUT="600s"
+TIMEOUT="540s"
src/main/kotlin/org/dash/mobile/explore/sync/SyncProcessor.kt (1)

140-190: ⚠️ Potential issue | 🟠 Major

Guard debug logging from production to avoid leaking sensitive data in request/response bodies.

debug enables BODY level logging in CTXSpendDataSource and PiggyCardsDataSource, which captures full request and response bodies (e.g., API keys, auth hashes, tokens). Although Authorization headers are redacted, BODY level logging still exposes sensitive data in request/response bodies and other headers. If -debug is used in production, secrets can land in logs. Create an effectiveDebug value that disables debug in production mode.

🔐 Suggested fix
     private suspend fun importData(dbFile: File, locationsDbFile: File) {
+        val effectiveDebug = debug && mode != OperationMode.PRODUCTION
-        val ctxDataSource = CTXSpendDataSource(slackMessenger, debug)
+        val ctxDataSource = CTXSpendDataSource(slackMessenger, effectiveDebug)
         val ctxData = ctxDataSource.getDataList()
         val ctxReport = ctxDataSource.getReport()
-        val piggyCardsDataSource = PiggyCardsDataSource(slackMessenger, mode, debug)
+        val piggyCardsDataSource = PiggyCardsDataSource(slackMessenger, mode, effectiveDebug)
         val piggyCardsData = piggyCardsDataSource.getDataList()
         val piggyCardsReport = piggyCardsDataSource.getReport()
         val report = SyncReport(listOf(ctxReport, piggyCardsReport))
-        if (debug) {
+        if (effectiveDebug) {
             saveMerchantDataToCsv(ctxData, "ctx.csv")
             saveMerchantDataToCsv(piggyCardsData, "piggycards.csv")
         }
@@
-            val dcgDataFlow = DCGDataSource(mode != OperationMode.PRODUCTION, slackMessenger, debug).getData(prepStatement)
+            val dcgDataFlow = DCGDataSource(mode != OperationMode.PRODUCTION, slackMessenger, effectiveDebug).getData(prepStatement)
🤖 Fix all issues with AI agents
In
`@src/main/kotlin/org/dash/mobile/explore/sync/process/PiggyCardsDataSource.kt`:
- Around line 254-260: The code mixes a case-insensitive check
(giftCard.name.lowercase().contains("(instant delivery)")) with a case-sensitive
one (!it.name.contains("(instant delivery)")), causing inconsistent behavior and
possible duplicates; update the filter in PiggyCardsDataSource (the
immediateDeliveryCards.addAll(...) line that filters giftCards where priceType
== "Fixed") to use a case-insensitive contains (e.g., .contains("(instant
delivery)", ignoreCase = true)) so both checks are consistent and duplicates are
avoided.
🧹 Nitpick comments (1)
src/main/kotlin/org/dash/mobile/explore/sync/process/PiggyCardsDataSource.kt (1)

291-306: Country-filtered locations are logged as "invalid", which may be misleading.

Locations that don't match the target country are added to invalidLocations (line 305) and logged as "invalid" at line 334. These locations aren't truly invalid—they're just filtered by country. This could confuse debugging efforts.

Consider separating the tracking:

  • invalidLocations for genuinely invalid data (missing address/coordinates)
  • A separate collection for locations filtered by country

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants