Skip to content

Fix build errors from PR #125 merge conflicts#127

Closed
candour wants to merge 2 commits into
mainfrom
fix-build-errors-merge-conflicts-6664718825561854739
Closed

Fix build errors from PR #125 merge conflicts#127
candour wants to merge 2 commits into
mainfrom
fix-build-errors-merge-conflicts-6664718825561854739

Conversation

@candour
Copy link
Copy Markdown
Owner

@candour candour commented May 6, 2026

This PR fixes the build errors that occurred after merging PR #125. The issues were caused by incorrect merge conflict resolution. Specifically, a redundant import was left in GridUtils.kt, and calculateStatBoost was incorrectly defined to take a GameState object when its call sites were passing a Map of hexes. The logic within calculateStatBoost was also updated to correctly use the passed map and handle stall references safely.


PR created automatically by Jules for task 6664718825561854739 started by @candour

Summary by CodeRabbit

  • Refactor
    • Improved internal stat-boost calculation to make neighbor detection and boost aggregation more reliable.
    • Internal architecture tweaks to increase maintainability and testing robustness for game mechanics.
    • Cleaned up imports and internal utilities to improve code organization and future extensibility.

- Removed redundant AxialCoordinate import in GridUtils.kt.
- Refactored calculateStatBoost in MainViewModel.kt to accept Map<AxialCoordinate, HexTile> instead of GameState, matching existing call sites.
- Fixed unresolved references (hexes, stall) within calculateStatBoost logic.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e43621c7-942d-4008-bdca-a4de37437396

📥 Commits

Reviewing files that changed from the base of the PR and between bee7baf and 7c6d802.

📒 Files selected for processing (1)
  • app/src/main/java/com/messark/hawker/MainViewModel.kt

📝 Walkthrough

Walkthrough

calculateStatBoost in MainViewModel was refactored to accept a Map<AxialCoordinate, HexTile> (hexes) instead of GameState; it now reads adjacent tiles from that map with nullable-safe access and computes the same BoostResult. GridUtils imports were adjusted to include PreciseAxialCoordinate and kotlin.math.abs.

Changes

Stat Boost Decoupling

Layer / File(s) Summary
Signature / Data Shape
app/src/main/java/com/messark/hawker/MainViewModel.kt
calculateStatBoost signature changed from (coord: AxialCoordinate, state: GameState) to (coord: AxialCoordinate, hexes: Map<AxialCoordinate, HexTile>).
Core Logic
app/src/main/java/com/messark/hawker/MainViewModel.kt
Function now reads adjacent tiles from the provided hexes map using nullable-safe access (tile?.stall), sums damage for neighboring active BAK_KUT_TEH stalls (disabledWaves == 0), collects provider coordinates, and returns BoostResult(multiplier, providerCoords) unchanged.
Support Infrastructure
app/src/main/java/com/messark/hawker/utils/GridUtils.kt
Imports updated to include PreciseAxialCoordinate and kotlin.math.abs; no public API changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • candour/towerpower#126: Directly related refactor of MainViewModel.calculateStatBoost to accept a hex map and adjust adjacency logic.
  • candour/towerpower#125: Earlier PR that introduced calculateStatBoost and related GridUtils utilities referenced by this change.
🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: fixing build errors caused by merge conflict resolution from PR #125.
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.

✏️ 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-build-errors-merge-conflicts-6664718825561854739

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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

Copy link
Copy Markdown
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.

Caution

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

⚠️ Outside diff range comments (1)
app/src/main/java/com/messark/hawker/MainViewModel.kt (1)

1216-1229: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Unsafe non-null access on Stall? — compile error in Kotlin 2.1.0

stall has type Stall? (from tile?.stall). The condition stall?.stallType == StallType.BAK_KUT_TEH uses a safe-call equality, which does not trigger Kotlin smart cast. As a result, both stall.disabledWaves (line 1223) and stall.damage (line 1224) are non-null member accesses on a nullable type, causing a compile error.

Add an explicit stall != null guard to enable smart cast for subsequent accesses:

Proposed fix
         adjacentCoords.forEach { adj ->
             val tile = hexes[adj]
             val stall = tile?.stall
-            if (stall?.stallType == StallType.BAK_KUT_TEH && stall.disabledWaves == 0) {
+            if (stall != null && stall.stallType == StallType.BAK_KUT_TEH && stall.disabledWaves == 0) {
                 totalBoostPercent += stall.damage // Bak Kut Teh damage field stores its current boost %
                 providers.add(adj)
             }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ca039f37-3544-4a31-9d49-4fdae5c12d26

📥 Commits

Reviewing files that changed from the base of the PR and between 4d67159 and bee7baf.

📒 Files selected for processing (2)
  • app/src/main/java/com/messark/hawker/MainViewModel.kt
  • app/src/main/java/com/messark/hawker/utils/GridUtils.kt
💤 Files with no reviewable changes (1)
  • app/src/main/java/com/messark/hawker/utils/GridUtils.kt

@candour
Copy link
Copy Markdown
Owner Author

candour commented May 6, 2026

stall has type Stall? (from tile?.stall). The condition stall?.stallType == StallType.BAK_KUT_TEH uses a safe-call equality, which does not trigger Kotlin smart cast. As a result, both stall.disabledWaves (line 1223) and stall.damage (line 1224) are non-null member accesses on a nullable type, causing a compile error.

Add an explicit stall != null guard to enable smart cast for subsequent accesses:

@google-labs-jules
Copy link
Copy Markdown
Contributor

stall has type Stall? (from tile?.stall). The condition stall?.stallType == StallType.BAK_KUT_TEH uses a safe-call equality, which does not trigger Kotlin smart cast. As a result, both stall.disabledWaves (line 1223) and stall.damage (line 1224) are non-null member accesses on a nullable type, causing a compile error.

Add an explicit stall != null guard to enable smart cast for subsequent accesses:

Good catch! I've added the explicit null check for stall to enable smart casting and resolve the compile error. Thank you for the feedback.

- Added explicit null check for stall to enable Kotlin smart casting.
- This resolves a compile error where stall properties were accessed on a nullable type.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

@candour candour closed this May 7, 2026
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