Skip to content

fix: fallback to StartNodeWithOptions - #5

Merged
codeh007 merged 1 commit into
mainfrom
fix/startnode-fallback
Mar 28, 2026
Merged

codeh007 merged 1 commit into
mainfrom
fix/startnode-fallback

Conversation

@codeh007

@codeh007 codeh007 commented Mar 28, 2026 •

Copy link
Copy Markdown
Owner

Why\nThe current AAR (android-swarm-20260327-2042) does not export StartNode(String, Config). Without a fallback, the Android app cannot start a node even after UI fixes.\n\n## What\n- Detect StartNode(String, Config) vs StartNodeWithOptions(String, String, String, boolean) by reflection.\n- Call StartNodeWithOptions when StartNode is unavailable.\n\n## Result\nThe host can start a node once the new AAR exposing StartNodeWithOptions is published.\n

Summary by CodeRabbit

  • Refactor
    • Improved the initialization process to better resolve and handle startup method calls, with enhanced error reporting when startup configuration cannot be properly established.

@coderabbitai

coderabbitai Bot commented Mar 28, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eafff70c-b7c3-4c2c-ac39-d9e2dcef0816

📥 Commits

Reviewing files that changed from the base of the PR and between 2bb105c and d15c9a7.

📒 Files selected for processing (1)
  • app/src/main/java/com/gomtm/android/swarm/SwarmRuntime.kt

📝 Walkthrough

Walkthrough

Updated SwarmRuntime.start() to conditionally select between two bridge start method signatures via runtime reflection: StartNode/startNode(String, Config) or StartNodeWithOptions/startNodeWithOptions(String, String, String, boolean). Added a private hasMethod() helper to probe for method availability and optimized baseDir computation.

Changes

Cohort / File(s) Summary
SwarmRuntime Reflection Logic
app/src/main/java/com/gomtm/android/swarm/SwarmRuntime.kt
Modified start() method to probe and conditionally invoke either StartNode or StartNodeWithOptions bridge signatures using runtime reflection. Added hasMethod() helper for method availability checks. Throws IllegalStateException if neither signature is found. Optimized baseDir computation to avoid redundant calls.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A bridge so many paths may take,
Which method should our runtime make?
With reflection's lens, we seek the way,
StartNode or Options—let code play!
Two signatures dance, we pick the best, ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: fallback to StartNodeWithOptions' clearly and specifically describes the main change: adding a fallback mechanism to use StartNodeWithOptions when StartNode is unavailable.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/startnode-fallback

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.

@codeh007
codeh007 merged commit cc28a89 into main Mar 28, 2026
2 checks passed
@codeh007
codeh007 deleted the fix/startnode-fallback branch March 28, 2026 08:50
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