Skip to content

Feature/sync accounts lists#580

Merged
aunali8812 merged 2 commits intostagingfrom
feature/sync-accounts-lists
Feb 10, 2026
Merged

Feature/sync accounts lists#580
aunali8812 merged 2 commits intostagingfrom
feature/sync-accounts-lists

Conversation

@aunali8812
Copy link
Collaborator

@aunali8812 aunali8812 commented Feb 10, 2026

Summary by CodeRabbit

  • Chores
    • Updated campaign API endpoint configuration to use environment-specific base URLs, with test environments using the indexer endpoint and production using the dev backend.

@aunali8812 aunali8812 requested a review from Ebube111 as a code owner February 10, 2026 20:09
@vercel
Copy link

vercel bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
potlock-next-app Ready Ready Preview, Comment Feb 10, 2026 8:11pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

Walkthrough

Introduces environment-specific API base URL configuration for campaign sync endpoints. A new CAMPAIGNS_SYNC_API_BASE_URL constant conditionally selects between test and production URLs, replacing generic SYNC_API_BASE_URL for campaign and campaignDonation methods while preserving other endpoints unchanged.

Changes

Cohort / File(s) Summary
Campaign API Configuration
src/common/api/indexer/sync.ts
Adds CAMPAIGNS_SYNC_API_BASE_URL constant with environment-conditional logic (test environment uses INDEXER_API_ENDPOINT_URL, otherwise "https://dev.potlock.io"). Updates campaign and campaignDonation methods to use this new base URL instead of the shared SYNC_API_BASE_URL. Updates comment to reflect campaign availability on dev backend.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Feature/campaign sync #577: Introduced the shared SYNC_API_BASE_URL for campaign sync calls that this PR now refactors with an environment-specific alternative.
  • Feature/campaign sync #576: Updates the same syncApi methods for campaign endpoints that are modified in this change.

Suggested reviewers

  • Ebube111

Poem

🐰 Hops through configs, base URLs align,
Test or prod, the campaigns will shine!
Dev backend ready, endpoints in place,
One URL per rabbit, a swifter race!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Feature/sync accounts lists' does not align with the actual changes, which involve configuring campaign API endpoints and base URLs in the sync service. Revise the title to accurately reflect the main change, such as 'Configure separate API base URL for campaign sync endpoints' or 'Add campaign-specific sync API configuration'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 feature/sync-accounts-lists

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
Contributor

@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

🤖 Fix all issues with AI agents
In `@src/common/api/indexer/sync.ts`:
- Around line 3-7: Replace the hardcoded campaigns URL by reading a new env var
(e.g., NEXT_PUBLIC_CAMPAIGNS_API_URL) instead of "https://dev.potlock.io" in
CAMPAIGNS_SYNC_API_BASE_URL, and update the top comment about SYNC_API_BASE_URL
to accurately reflect INDEXER_API_ENDPOINT_URL being environment-dependent; if
routing campaigns to dev is intentional and temporary, add a clear TEMPORARY
comment on CAMPAIGNS_SYNC_API_BASE_URL (e.g., "// TEMPORARY: campaigns only on
dev backend until migration to prod") so future maintainers know to revisit the
decision.

Comment on lines +3 to 7
// Campaigns only exist on dev backend, everything else is on prod
const SYNC_API_BASE_URL = INDEXER_API_ENDPOINT_URL;

const CAMPAIGNS_SYNC_API_BASE_URL =
process.env.NEXT_PUBLIC_ENV === "test" ? INDEXER_API_ENDPOINT_URL : "https://dev.potlock.io";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Hardcoded dev URL used for production campaign traffic is risky.

Two concerns:

  1. Hardcoded URL: "https://dev.potlock.io" should be extracted to an environment variable (e.g., NEXT_PUBLIC_CAMPAIGNS_API_URL) rather than hardcoded. This makes it easier to rotate endpoints and avoids embedding infrastructure details in application code.

  2. Production → dev backend: In non-test environments (including production), campaign sync calls will hit the dev server. If this is intentional and temporary, consider adding a more explicit comment (e.g., // TEMPORARY: campaigns are only deployed to dev backend until migration to prod) so future maintainers understand the intent and know to revisit it.

Also, the comment on line 3 ("everything else is on prod") is misleading since SYNC_API_BASE_URL resolves to INDEXER_API_ENDPOINT_URL, which is environment-dependent—not always prod.

Suggested improvement
-// Campaigns only exist on dev backend, everything else is on prod
-const SYNC_API_BASE_URL = INDEXER_API_ENDPOINT_URL;
-
-const CAMPAIGNS_SYNC_API_BASE_URL =
-  process.env.NEXT_PUBLIC_ENV === "test" ? INDEXER_API_ENDPOINT_URL : "https://dev.potlock.io";
+// Base URL for most sync endpoints (environment-aware)
+const SYNC_API_BASE_URL = INDEXER_API_ENDPOINT_URL;
+
+// TEMPORARY: Campaigns are only available on the dev backend until migrated to prod.
+// In test, use the standard indexer; otherwise, point to the dev backend.
+const CAMPAIGNS_SYNC_API_BASE_URL =
+  process.env.NEXT_PUBLIC_ENV === "test"
+    ? INDEXER_API_ENDPOINT_URL
+    : (process.env.NEXT_PUBLIC_CAMPAIGNS_API_URL ?? "https://dev.potlock.io");
🤖 Prompt for AI Agents
In `@src/common/api/indexer/sync.ts` around lines 3 - 7, Replace the hardcoded
campaigns URL by reading a new env var (e.g., NEXT_PUBLIC_CAMPAIGNS_API_URL)
instead of "https://dev.potlock.io" in CAMPAIGNS_SYNC_API_BASE_URL, and update
the top comment about SYNC_API_BASE_URL to accurately reflect
INDEXER_API_ENDPOINT_URL being environment-dependent; if routing campaigns to
dev is intentional and temporary, add a clear TEMPORARY comment on
CAMPAIGNS_SYNC_API_BASE_URL (e.g., "// TEMPORARY: campaigns only on dev backend
until migration to prod") so future maintainers know to revisit the decision.

@aunali8812 aunali8812 merged commit cfc60a2 into staging Feb 10, 2026
3 of 4 checks passed
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.

1 participant