Skip to content

Fix Managed Navigation State, Chat Rendering & Test Stability - #34

Merged
lukaskollmer merged 10 commits into
mainfrom
fix-managed-navigation-state
Aug 9, 2026
Merged

Fix Managed Navigation State, Chat Rendering & Test Stability#34
lukaskollmer merged 10 commits into
mainfrom
fix-managed-navigation-state

Conversation

@PSchmiedmayer

@PSchmiedmayer PSchmiedmayer commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

♻️ Current Situation & Problem

  • Managed navigation can emit state warnings and fail to advance on newer iOS versions.
  • Chat messages need a safe fallback when the Textual package trait is unavailable.

⚙️ Release Notes

  • Fix managed navigation path updates.
  • Render chat messages with native SwiftUI text as a best-effort fallback.
  • Improve UI test reliability, including the Health Records flow.

Code of Conduct & Contributing Guidelines

By creating and submitting this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@PSchmiedmayer PSchmiedmayer self-assigned this Aug 8, 2026
Copilot AI lite review requested due to automatic review settings August 8, 2026 05:41
@PSchmiedmayer PSchmiedmayer added the enhancement New feature or request label Aug 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@lukaskollmer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d97215d7-373f-4984-a21a-ed74ec5d3b43

📥 Commits

Reviewing files that changed from the base of the PR and between a09b48d and 2a3216c.

📒 Files selected for processing (2)
  • Sources/SpeziViews/Views/ManagedNavigationStack/ManagedNavigationStack+Path.swift
  • Tests/SpeziViewsTests/ManagedNavigationStackStepIdentifierTests.swift
📝 Walkthrough

Walkthrough

ManagedNavigationStack now observes path steps and configures an unconfigured path during its initial change handling. Related tests use explicit or environment-provided paths. HealthKit account connection now uses a helper with waits, scrolling, permission handling, and failure checks. MessageView renders attributed content when Textual is unavailable. Two UI tests use five-second waits.

Sequence Diagram(s)

sequenceDiagram
  participant AuthorizationFlow
  participant HealthApp
  participant XCTest
  AuthorizationFlow->>XCTest: call connectHealthRecordAccount
  XCTest->>HealthApp: complete onboarding and account connection
  HealthApp-->>XCTest: return setup state
  XCTest-->>AuthorizationFlow: return when setup fails
Loading

Possibly related PRs

🚥 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
Title check ✅ Passed The title clearly summarizes the main navigation, chat rendering, and test stability changes.
Description check ✅ Passed The description accurately covers the managed navigation, chat fallback, and UI test reliability changes.
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 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@Sources/SpeziViews/Views/ManagedNavigationStack/ManagedNavigationStack.swift`:
- Line 123: Update ManagedNavigationStack so the effective navigation path is
reconfigured whenever externalPath changes, before body selects externalPath ??
internalPath. Ensure a later nil externalPath does not leave the persisted
internalPath using stale steps, while preserving the existing external path when
it is provided.

In `@Sources/XCTHealthKit/XCTest`+HealthRecord.swift:
- Line 144: Update the flow around getStartedButton.isHittable to guard against
a non-hittable button: record the assertion failure and return before invoking
tap(). Preserve the existing tap behavior when the button is hittable.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e6ac5cf7-0dab-47c3-957b-dcea08b07c4f

📥 Commits

Reviewing files that changed from the base of the PR and between e7a66a4 and 78ccbae.

📒 Files selected for processing (4)
  • Sources/SpeziViews/Views/ManagedNavigationStack/ManagedNavigationStack.swift
  • Sources/XCTHealthKit/XCTest+HealthRecord.swift
  • Tests/SpeziViewsTests/ManagedNavigationStackStepIdentifierTests.swift
  • Tests/SpeziViewsTests/UITests/TestApp/ViewsTests/ManagedNavigationStackTestView.swift

Comment thread Sources/SpeziViews/Views/ManagedNavigationStack/ManagedNavigationStack.swift Outdated
Comment thread Sources/XCTHealthKit/XCTest+HealthRecord.swift Outdated
@PSchmiedmayer PSchmiedmayer changed the title Fix Managed Navigation State & Test Stability Fix Managed Navigation State, Chat Rendering & Test Stability Aug 8, 2026

@coderabbitai coderabbitai Bot 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.

♻️ Duplicate comments (1)
Sources/SpeziViews/Views/ManagedNavigationStack/ManagedNavigationStack.swift (1)

123-123: 🎯 Functional Correctness | 🟠 Major

Configure the state-backed internal path.

let internalPath = Path() creates a new path on every initializer call. SwiftUI can retain the existing @State storage, so State(initialValue: internalPath) does not replace self.internalPath when the view keeps the same identity. If the stack is first created with an external path and later rebuilt with externalPath == nil, lines 173-175 configure the new local path, but body reads the persisted self.internalPath at line 127. The internal path can remain unconfigured or stale, which can block navigation. Configure the effective state-backed path after state installation, and add a regression test for the external-path-to-nil transition.

Also applies to: 167-175

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Sources/SpeziViews/Views/ManagedNavigationStack/ManagedNavigationStack.swift`
at line 123, Update ManagedNavigationStack initialization so the effective
internal path is configured on the installed `@State-backed` internalPath, not
only on the temporary initializer-local Path; ensure the external-path-to-nil
transition updates the persisted state that body reads. Add a regression test
covering this transition and verifying navigation uses the newly configured
local path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In
`@Sources/SpeziViews/Views/ManagedNavigationStack/ManagedNavigationStack.swift`:
- Line 123: Update ManagedNavigationStack initialization so the effective
internal path is configured on the installed `@State-backed` internalPath, not
only on the temporary initializer-local Path; ensure the external-path-to-nil
transition updates the persisted state that body reads. Add a regression test
covering this transition and verifying navigation uses the newly configured
local path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c0de381-926f-47bc-b8a0-9e08edbc2f26

📥 Commits

Reviewing files that changed from the base of the PR and between 78ccbae and b5ce1a1.

📒 Files selected for processing (5)
  • Sources/SpeziChat/MessageView.swift
  • Sources/SpeziViews/Views/ManagedNavigationStack/ManagedNavigationStack.swift
  • Sources/XCTHealthKit/XCTest+HealthRecord.swift
  • Tests/SpeziViewsTests/UITests/TestAppUITests/SpeziPersonalInfo/PersonalInfoViewsTests.swift
  • Tests/SpeziViewsTests/UITests/TestAppUITests/SpeziViews/EnvironmentTests.swift

@lukaskollmer lukaskollmer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looking very good

Comment thread Sources/SpeziChat/MessageView.swift
@lukaskollmer
lukaskollmer merged commit 0bad062 into main Aug 9, 2026
31 of 33 checks passed
@lukaskollmer
lukaskollmer deleted the fix-managed-navigation-state branch August 9, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants