Skip to content

ref(uptime): Extract OpType, ComparisonType, and AssertionType enums#108551

Open
jaydgoss wants to merge 4 commits intomasterfrom
jaygoss/new-751-add-enums-for-assertion_type-and-comparison-in-uptime
Open

ref(uptime): Extract OpType, ComparisonType, and AssertionType enums#108551
jaydgoss wants to merge 4 commits intomasterfrom
jaygoss/new-751-add-enums-for-assertion_type-and-comparison-in-uptime

Conversation

@jaydgoss
Copy link
Member

@jaydgoss jaydgoss commented Feb 19, 2026

Summary

  • Extracts three enums from inline string literals in uptime assertion types:
    • OpType: discriminant for Op tree nodes (and, or, not, status_code_check, json_path, header_check)
    • ComparisonType: comparison operators (equals, not_equal, less_than, greater_than, always, never)
    • AssertionType: Seer suggestion assertion categories (status_code, json_path, header)
  • Refactors the Comparison type to use ComparisonType enum
  • Updates all consumers across ~26 source, spec, and stories files to use enum values instead of hardcoded strings
  • Uses explicit type annotations in spec files to prevent TypeScript enum widening from breaking discriminated union narrowing

Ref NEW-751

Test plan

  • TypeScript typecheck passes cleanly
  • All 158 tests pass across 13 spec suites
  • ESLint and prettier pass

…ne string unions

Replaces hardcoded string literals in AssertionSuggestion interface with
shared enums for better reusability and type safety.

Ref NEW-751
@linear
Copy link

linear bot commented Feb 19, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 19, 2026
Replaces hardcoded string literals throughout the uptime assertion
types file and all consumers with shared enums for better reusability
and type safety.

- OpType: discriminant for Op tree nodes (and, or, not, status_code_check, json_path, header_check)
- ComparisonType: comparison operators (equals, not_equal, less_than, greater_than, always, never)
- AssertionType: Seer suggestion assertion categories (status_code, json_path, header)
- Refactored Comparison type to use ComparisonType enum

Ref NEW-751
….spec.tsx

TypeScript widens enum members to the full enum type in object literals,
breaking discriminated union narrowing. Use explicit type annotations
instead of `as const` to preserve type safety without readonly conflicts.

Also updates detectors/forms/uptime/fields.spec.tsx which was missed in
the initial enum refactoring.
@jaydgoss jaydgoss changed the title ref(uptime): Extract AssertionType and ComparisonType enums ref(uptime): Extract OpType, ComparisonType, and AssertionType enums Feb 19, 2026
@jaydgoss jaydgoss marked this pull request as ready for review February 19, 2026 19:49
@jaydgoss jaydgoss requested review from a team as code owners February 19, 2026 19:49
@jaydgoss jaydgoss requested a review from Abdkhan14 February 19, 2026 19:50
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Seer suggestions never return 'never' as a comparison value, so exclude
ComparisonType.NEVER from the AssertionSuggestion interface to avoid
unintentional type widening.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments