Skip to content

Backend/enh/added-flag-for-api-forwarding#1399

Open
H-C-21 wants to merge 1 commit into
mainfrom
backend/enh/added-flag-for-runInMasterCloud
Open

Backend/enh/added-flag-for-api-forwarding#1399
H-C-21 wants to merge 1 commit into
mainfrom
backend/enh/added-flag-for-runInMasterCloud

Conversation

@H-C-21

@H-C-21 H-C-21 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved cloud request routing so forwarding only happens when the target cloud is valid and different from the current one.
    • Requests with no target cloud now stay on the local path instead of being forwarded.
    • Forwarding now more reliably falls back to direct handling when required connection settings are missing.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a22eca73-e1c2-4396-8461-b669b8d1d0ba

📥 Commits

Reviewing files that changed from the base of the PR and between d8900c4 and 436da5a.

📒 Files selected for processing (2)
  • lib/mobility-core/src/Kernel/External/MasterCloudForward.hs
  • lib/mobility-core/test-integration/Main.hs

Walkthrough

Introduces shouldForwardToCloud, a predicate comparing target and current CloudType, and rewires runThroughMasterCloud to use it alongside lookupCloudType for forwarding decisions, replacing the prior Bool parameter with Maybe CloudType. Updates the integration test call site accordingly.

Changes

Cloud-based forwarding logic

Layer / File(s) Summary
shouldForwardToCloud predicate and exports
lib/mobility-core/src/Kernel/External/MasterCloudForward.hs
Exports and defines shouldForwardToCloud :: CloudType -> Maybe CloudType -> Bool, forwarding only when target is Just, not UNAVAILABLE, and differs from current cloud; adds CloudType/lookupCloudType imports.
runThroughMasterCloud rewiring and test call site
lib/mobility-core/src/Kernel/External/MasterCloudForward.hs, lib/mobility-core/test-integration/Main.hs
Replaces the Bool gating parameter with Maybe CloudType, using lookupCloudType and shouldForwardToCloud plus masterUrl/masterSecret presence to decide between interpretWithForwarder and direct L.callAPI'; test call updated from True to Just AWS.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant runThroughMasterCloud
  participant shouldForwardToCloud
  participant interpretWithForwarder
  participant CallAPI as L.callAPI'

  Caller->>runThroughMasterCloud: invoke with Maybe CloudType target
  runThroughMasterCloud->>runThroughMasterCloud: lookupCloudType (current cloud)
  runThroughMasterCloud->>shouldForwardToCloud: check(currentCloud, targetCloud)
  shouldForwardToCloud-->>runThroughMasterCloud: Bool result
  alt should forward and masterUrl/masterSecret present
    runThroughMasterCloud->>interpretWithForwarder: forward request
  else
    runThroughMasterCloud->>CallAPI: direct call
  end
Loading

Possibly related PRs

  • nammayatri/shared-kernel#1395: Both PRs modify runThroughMasterCloud and its integration test call site, changing the forwarding gate from a raw Bool flag to cloud-comparison-based logic.

Suggested reviewers: sidsethu

Poem

A hop, a skip, a cloud compared,
No more True flags left unpaired.
Now clouds decide who forwards where,
With Just AWS sent through the air. ☁️🐇
Thump-thump — the routing logic's fair!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to the change by indicating API forwarding logic was adjusted, even though it's branch-like and not very polished.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backend/enh/added-flag-for-runInMasterCloud

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.

@coderabbitai coderabbitai Bot requested a review from sidsethu July 3, 2026 12:59
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