Skip to content

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

Closed
alichherawalla wants to merge 3 commits into
mainfrom
chore/post-release-cleanup
Closed

chore: post-0.0.103 cleanup — SonarCloud reliability + promote-as-draft fix#560
alichherawalla wants to merge 3 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 if partial files can’t be deleted.
    • Hardened voice-model deletion when optional audio features are unavailable.
    • Made background download identifiers handled consistently across the download flow.
    • Improved reliability of persisted in-progress download updates.
    • Ensured boot-time TTS preload always completes safely.
    • Corrected Android promotion to remain in draft track status.
  • Tests
    • Updated unit tests to treat background download IDs as strings for accurate callback handling.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d67a82c-6e94-43d8-b71c-bbc590e00011

📥 Commits

Reviewing files that changed from the base of the PR and between 1e4f7cd and 2189a8c.

📒 Files selected for processing (1)
  • android/app/src/main/java/ai/offgridmobile/download/DownloadManagerModule.kt

📝 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 | ✅ 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 cleanup and Play promotion fix.
Description check ✅ Passed The description is detailed and covers the fixes and rationale, but it omits the template's Type of Change and Related Issues sections.
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

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

@alichherawalla

Copy link
Copy Markdown
Collaborator Author

Nitpicks addressed:

  1. Log tag → now uses the companion NAME constant instead of the hardcoded string (commit 2189a8c).
  2. Mockist assertions (modelManager.test toHaveBeenCalledWith) — these are pre-existing, passing tests; this PR only aligned a downloadId type SonarCloud flagged (string vs number). Deleting/rewriting the mockist modelManager suite is a coverage-affecting refactor that's out of scope for a Sonar-reliability cleanup — flagging it as a dedicated follow-up rather than doing a broad deletion here.

@alichherawalla

Copy link
Copy Markdown
Collaborator Author

Included in release PR #571 via merge commit aea3084; closing this superseded source PR.

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