Skip to content

fix: uri handling, ci test setup#4556

Merged
jamesarich merged 9 commits into
mainfrom
fix/channeltest
Feb 14, 2026
Merged

fix: uri handling, ci test setup#4556
jamesarich merged 9 commits into
mainfrom
fix/channeltest

Conversation

@jamesarich

@jamesarich jamesarich commented Feb 14, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces improvements to Meshtastic URL handling, NFC intent support, and test coverage for shared contacts. The main changes include refining URI parsing logic for shared contacts, consolidating NFC intent filters in the Android manifest, and expanding unit tests to cover invalid URL scenarios. Additionally, workflow scripts are updated to better control linting, unit, and instrumented test execution.

Improvements to Meshtastic URL handling and shared contact parsing:

  • Updated toSharedContact in SharedContact.kt to improve host and path validation, handle fragments with query parameters, and provide more informative error messages when parsing fails.
  • Expanded SharedContactTest.kt with tests for invalid paths and missing fragments, ensuring exceptions are thrown for malformed URLs.
  • Changed test references from URL_PREFIX to CHANNEL_URL_PREFIX for consistency in ChannelTest.kt. [1] [2]

Android manifest and NFC intent filter consolidation:

  • Consolidated NFC NDEF Discovery support into a single intent filter for Meshtastic URLs, removing redundant filters and adding NFC action to the main intent filter in AndroidManifest.xml. [1] [2]

Workflow script improvements:

  • Modified .github/workflows/reusable-check.yml to separately control linting and unit test tasks, and improved instrumented test task assignment based on flavor and API level. [1] [2]

This commit updates the `reusable-check.yml` GitHub Actions workflow to include unit tests (`testDebugUnitTest`) and instrumented tests (`connectedDebugAndroidTest`).

Additionally, it refactors a constant by renaming `URL_PREFIX` to `CHANNEL_URL_PREFIX` in `ChannelTest.kt` for improved clarity.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@github-actions github-actions Bot added the bugfix PR tag label Feb 14, 2026
This commit updates the `reusable-check.yml` GitHub Actions workflow to include unit tests (`testDebugUnitTest`) and instrumented tests (`connectedDebugAndroidTest`).

Additionally, it refactors a constant by renaming `URL_PREFIX` to `CHANNEL_URL_PREFIX` in `ChannelTest.kt` for improved clarity.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@codecov

codecov Bot commented Feb 14, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
306 1 305 1
View the top 1 failed test(s) by shortest run time
org.meshtastic.feature.firmware.ota.BleOtaTransportErrorTest::streamFirmware fails on hash mismatch at verification
Stack Traces | 0.107s run time
java.lang.IllegalStateException: Peripheral not connected
	at no.nordicsemi.kotlin.ble.client.mock.PeripheralSpec.estimateTransferDuration-3nIYWDw$client_mock(PeripheralSpec.kt:275)
	at no.nordicsemi.kotlin.ble.client.mock.PeripheralSpec$simulateValueUpdate$1.invokeSuspend(PeripheralSpec.kt:535)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Makes the parsing of `meshtastic.org` URLs more resilient to variations.

- Ignores case when checking the URL host.
- Handles fragments that may contain query parameters, which can be added by older Apple/web clients, by stripping them before decoding.
- Adds more detailed error messages for invalid URLs.
- Includes new unit tests for invalid paths and missing URL fragments.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
The `NDEF_DISCOVERED` action has been merged into the existing `VIEW` intent filter. This consolidates the handling for both NFC tag discoveries and standard URL views for `meshtastic.org` links into a single, more efficient filter.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@jamesarich jamesarich changed the title ci: Add unflavored unit and instrumented tests to workflow fix: uri handling, ci test setup Feb 14, 2026
This change enhances the parsing logic for Meshtastic shared contact URLs to be more lenient and robust.

- Use bitwise `or` for combining Base64 flags, which is the correct operator for flag combinations.
- Accommodate different Base64 encodings by using a more flexible decoder (`Base64.DEFAULT or Base64.URL_SAFE`).
- Improve error messages for decoding failures to provide more specific context.

Additionally, the corresponding unit tests have been updated to be more dynamic and less reliant on hardcoded URL strings.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Refactors the `toSharedContact` extension function to improve URL validation and error handling. The logic is split into smaller, private functions (`checkSharedContactUrl` and `decodeSharedContactData`) for better clarity.

Key changes:
- Adds stricter checks for invalid Base64 and malformed Protobuf data within the URL fragment.
- Throws `MalformedURLException` with the original exception as the cause for better debugging.
- Adds unit tests to verify that invalid Base64 and Protobuf data correctly throw exceptions.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces support for navigation-specific deep links.

- A new `SharedFlow` is added to `UIState` to handle navigation deep link URIs.
- `MainActivity` is updated to distinguish between standard Meshtastic URI actions and new navigation deep links, directing them to the new flow.
- The `handleIntent` call in `onCreate` is now only triggered on initial creation (`savedInstanceState == null`) to prevent re-processing the intent on configuration changes.
- `MainScreen` now observes the navigation deep link flow and uses the `navController` to navigate to the provided URI.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@jamesarich jamesarich added this pull request to the merge queue Feb 14, 2026
Merged via the queue into main with commit 0f03492 Feb 14, 2026
8 checks passed
@jamesarich jamesarich deleted the fix/channeltest branch February 14, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant