feat(logger): purge unrecognized/legacy crash files in shared uploader - #8
Merged
Conversation
Move the legacy crash-file cleanup into the shared KMP module so every host (Android today, iOS later) reclaims foreign files without host-specific glue. - ILogFileStore.deleteUnrecognizedEntries(): new contract method (default no-op for test doubles / platforms with no shared-directory legacy) that removes on-disk entries the store does not own, while preserving owned records (incl. failed / too-young uploads). - LogCrashUploader: after the owned-record upload pass (or immediately when remote logging is off), purge unrecognized entries so a later module flip is not poisoned by stale legacy files. Adds inventory/pass logging. - Tests + FakeFileStore support covering purge after success, purge when remote logging disabled, and owned records retained on upload failure while legacy files are still purged. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the legacy-file sweep exception-safe when listReadable/export fails, and document that host stores should age-gate unrecognized deletions during module-flag transitions. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
Author
|
Addressed review feedback in
Android #2691 submodule re-pinned to this SHA. |
|
A couple of issues to address before merging:
Also, please confirm this will not ship before the Android production implementation lands. In this repo the default remains a no-op and only |
Rethrow CancellationException from purge/export catch blocks, pass minFileAgeForReadMillis into deleteUnrecognizedEntries so foreign files respect the same age policy as owned reads, cover young-vs-stale and cancellation cases, and keep path/inventory upload logs at DEBUG. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
Author
|
Addressed in
Shipping with Android: yes — this will not ship alone. OneSignal-Android-SDK#2691 pins this submodule and provides the production |
Co-authored-by: Cursor <cursoragent@cursor.com>
fadi-george
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related: OneSignal-Android-SDK SDK-4939
Moves the legacy crash-file cleanup into the shared KMP module so every host (Android now, iOS later) reclaims foreign/legacy files without host-specific glue. This is the shared-module home for the behavior that the Android SDK currently does host-side (OneSignal-Android-SDK#2691).
Changes
ILogFileStore.deleteUnrecognizedEntries()— new contract method with a default no-op (safe for test doubles / platforms with no shared-directory legacy). Implementations remove on-disk entries the store does not own, while preserving owned records (including failed / too-young uploads).LogCrashUploader— after the owned-record upload pass (or immediately when remote logging is off), purge unrecognized entries so a later module flip isn't poisoned by stale legacy files. Adds inventory/pass logging.FakeFileStore— cover: purge after successful uploads, purge when remote logging disabled, and owned records retained on upload failure while legacy files are still purged.Consumer follow-up
The Android host PR that bumps the submodule to this commit and implements
deleteUnrecognizedEntries()inFileLogStoreis stacked on #2691. Once this merges, the Android submodule pin will be updated to the merged SHA.Test plan
./gradlew :kmp:testDebugUnitTest—LogCrashTest10/10 pass (incl. 3 new purge tests)./gradlew :kmp:spotlessCheckMade with Cursor