Refactor: extract CrashReportService interface to :common#20739
Refactor: extract CrashReportService interface to :common#20739mikehardy merged 3 commits intoankidroid:mainfrom
CrashReportService interface to :common#20739Conversation
c3210c0 to
d983c00
Compare
:common module CrashReportService interface to :common
d983c00 to
38871b1
Compare
david-allison
left a comment
There was a problem hiding this comment.
Looks great!
I don't think the exception classes need to be moved:
CombinedExceptionis only used in 1 featureInvalidSearchExceptionshould be abovelibanki, not below itManuallyReportedExceptionshould be rewrittenStorageAccessExceptionshould be abovelibanki, not below itUnknownDatabaseVersionExceptionshould be abovelibanki, not below itUserSubmittedException- used in 1 feature
38871b1 to
e8acb11
Compare
|
I will rebase later, but I have addressed the concerns |
cb830b0 to
558698a
Compare
david-allison
left a comment
There was a problem hiding this comment.
Code LGTM!
Nits, as this is a significant architectural pattern/change
This one needs some more thought on the commits: you apply a change then revert it in the next commit.
Also see: https://github.com/ankidroid/Anki-Android/blob/main/AI_POLICY.md#disclosure
The main commit message is especially important, because the change introduces an architectural pattern into the codebase. Could you humanize it a bit, to explain the 'why'.
558698a to
9b607ae
Compare
|
@david-allison fyi Note Assisted-by Claude Opus 4.6 |
There was a problem hiding this comment.
This is structured unusually which makes it hard to follow:
In commit 1, there are 2 objects called CrashReportService
I would recommend:
- commit 0: any pre-fixes which could be split out of commit 1, for example any changes to the tests/adding the init method
- commit 1: introduce the interface and make the implementation private
- commit 2: move to the correct package
| @VisibleForTesting | ||
| fun getReporter(): CrashReporter = instance | ||
|
|
||
| fun sendExceptionReport( |
There was a problem hiding this comment.
These are the methods which are called publicly, but there's no documentation on them
(Maybe you could get this for free by implementing the interface)
bf1d13f to
da10a61
Compare
david-allison
left a comment
There was a problem hiding this comment.
LGTM, assuming CI is happy
da10a61 to
580ce1a
Compare
Extract CrashReportService.initialize() and isProperServiceProcess() into top-level functions.
As we move towards a multi-module architecture, feature modules need crash reporting without depending on the app module. Without this, each feature module would need its own bridge interface (e.g. WidgetCrashReporter, BrowserCrashReporter) duplicating the same pattern everywhere. This does use android dependencies though and those don't seem removable, so it gets the android-capable sub-module of common
Move CrashReportService from com.ichi2.anki to com.ichi2.anki.common.crashreporting and update imports. Assisted-by: Claude Opus 4 (1M context)
580ce1a to
a38a657
Compare
There was a problem hiding this comment.
seems fine to me - I just de-conflicted after the merge in of common:android PR since this needs android functionality and wouldn't compile otherwise
(just a move of file directly from common/src/main/etc to common/android/sra/main/etc
Also de-conflicted imports change collision in ProfileManager since that merged today as well
Trying to keep everything moving while I have a minute :)
Note
Assisted-by Claude Opus 4.6
Updating the imports (not all but most)
Purpose / Description
Move crash report to common module so we can avoid circular dependency
Fixes
Approach
See commits
How Has This Been Tested?
Build
Learning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.