Skip to content

Fix: Condition Sets Incorrectly Evaluate Infrequent Telemetry Updates#8002

Closed
Pranaykarvi wants to merge 4 commits into
nasa:masterfrom
Pranaykarvi:fix-condition-bug
Closed

Fix: Condition Sets Incorrectly Evaluate Infrequent Telemetry Updates#8002
Pranaykarvi wants to merge 4 commits into
nasa:masterfrom
Pranaykarvi:fix-condition-bug

Conversation

@Pranaykarvi

@Pranaykarvi Pranaykarvi commented Feb 16, 2025

Copy link
Copy Markdown

Issue #7992

Condition sets can incorrectly evaluate telemetry objects that update infrequently due to short-circuit evaluation. This causes stale results and incorrect conditional styling. The issue occurs because the evaluation stops when a condition evaluates to true, preventing subsequent conditions from being re-evaluated with the latest telemetry data.

Fix

Removed short-circuiting in the updateConditionResults method to ensure all conditions are re-evaluated with the latest telemetry data. This prevents stale results and ensures that the condition set's state is always accurate.

Changes

  • Modified updateConditionResults to iterate over all conditions and update their results, regardless of whether a previous condition evaluated to true.

Impact

  • Fixes incorrect evaluation of condition sets for infrequently updated telemetry.
  • Prevents stale results and ensures accurate conditional styling.
  • No expected performance impact for small to medium-sized condition sets.

@codecov

codecov Bot commented Feb 16, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.27%. Comparing base (e5631c9) to head (7483ba5).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8002      +/-   ##
==========================================
- Coverage   57.69%   57.27%   -0.42%     
==========================================
  Files         678      678              
  Lines       27438    27437       -1     
  Branches     2694     2694              
==========================================
- Hits        15829    15715     -114     
- Misses      11269    11379     +110     
- Partials      340      343       +3     
Flag Coverage Δ
e2e-ci 62.85% <100.00%> (-0.01%) ⬇️
e2e-full 23.64% <0.00%> (-18.38%) ⬇️
unit 49.30% <100.00%> (-0.19%) ⬇️
Files with missing lines Coverage Δ
src/plugins/condition/ConditionManager.js 87.69% <100.00%> (-0.07%) ⬇️

... and 14 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5631c9...7483ba5. Read the comment docs.

🚀 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.

@Pranaykarvi

Pranaykarvi commented Feb 16, 2025

Copy link
Copy Markdown
Author

@akhenry Could you please review and approve this PR? Thanks!

@akhenry

akhenry commented Apr 23, 2025

Copy link
Copy Markdown
Contributor

@Pranaykarvi Thank you for taking a look at this issue. Indeed, I initially thought that simply removing the short-circuit evaluation would be enough to fix this issue but when I tested this I found that it caused an unacceptable performance regression.

So the approach I took instead was to keep the short-circuit evaluation, but pass in a snapshot of the latest telemetry values so that when the evaluation gets to the a condition set with stale telemetry it will always be evaluated with the latest telemetry. It's more work, but it gives us the best of both worlds. Let me know what you think - #8041

Thanks for your contribution. I'll make sure you're credited in the other PR.

@akhenry akhenry closed this Apr 23, 2025
@Pranaykarvi

Copy link
Copy Markdown
Author

Hi @akhenry, thanks so much for the considered answer!

Your solution with the telemetry snapshot is a good one — clever way to maintain accuracy without sacrificing performance. Learned a lot investigating this problem, and I'm glad I was able to help in some small way.

Thanks heaps for the credit in #8041 — really appreciated! Looking forward to diving into more Open MCT work soon.

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.

2 participants