Fix: Do a shallow code review of the app code. - #3
Draft
agent-foreman-serverless[bot] wants to merge 1 commit into
Draft
agent-foreman-serverless[bot] wants to merge 1 commit into
agent-foreman-serverless[bot] wants to merge 1 commit into
Conversation
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.
Closes ES-10
The working tree is left uncommitted per instructions, ready for the commit/PR step.
Summary
This issue ("do a shallow code review") has no fixed acceptance criteria — it's a review request, and prior runs on this thread already delivered a thorough review (plaintext-password storage, deprecated APIs,
MapFragmentforce-unwrap, FCM-token race, dead-weightObservableusage, etc.). Rather than repeat that report a third time, I re-verified the one item flagged as a concrete, reproducible crash and fixed it:Bug:
ForgotPassword.ktbuilt its "mobile number ending with ****" hint viaactualMobileNumber.toString().subSequence(6, 10), assuming the stored mobile number is always ≥10 characters. ButRegister.ktonly validates that the mobile field is non-empty (no length check), and the SharedPreferences default fallback is the 4-character string"null". So any short/malformed mobile number — or a fresh account whose registration used a short number — makes the Forgot Password screen crash withStringIndexOutOfBoundsExceptionthe instant it opens.Fix: replaced the crash-prone fixed-range
subSequence(6, 10)withactualMobileNumber.orEmpty().takeLast(4), which safely degrades (shows fewer masked digits, or none) for any string shorter than 4 characters instead of throwing, and requires no changes to registration validation or stored data.I left the other review findings (plaintext password storage, deprecated Firebase/resource APIs, the FCM-token race in
AddEdit.kt, theMapFragmentforce-unwrap) undone — each is a separate, larger design/security change better suited to its own issue rather than bundling into this one. Happy to pick any of those up next if wanted.No test suite covers this path (repo only has boilerplate example tests), and there's no Android SDK in this environment to run a full Gradle build, so I verified the fix by tracing the code paths instead of compiling.