Skip to content

fix(ci): unbreak the ktlint and SwiftLint gates that are red on main - #609

Merged
shubhammalhotra28 merged 2 commits into
RunanywhereAI:mainfrom
ayaangazali:bugfix/kotlin-ktlint-declaration-spacing
Jul 31, 2026
Merged

fix(ci): unbreak the ktlint and SwiftLint gates that are red on main#609
shubhammalhotra28 merged 2 commits into
RunanywhereAI:mainfrom
ayaangazali:bugfix/kotlin-ktlint-declaration-spacing

Conversation

@ayaangazali

@ayaangazali ayaangazali commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What

Two one-line lint fixes, both for violations that currently fail CI on main. Both were introduced by #604 (merged 2026-07-30); nothing else in that PR's behaviour is touched.

1. kotlin-androidktlintMainSourceSetCheck

AndroidConnectTransport.kt:449:9 Declarations and declarations with comments
should have an empty space between. (standard:spacing-between-declarations-with-comments)

The KDoc on GENERATION_READ_TIMEOUT_MS sits directly against the preceding const val in the companion object. Added the blank line ktlint asks for.

2. swift-spm — SwiftLint (error-level rule)

ConnectSession.swift:285:51: error: Force Unwrapping Violation:
Force unwrapping should be avoided (force_unwrapping)

try await group.next()! force-unwraps the first result of the connect/timeout task group. Replaced with a guard that throws the same ConnectTransportError.network the timeout child task already throws, so the race-the-handshake behaviour is unchanged on the real path.

Why

These are not branch-specific — they redden CI for every PR on current main:

Grouped in one PR because the concern is identical (unbreak the lint gates) and merging only half of it still leaves CI red.

Testing

  • ./gradlew ktlintMainSourceSetCheck in sdk/runanywhere-kotlin (JDK 17) — BUILD SUCCESSFUL. Re-run with the change stashed — BUILD FAILED on exactly the line above, confirming this is the fix.
  • kotlin-android already passed on this PR's first commit in CI.
  • Swift: I could not run SwiftLint locally — this host has only the Command Line Tools, and SwiftLint 0.65 aborts loading sourcekitdInProc. I verified swiftc -parse on the file is clean and that no force unwrap remains, and am relying on CI's swift-spm job for the authoritative lint check. Flagging that explicitly rather than implying a gate I did not run.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved connection handling by safely reporting network errors when a connection attempt does not return a result.
    • Reduced the risk of unexpected failures during connection races.
  • Style

    • Improved code formatting for better readability.

…mpanion

ktlintMainSourceSetCheck fails on main with:

  AndroidConnectTransport.kt:449:9 Declarations and declarations with
  comments should have an empty space between.
  (standard:spacing-between-declarations-with-comments)

The KDoc on GENERATION_READ_TIMEOUT_MS follows the preceding const
declaration with no blank line between them. Add the blank line so the
kotlin-android job goes green again.

Signed-off-by: ayaangazali <ayaangazali.work@gmail.com>
Copilot AI review requested due to automatic review settings July 31, 2026 18:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Updated Swift connection race handling to throw a network error when no handshake result exists. Added a blank line in the Kotlin connection transport companion object.

Changes

Swift connection session

Layer / File(s) Summary
Handshake result validation
sdk/runanywhere-swift/Sources/RunAnywhere/Public/Connect/ConnectSession.swift
The connection race now guards the task group's result and throws a descriptive network error when no handshake response is produced.

Android connection transport

Layer / File(s) Summary
Companion object formatting
sdk/runanywhere-kotlin/src/main/kotlin/com/runanywhere/sdk/foundation/connect/AndroidConnectTransport.kt
Inserted a blank line between heartbeat timeout constants and the generation timeout comment.

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

Suggested reviewers: shubhammalhotra28

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly describes the primary changes: restoring the failing ktlint and SwiftLint CI gates.
Description check ✅ Passed The description clearly explains both fixes, their purpose, and testing results, but it omits several template sections such as type, labels, and checklist.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

The swift-spm job fails on main with:

  ConnectSession.swift:285:51: error: Force Unwrapping Violation:
  Force unwrapping should be avoided (force_unwrapping)

Replace `try await group.next()!` with a guard that throws the same
ConnectTransportError.network used by the timeout child task, so the
race-the-handshake behaviour is unchanged on the real path and the
error-level SwiftLint rule is satisfied.

Signed-off-by: ayaangazali <ayaangazali.work@gmail.com>
@ayaangazali ayaangazali changed the title fix(kotlin): add blank line before KDoc in AndroidConnectTransport companion fix(ci): unbreak the ktlint and SwiftLint gates that are red on main Jul 31, 2026
@shubhammalhotra28

Copy link
Copy Markdown
Contributor

Thanks for the fix @ayaangazali

@shubhammalhotra28
shubhammalhotra28 merged commit 932f6b6 into RunanywhereAI:main Jul 31, 2026
26 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.

3 participants