Skip to content

chore: post-0.0.103 cleanup — SonarCloud reliability + promote-as-draft fix#560

Open
alichherawalla wants to merge 2 commits into
mainfrom
chore/post-release-cleanup
Open

chore: post-0.0.103 cleanup — SonarCloud reliability + promote-as-draft fix#560
alichherawalla wants to merge 2 commits into
mainfrom
chore/post-release-cleanup

Conversation

@alichherawalla

@alichherawalla alichherawalla commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to the 0.0.103 release. Two concerns, both concrete and testable:

1. SonarCloud reliability (the quality gate that failed at merge — new_reliability_rating=D)

Resolves the core-repo new-code bugs:

  • activeDownloadPersistence.sort() given an explicit string comparator (deterministic signature).
  • useVoiceDownloadItems / modelPreloadercallHook returns R | undefined, so no Promise actually reached a boolean condition; rewritten as await …?.catch() / await callHook(...) so SonarJS no-misused-promises is satisfied. Behaviour-neutral.
  • modelManager.testdownloadId is typed string; the mock returned a number and assertions compared to 42. Aligned every downloadId to '42' so runtime + type + assertions match.
  • Android delete() — the ignored Boolean return is now logged on a failed best-effort cleanup (DownloadManagerModule + WorkerDownload), matching the existing pattern in WorkerDownload.

2. promote.sh lands Play production as a DRAFT

The android promote lane set release_status: 'draft', but a track promotion reads track_promote_release_status — which defaulted to completed, so promote.sh sent 0.0.103 straight to Play review/100% rollout instead of pausing as a draft. Added track_promote_release_status: 'draft'.

Deliberately NOT in this PR

  • iOS tap-to-edit / keyboard flicker — pre-existing (repros on the live TestFlight build), never root-caused; needs on-device iteration. A guessed fix with no red-verify would violate the testing bar. Separate branch.
  • Fit-chip UX — a feature (build + wire + design), not cleanup. Separate PR.
  • SonarCloud Feat/testing e2e cleanup #2 (McpServerModal) — lives in the pro/ submodule → separate pro-repo PR.

Gates: tsc / eslint / knip / depcruise clean; affected jest suites green (the one pre-push failure was a known heavy-memory flake — passes in isolation).

Summary by CodeRabbit

  • Bug Fixes
    • Improved cleanup when cancelling downloads, with warnings when incomplete files cannot be deleted.
    • Fixed voice-model deletion handling when optional audio features are unavailable.
    • Ensured background download identifiers are handled consistently.
    • Improved reliability of persisted download state updates.
    • Corrected Android release promotion behavior to remain in draft status.

SonarCloud's quality gate flagged new_reliability_rating=D on the release. Fix the core-repo bugs:
- activeDownloadPersistence: give .sort() an explicit string comparator (deterministic signature).
- useVoiceDownloadItems / modelPreloader: callHook returns R|undefined, so a Promise never actually
  reached a boolean condition — await the optional chain (?./await undefined) instead so no Promise
  sits in a conditional (SonarJS no-misused-promises).
- modelManager.test: downloadId is typed string; the mock returned a number and assertions compared
  against 42 — align every downloadId to '42' so the assertion types match at runtime.
- Android delete(): use the Boolean return — log a warning on a failed best-effort cleanup, matching
  the existing pattern in WorkerDownload (both DownloadManagerModule + WorkerDownload).

(SonarCloud #2 McpServerModal is in the pro/ submodule — separate pro PR.)
…_release_status)

The android promote lane set release_status: 'draft', but a track PROMOTION reads
track_promote_release_status — which defaulted to 'completed'. So scripts/promote.sh sent 0.0.103
straight to Play review/100% rollout instead of parking as a draft for a human to confirm the
rollout % (device 2026-07-16). Set track_promote_release_status: 'draft' so it actually pauses.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The changes update background-download tests for string identifiers, log failed Android cleanup deletions, handle optional hooks, make download persistence ordering deterministic, and configure draft status for Play Store track promotion.

Changes

Download lifecycle handling

Layer / File(s) Summary
String background download identifiers
__tests__/unit/services/modelManager.test.ts
Background-download mocks, callback registrations, metadata assertions, and mmproj completion scenarios now use string downloadId values.
Cancellation cleanup logging
android/app/src/main/java/ai/offgridmobile/download/DownloadManagerModule.kt, android/app/src/main/java/ai/offgridmobile/download/WorkerDownload.kt
Cancelled-download cleanup detects failed file deletion and emits warning logs.
Deterministic persistence signatures
src/services/activeDownloadPersistence.ts
Persisted active-download signatures use an explicit lexicographic comparator.

Optional hook handling

Layer / File(s) Summary
Optional hook calls
src/screens/DownloadManagerScreen/useVoiceDownloadItems.ts, src/services/modelPreloader.ts
Voice deletion conditionally awaits its hook, while TTS preloading directly awaits the audio preload hook result.

Play Store promotion configuration

Layer / File(s) Summary
Track promotion status
fastlane/Fastfile
The Android promotion lane sets track_promote_release_status to "draft".

Estimated code review effort: 3 (Moderate) | ~15 minutes

Suggested reviewers: dishit-wednesday

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the main changes, but it omits key template sections like Type of Change, Checklist, and Related Issues. Add the missing template sections and fill in the required checkboxes, or explicitly note which sections are intentionally not applicable.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main changes: SonarCloud reliability fixes and the Play promotion draft fix.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/post-release-cleanup

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
android/app/src/main/java/ai/offgridmobile/download/DownloadManagerModule.kt (1)

166-166: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use existing constant for the log tag.

The module already defines const val NAME = "DownloadManagerModule" in its companion object. Consider reusing this constant instead of a hardcoded string.

♻️ Proposed refactor
-                        if (file.exists() && !file.delete()) Log.w("DownloadManagerModule", "Failed to delete cancelled download file: ${file.path}")
+                        if (file.exists() && !file.delete()) Log.w(NAME, "Failed to delete cancelled download file: ${file.path}")
🤖 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 `@android/app/src/main/java/ai/offgridmobile/download/DownloadManagerModule.kt`
at line 166, Update the warning log in the cancelled-download cleanup branch to
use the existing companion-object constant NAME as its tag instead of the
hardcoded "DownloadManagerModule" string, preserving the current message and
behavior.
__tests__/unit/services/modelManager.test.ts (1)

513-515: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider deleting mockist assertions rather than repairing them.

As per coding guidelines, we should delete mockist tests that mock application code or assert toHaveBeenCalled rather than repairing them. Consider removing these assertions or the test entirely instead of maintaining them.

Also applies to: 541-541

🤖 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 `@__tests__/unit/services/modelManager.test.ts` around lines 513 - 515, Remove
the mockist call-count assertions for onProgress, onComplete, and onError in the
affected model manager test cases, including the corresponding assertion at the
second referenced location; if those tests exist solely to verify mocked
application interactions, delete the tests entirely rather than replacing the
assertions.

Source: Coding guidelines

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

Nitpick comments:
In `@__tests__/unit/services/modelManager.test.ts`:
- Around line 513-515: Remove the mockist call-count assertions for onProgress,
onComplete, and onError in the affected model manager test cases, including the
corresponding assertion at the second referenced location; if those tests exist
solely to verify mocked application interactions, delete the tests entirely
rather than replacing the assertions.

In
`@android/app/src/main/java/ai/offgridmobile/download/DownloadManagerModule.kt`:
- Line 166: Update the warning log in the cancelled-download cleanup branch to
use the existing companion-object constant NAME as its tag instead of the
hardcoded "DownloadManagerModule" string, preserving the current message and
behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 31046b67-f586-4d34-8a04-8dd383bac6d6

📥 Commits

Reviewing files that changed from the base of the PR and between 856bca1 and 1e4f7cd.

📒 Files selected for processing (7)
  • __tests__/unit/services/modelManager.test.ts
  • android/app/src/main/java/ai/offgridmobile/download/DownloadManagerModule.kt
  • android/app/src/main/java/ai/offgridmobile/download/WorkerDownload.kt
  • fastlane/Fastfile
  • src/screens/DownloadManagerScreen/useVoiceDownloadItems.ts
  • src/services/activeDownloadPersistence.ts
  • src/services/modelPreloader.ts

@sonarqubecloud

Copy link
Copy Markdown

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