[MS-1444] Reset accumulators upon scanner disconnect to prevent lefto…#1680
Merged
luhmirin-s merged 2 commits intoMay 27, 2026
Merged
Conversation
…ver bytes from corrupting parsing on next connection
There was a problem hiding this comment.
Pull request overview
This PR addresses a scanner reconnection edge case in the fingerprint scanner v2 pipeline by ensuring accumulator state is cleared on disconnect, preventing partial/leftover bytes from corrupting parsing after a reconnect.
Changes:
- Add a
reset()API to the genericAccumulatorto restore its initial empty state. - Invoke accumulator resets during disconnect flows in
RootMessageInputStream,PacketRouter, andMainMessageInputStream. - Add/extend unit tests to validate resets happen on disconnect and that reset prevents partial-header contamination.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/v2/tools/accumulator/AccumulatorTest.kt | Adds coverage proving reset() clears partial state so subsequent elements parse correctly. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/v2/incoming/root/RootMessageInputStreamTest.kt | Verifies root accumulator is reset on disconnect. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/v2/incoming/main/packet/PacketRouterTest.kt | Verifies packet accumulator is reset on disconnect. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/v2/incoming/main/MainMessageInputStreamTest.kt | Verifies all main-mode message accumulators are reset on disconnect. |
| fingerprint/infra/scanner/src/main/java/com/simprints/fingerprint/infra/scanner/v2/tools/accumulator/Accumulator.kt | Introduces reset() and stores the initial collection to support resetting. |
| fingerprint/infra/scanner/src/main/java/com/simprints/fingerprint/infra/scanner/v2/incoming/root/RootMessageInputStream.kt | Resets root response accumulator on disconnect. |
| fingerprint/infra/scanner/src/main/java/com/simprints/fingerprint/infra/scanner/v2/incoming/main/packet/PacketRouter.kt | Resets byte-array-to-packet accumulator on disconnect. |
| fingerprint/infra/scanner/src/main/java/com/simprints/fingerprint/infra/scanner/v2/incoming/main/MainMessageInputStream.kt | Resets all message accumulators on disconnect in addition to disconnecting the packet router. |
luhmirin-s
reviewed
May 26, 2026
…ifications of array in place
luhmirin-s
approved these changes
May 26, 2026
|
meladRaouf
approved these changes
May 26, 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.



…ver bytes from corrupting parsing on next connection
JIRA ticket
Will be released in: 2026.2.0
Root cause analysis (for bugfixes only)
First known affected version: since forever
Notable changes
Testing guidance
Additional work checklist