Skip to content

fix(maps): fix multi-fragment AIS decoding and bound AISComm history size#5365

Draft
Copilot wants to merge 30 commits into
feat/aisfrom
copilot/fix-review-comments
Draft

fix(maps): fix multi-fragment AIS decoding and bound AISComm history size#5365
Copilot wants to merge 30 commits into
feat/aisfrom
copilot/fix-review-comments

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

Addresses three review comments from PR #5353 review #4358925311: multi-fragment AIS messages were silently dropped, AISComm history grew without bound, and the class documentation referenced outdated API names.

AISDecoder: stateful Vdm accumulator for multi-fragment messages

Previously, parsePayload called String.toAisMessage() which constructed a fresh Vdm() per line. Multi-part AIS sentences (type 1–3 fragments) never accumulated enough state to satisfy isCompletePacket, so they were silently dropped.

Now a single vdmAccumulator is threaded through the line loop via a new Vdm.parseSentence() helper. It resets on recoverable errors (invalid checksum, out-of-sequence) and resets + emits on a complete packet:

// Before: new Vdm per line — multi-fragment messages never complete
return payload.lines().mapNotNull { line ->
    ...
    else -> line.toAisMessage()?.let { message -> currentTimestamp to message }
}

// After: single accumulator persists across lines
var vdmAccumulator = Vdm()
return buildList {
    for (line in payload.lines()) {
        ...
        else -> vdmAccumulator = vdmAccumulator.parseSentence(line) { message ->
            add(currentTimestamp to message)
        }
    }
}

No ThreadLocal is used; state is purely local to the function call.

AISComm: bounded history with null for unlimited

Changed maxSize: Int = Int.MAX_VALUEmaxSize: Int? = 100. Default is now 100 retained payloads; pass null to retain all. trim() skips the size check when maxSize is null.

AISComm: KDoc aligned to actual API

Updated class documentation to reflect the actual exposed properties (history, currentData, vesselId) — the previously referenced receivedPayloads and AISMessageParser no longer exist in the implementation.

lolloantonioli and others added 25 commits May 13, 2026 19:59
…e use point, add a test, document on the website
Copilot AI changed the title [WIP] Fix code per review comments from pull request 5353 fix(maps): fix multi-fragment AIS decoding and bound AISComm history size May 25, 2026
Copilot finished work on behalf of DanySK May 25, 2026 22:19
Copilot AI requested a review from DanySK May 25, 2026 22:19
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.53%. Comparing base (584621f) to head (7d3fc85).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5365   +/-   ##
=========================================
  Coverage     61.53%   61.53%           
  Complexity       14       14           
=========================================
  Files             2        2           
  Lines            78       78           
  Branches          4        4           
=========================================
  Hits             48       48           
  Misses           24       24           
  Partials          6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DanySK DanySK changed the base branch from master to feat/ais May 27, 2026 09:49
@DanySK
Copy link
Copy Markdown
Member

DanySK commented May 27, 2026

@copilot rebase this pr on top of branch feat/ais

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 27, 2026

Hi @Copilot! 👋
This pull request has conflicts 😖
Could you fix it? 🔧
Thank you! 🙏

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 27, 2026

@copilot rebase this pr on top of branch feat/ais

Done. The branch now has feat/ais (25d59c59a) as an ancestor via merge commit 81d19a9bd. The PR diff against feat/ais shows only the review-comment fixes (multi-fragment AIS decoding, bounded history, KDoc updates).

Copilot finished work on behalf of DanySK May 27, 2026 10:08
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants