Advance report cursor after empty scans - #108
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
crowd-depth-api | e7b8d17 | Commit Preview URL Branch Preview URL |
Aug 08 2026, 05:02 PM |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Signal K plugin’s reporting cursor semantics so progress is recorded not only after successful submissions, but also after scans that complete with no bathymetry points (including batch scans), reducing repeated history reads over empty ranges.
Changes:
- Advance the report cursor after a scan completes with no data, and after batch scans finish inspecting the full range (including empty windows).
- Update plugin status wording from “Reported at …” to “Checked through …”.
- Extend tests to cover checkpoint behavior (empty scans, batch scans, read failures, and aborted batch scans).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/signalk-plugin/src/reporters/index.ts | Adds checkpointing for empty scans and after batch scans; refactors checkpoint logic into a helper and returns reporter methods. |
| packages/signalk-plugin/src/status.ts | Updates status message wording to “Checked through …”. |
| packages/signalk-plugin/test/helper.ts | Extends test app stub to include setPluginError used by status error handling. |
| packages/signalk-plugin/test/reporter.test.ts | Adds tests validating cursor advancement behavior across empty scans, batch scans, failures, and aborts. |
Suppressed comments (2)
packages/signalk-plugin/src/reporters/index.ts:113
- The end-of-range checkpoint in
reportInBatches()can still run if the signal is aborted right after the last window is processed (between the loop and this block). Add an abort guard here so aborted batch scans never record progress.
!reportLog.lastReport ||
Temporal.Instant.compare(reportLog.lastReport, timeframe.to) < 0
) {
checkpoint(timeframe);
}
packages/signalk-plugin/src/reporters/index.ts:71
report()checkpoints immediately after a successful submission without checkingsignal.aborted. If the plugin is stopped during submission, the cursor may still advance; guardcheckpoint()so aborted runs do not record progress.
const submission = await submitGeoJSON(url, config, vessel, data);
app.debug("Submission response: %j", submission);
checkpoint(timeframe);
} catch (err) {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What changed
Crowd Depth now records progress after a history scan completes with no bathymetry points. Batch scans also advance past empty windows once the full range has been inspected.
Previously, only a successful submission moved the cursor. When the boat produced no new soundings, every scheduled run queried the entire empty period again. That made the InfluxDB history queries grow on each cycle and occasionally contend with live telemetry writes.
Failed reads, failed submissions, and aborted scans still leave the cursor untouched so they will retry. The plugin status now says "Checked through" because the timestamp can represent either a submission or a completed empty scan.
Tests