Skip to content

fix(probe): initialize comparator type ref from loaded probe data#5502

Open
pcandido wants to merge 12 commits into
litmuschaos:masterfrom
pcandido:fix/cmd-probe-comparison-criteria-on-edit
Open

fix(probe): initialize comparator type ref from loaded probe data#5502
pcandido wants to merge 12 commits into
litmuschaos:masterfrom
pcandido:fix/cmd-probe-comparison-criteria-on-edit

Conversation

@pcandido

@pcandido pcandido commented May 6, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

closes #5500

When editing an existing CMD or Prometheus probe, the comparator type (int, float, string) was always reset to int regardless of the previously saved value. This happened because cmdComparatorType and promComparatorType refs were hardcoded to 'int' instead of being initialized from the loaded probe data.

This fix initializes those refs from props.formData, so the correct comparator type is preserved when editing a probe.

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

  • N/A

Special notes for your reviewer:

The global.d.ts change fixes a pre-existing gap: there were no type declarations for .scss / .module.scss imports. This caused tsc to emit TS2307 on YAMLBuilder.tsx whenever it was pulled in as a transitive dependency during typecheck:staged. The error is unrelated to the probe fix itself but blocks the pre-commit hook without this declaration.

…edit

Signed-off-by: Paulo Cândido <paulo.candido@ifood.com.br>
@pcandido pcandido changed the title fix(probe): initialize comparator type ref from loaded probe data on … fix(probe): initialize comparator type ref from loaded probe data May 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an issue where editing existing CMD/Prometheus probes would reset the comparator data type to int instead of preserving the saved type, and adds missing TypeScript module declarations for SCSS imports to prevent TS2307 during typechecking.

Changes:

  • Initialize CMD and Prometheus comparator type refs from loaded probe data (props.formData) instead of hardcoding int.
  • Add ambient TypeScript declarations for *.module.scss and *.scss imports in global.d.ts.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.tsx Initializes comparator type refs from existing probe data to preserve edit-state comparator behavior.
chaoscenter/web/src/global.d.ts Adds missing SCSS module/type declarations to fix TypeScript import errors during typechecking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PriteshKiri

Copy link
Copy Markdown
Contributor

@pcandido could you please review the comments from co-pilot

@PriteshKiri

Copy link
Copy Markdown
Contributor

@pcandido could you please share a video or a screenshot of the working fix here?

@pcandido

pcandido commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Here we go

Before fix (v3.29.0):

before_compressed.mp4

After fix:

after_compressed.mp4

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.

CMD Probe Comparison Criteria Not Loading Correctly on Edit

4 participants