Skip to content

Fix: add missing dart:math import in capture_provider + bump to 781#5709

Closed
beastoin wants to merge 2 commits intomainfrom
fix/capture-provider-dart-math
Closed

Fix: add missing dart:math import in capture_provider + bump to 781#5709
beastoin wants to merge 2 commits intomainfrom
fix/capture-provider-dart-math

Conversation

@beastoin
Copy link
Collaborator

Summary

  • Adds missing import 'dart:math'; to capture_provider.dart — fixes Codemagic build failure
  • min(), pow(), Random() at line 1328-1329 require dart:math
  • Bumps build to +781 (both +779 and +780 failed to upload)

Context

Codemagic iOS+Android builds have been failing since this import was missing. This was introduced by a recent PR that added exponential backoff reconnect logic without the required import.

Please wait ~5 min after merging before merging other app PRs to avoid cancel_previous_builds cancellation.

🤖 Generated with Claude Code

beastoin and others added 2 commits March 16, 2026 08:14
Fixes Codemagic build failure — min(), pow(), Random() require dart:math.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 16, 2026

Greptile Summary

This is a minimal, surgical fix that adds a missing import 'dart:math'; to capture_provider.dart and bumps the build number to 781. The import is required by min(), pow(), and Random() used in the _getReconnectDelay() exponential backoff reconnect logic (lines 1328–1331), which was introduced by a prior PR without the necessary import, causing Codemagic CI build failures for both iOS and Android.

Key changes:

  • import 'dart:math'; added in the correct alphabetical position among dart: imports in capture_provider.dart
  • Build number incremented from 780 → 781 in pubspec.yaml (skipping 779 and 780 due to failed uploads)

No issues found. The fix is correct and complete — all three dart:math symbols (min, pow, Random) are now properly covered by the added import.

Confidence Score: 5/5

  • This PR is safe to merge — it adds a single missing stdlib import and bumps the build number with no logic changes.
  • The change is minimal and surgical: one import line and one version number. The import is correct, correctly placed, and directly resolves the documented CI build failure. The exponential backoff logic it enables was already reviewed in the prior PR that introduced it.
  • No files require special attention.

Important Files Changed

Filename Overview
app/lib/providers/capture_provider.dart Adds missing import 'dart:math'; required by min(), pow(), and Random() calls in the _getReconnectDelay() exponential backoff method. Import is placed correctly in alphabetical order among dart: imports.
app/pubspec.yaml Build number bumped from 780 to 781; version string remains 1.0.526. Straightforward version increment consistent with the PR description skipping +779 and +780 due to failed uploads.

Sequence Diagram

sequenceDiagram
    participant WS as WebSocket
    participant CP as CaptureProvider
    participant Math as dart:math

    WS->>CP: onDisconnected(closeCode)
    CP->>CP: _startKeepAliveServices()
    CP->>CP: _getReconnectDelay()
    CP->>Math: pow(2, _reconnectAttempt)
    CP->>Math: min(powResult, 120)
    CP->>Math: Random().nextInt(cap * 1000)
    Math-->>CP: jitterMs (exponential backoff delay)
    CP->>CP: schedule reconnect after Duration(ms: jitterMs)
    CP->>CP: _reconnectAttempt++
    CP-->>WS: reconnect attempt
Loading

Last reviewed commit: 6b1fbad

@beastoin
Copy link
Collaborator Author

Closing — reverting the root cause PR #5617 instead of patching the import.

@beastoin beastoin closed this Mar 16, 2026
@github-actions
Copy link
Contributor

Hey @beastoin 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our roadmap and vision

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community! 💜

@beastoin beastoin reopened this Mar 16, 2026
@beastoin beastoin closed this Mar 16, 2026
@github-actions
Copy link
Contributor

Hey @beastoin 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our roadmap and vision

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community! 💜

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