Persistent diagnostics + split resize verification + debug variant#48
Merged
Conversation
- Add FileLogger with rotation + DiagnosticSanitizer (URL/extras/shell-command redaction); install uncaught exception handler in CastlaApp. - Add markTerminal() (first-writer-wins) at known silent-fail sites in MirrorForegroundService; performCleanup() is sole owner of MirrorDiagnostics.endSession(). - Add SplitMath with min-pane invariants (LEFT >= 360, RIGHT >= 320) and centralized ensureSplitViable() gate at every split entry path; splitTaskBounds()/primaryTaskBounds() now fail-fast via check(). - Add serialized resize verification: per-pane Mutex + cancel-previous, dumpsys bounds re-read with 16px tolerance, up to 4 retry rounds, 800ms shell timeout. - Settings UI: new Diagnostic Logs section with Share/Copy buttons; IO on Dispatchers.IO via rememberCoroutineScope. - Build: applicationIdSuffix=".debug" so debug coexists with release. Debug versionName/versionCode now auto-track latest git tag and commit count via androidComponents.onVariants — debug builds reflect the actual current release (e.g. 1.4.0-debug) instead of the stale defaultConfig stub. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
applicationIdSuffix=".debug"so debug coexists with release; debugversionName/versionCodenow auto-track the latest git tag (e.g.1.4.0-debug) and commit count instead of the staledefaultConfigstub.What changes
Diagnostics
FileLogger—<filesDir>/logs/mirror.log(+ rotated.1), 512 KB × 2 cap, init-fail-safe degraded mode.DiagnosticSanitizer— redacts URLs (host only),--es key valueextras,Executing: <shell>bodies; applied to every persisted write.CastlaAppinstalls aThread.setDefaultUncaughtExceptionHandlerthat writes via FileLogger, then chains to the previous handler.MirrorDiagnostics.log()/endSession()now persist alongside Logcat.MirrorForegroundService.markTerminal(reason)(first-writer-wins viaAtomicReference) at the 4 known silent-fail sites:VD_RECREATE_FAILED,SHIZUKU_REBIND_FAILED,PIPELINE_REBUILD_EXCEPTION,BROWSER_ACTIVATION_FAILED.performCleanup()is the sole owner ofMirrorDiagnostics.endSession().Dispatchers.IOviarememberCoroutineScope.Split resize
SplitMath(pure JVM):LEFT_PANE_MIN_PX=360,RIGHT_PANE_MIN_PX=320,MIN_TOTAL_PX=680,isSplitViable(),computeLeftPaneWidth().ensureSplitViable(reason)gate; every split-entry path (launchSplitWebTarget,launchSplitExternalBrowserTarget,launchSplitStandardTarget, all 4AppLaunchBussplitModebranches,relaunchPrimaryTaskForSplit) goes through it.splitTaskBounds()/primaryTaskBounds()nowcheck(isSplitViable(...))and callSplitMathdirectly — fail-fast instead of degenerate fallback.runResizeWithVerification: serialized viaMutex+ per-paneJobcancel-previous, max 4 verify rounds, 800ms shell timeout, 16px tolerance, dumpsys-bounds parser (TaskBoundsParser) with graceful skip on OEM mismatch.Build
debug { applicationIdSuffix = ".debug" }→ debug app iscom.castla.mirror.debug, coexists with release.gitLatestSemverTag()+gitCommitCount()helpers;androidComponents.onVariants(selector().withBuildType("debug"))overrides debugversionName/versionCodefrom git. CI release path is untouched (sed pattern only matchesdefaultConfig).applicationId=com.castla.mirror.debug,versionName=1.4.0-debug,versionCode=97.DUUL protocol
REVISEonly on diagnosis-handoff heuristic; architectural analysis "production-ready as written".Robolectrictest-init failures exist on master too (verified bygit stash+ rerun on a clean checkout) and are unrelated to this PR.Test plan
./gradlew :app:testDebugUnitTest— 277 of 283 pass; the 6 failures are pre-existing Robolectric ↔compileSdk=35infrastructure issues unrelated to this PR.DiagnosticSanitizerTest,FileLoggerTest,SplitMathTest,TaskBoundsParserTest— all green../gradlew :app:assembleDebugsucceeds; APK metadata confirms split applicationId + git-tag-derived versionName.INSTALL_FAILED_VERSION_DOWNGRADE.mirror.logis attached and URLs are redacted.Out of scope
🤖 Generated with Claude Code