Skip to content

fix: Re-initiate subscription telemetry on _reset() to prevent data loss - #6

Open
samanthataylor3 wants to merge 1 commit into
masterfrom
devin/1782231898-fix-telemetry-subscription-reset
Open

fix: Re-initiate subscription telemetry on _reset() to prevent data loss#6
samanthataylor3 wants to merge 1 commit into
masterfrom
devin/1782231898-fix-telemetry-subscription-reset

Conversation

@samanthataylor3

@samanthataylor3 samanthataylor3 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #4

Describe your changes:

When a user manually changes time conductor bounds, TelemetryCollection._reset() clears all data and re-requests historical data, but did not re-initiate the subscription. Some subscription providers supply "latest available data" (LAD) on initial subscription. Since the subscription was never reset during _reset(), that initial LAD data from the provider was lost.

Fix: Add this._initiateSubscriptionTelemetry() in _reset(), mirroring what load() already does at lines 170–171. The _initiateSubscriptionTelemetry() method already safely unsubscribes before re-subscribing, so this is safe.

 _reset() {
   this.boundedTelemetry = [];
   this.futureBuffer = [];
   this.emit('clear');
   this._requestHistoricalTelemetry();
+  this._initiateSubscriptionTelemetry();
 }

All call sites that trigger _reset() benefit from this fix:

  • _bounds() — on mode change
  • _handleUserBoundsChange() — on user-initiated bounds change
  • _setTimeSystemAndFetchData() — on time system change

Also removed the stale @todo handle subscriptions more granularly comment since this is now handled.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this a notable change that will require a special callout in the release notes? For example, will this break compatibility with existing APIs or projects that consume these plugins?

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

Link to Devin session: https://app.devin.ai/sessions/b42c44263e2f4e49b934c88a2c5e4adb
Requested by: @samanthataylor3


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

When user manually changes time conductor bounds, TelemetryCollection._reset()
clears all data and re-requests historical data, but did not re-initiate the
subscription. Some subscription providers supply 'latest available data' on
initial subscription. Since the subscription was never reset during _reset(),
that initial LAD data from the provider was lost.

This adds a call to _initiateSubscriptionTelemetry() in _reset(), mirroring
what load() already does. The method already safely unsubscribes before
re-subscribing, so this is safe.

Closes #4

Co-Authored-By: Samantha Taylor <samantha.taylor@cognition.ai>
@samanthataylor3 samanthataylor3 self-assigned this Jun 23, 2026
@devin-ai-integration

Copy link
Copy Markdown
Original prompt from Samantha

Fix GitHub Issue #4 in COG-GTM/openmct: Telemetry Collections dropping data on user bounds change.

#``# Problem
When a user manually changes time conductor bounds, TelemetryCollection._reset() clears all data and re-requests historical data, but does NOT re-initiate the subscription. Some subscription providers supply 'latest available data' on initial subscription. Since the subscription is never reset during _reset(), that initial LAD data from the provider is lost.

#``# Plan

  1. Open src/api/telemetry/TelemetryCollection.js
  2. In the _reset() method (around line 570), add a call to this._initiateSubscriptionTelemetry() right after this._requestHistoricalTelemetry(). This mirrors what load() already does at lines 170-171.
  3. Remove the ``@todo handle subscriptions more granularly comment from the `_reset()` JSDoc since we are now handling it.
  4. The _initiateSubscriptionTelemetry() method (line 256) already safely unsubscribes before re-subscribing, so this is safe.
  5. Verify existing tests pass (check for TelemetryCollectionSpec.js or similar test files).
  6. Add a test that verifies _initiateSubscriptionTelemetry is called when _reset is invoked (e.g., on bounds change).
  7. Run npm run lint to ensure no lint errors.
  8. Create a PR referencing Issue #4 with a clear description.

#``# Call Sites That Trigger _reset()

  • _bounds() line 404 — on mode change
  • _handleUserBoundsChange() line 496 — on user-initiated bounds change
  • _setTimeSystemAndFetchData() line 555 — on time system change

All three benefit from re-initiating the subscription.

#``# The fix (pseudocode):

_reset() {
    this.boundedTelemetry = [];
    this.futureBuffer = [];
    this.emit('clear');
    this._requestHistoricalTelemetry();
    this._initiateSubscriptionTelemetry(); // &lt;-- ADD THIS LINE
}

@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

Telemetry Collections dropping data on user bounds change

1 participant