Skip to content

test(explore): cover column config, conditional formatting, and contour controls - #44843

Merged
sadpandajoe merged 8 commits into
masterfrom
explore-rtl-crud-controls
Oct 22, 2026
Merged

sadpandajoe merged 8 commits into
masterfrom
explore-rtl-crud-controls

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

Adds React Testing Library coverage for three CRUD-style Explore controls. This change touches test files only.

  • Column config (ColumnConfigControl.test.tsx and ControlForm.test.tsx, both new)
    • Rows: one row per column, filtering by appliedColumnNames, and the 12-column "show all" threshold with its toggle.
    • Popover edits are debounced, then merged into the stored config.
    • Configs for columns that are no longer known or are hidden get pruned.
    • Time comparison columns get a General tab.
    • Child columns configured as not visible show the hidden-column icon.
    • The __timestamp alias label.
    • ControlForm: field seeding, merged and debounced edits, validation errors, and empty values.
  • Conditional formatting (ConditionalFormattingControl.test.tsx)
    • Add, edit and delete flows through the popover. Each checks that the onChange list keeps the other formatters in place.
    • Formatters whose column leaves the column options get pruned, with an opt-out.
  • Contours (ContourControl/*.test.tsx, new)
    • ContourPopoverControl: picks the isoline or isoband tab, saves the right shape, switches between tabs, and validates integers and threshold order.
    • ContourPopoverTrigger: controlled and uncontrolled visibility.
    • ContourOption: labels, remove, and edit.
    • The ContourControl list: defaults, z-index ordering, add, edit and remove.

Each new test was checked by breaking the related product code, and the test failed each time.

Some behavior that looks like a bug was left unpinned on purpose, so a later fix won't have to rewrite these tests:

  • ColumnConfigControl saves edits to the time column under its display alias ("Time"). The table plugins look the config up under __timestamp.
  • The contour popover saves a missing upper threshold or stroke width as NaN.
  • An isoband with an upper threshold of 0 is treated as an isoline, because of a truthiness check.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A: tests only.

TESTING INSTRUCTIONS

cd superset-frontend
npx jest \
  src/explore/components/controls/ColumnConfigControl \
  src/explore/components/controls/ConditionalFormattingControl \
  src/explore/components/controls/ContourControl

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

sadpandajoe and others added 2 commits September 30, 2026 17:11
…ur controls

Add React Testing Library coverage for the CRUD-style controls:
column config rows, popover edits and pruning, conditional formatting
add/edit/remove flows, and the contour list, popover, and option.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. Testing only a single field in a form that uses debounced updates can fail to detect race conditions where concurrent updates to different fields overwrite each other with stale state. To resolve this, you should update the test to perform sequential interactions on multiple fields and verify that the final state correctly reflects all changes, rather than just the last one.

Would you like me to fetch all other comments on this PR to validate them and implement fixes for those as well?

@bito-code-review bito-code-review Bot 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.

Code Review Agent Run #877f71

Actionable Suggestions - 1
  • superset-frontend/src/explore/components/controls/ContourControl/ContourOption.test.tsx - 1
Additional Suggestions - 12
  • superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/ControlForm.test.tsx - 2
    • Unused debounceDelay option · Line 35-35
      `renderForm` declares `debounceDelay?: number` (line 35) and forwards it via `debounceDelay={props.debounceDelay}` (line 48), but none of the five call sites passes it, so the plumbing is never exercised. Remove the option, or add a test that drives a custom delay through `ControlFormItem`'s `debounceDelay` prop.
    • Hardcoded 400ms wait · Line 95-95
      The inline `new Promise(resolve => setTimeout(resolve, 400))` reimplements the `sleep` helper already exported by `spec/helpers/testing-library` (which this file imports from) and hardcodes the margin over `Constants.FAST_DEBOUNCE` (250ms). Prefer `await sleep(Constants.FAST_DEBOUNCE + 150)`, matching the derivation pattern in `Select.test.tsx`.
  • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.test.tsx - 3
    • Duplicated select helper · Line 151-159
      `pickColumn` (151-159) repeats the mechanism of `selectFieldOption` in `FormattingPopoverContent.test.tsx` (94-101): same combobox lookup, `.ant-select` parent scoping, click-through. The shared `selectOption` helper is documented unsafe for these inline popups, so extract one corrected helper into `spec/helpers/testing-library` instead of keeping per-file copies that can drift.
    • Unguarded mock.calls index · Line 146-147
      If `lastChange` runs before `onChange` has recorded any call, `mock.calls[length - 1]` is undefined and `[0]` throws a TypeError inside `waitFor`, surfacing as a timeout rather than a clean assertion failure. Current tests are safe because the control's mount effect always fires `onChange` (`ConditionalFormattingControl.tsx`), but optional chaining keeps future uses failing clearly.
    • Duplicated edit-flow steps · Line 215-220
      Lines 215-220 and 239-244 repeat the same six-step edit flow verbatim (click formatter label, await 'Edit formatter', get 'Target value', clear, type, click 'Apply'), differing only in label and typed value. A shared helper beside `pickColumn` would remove ~10 duplicated lines and keep each test focused on its distinct assertion (replace-at-index vs. preserving siblings).
  • superset-frontend/src/explore/components/controls/ContourControl/index.test.tsx - 7
    • Magic alpha value in fixtures · Line 30-31
      `a: 100` encodes the alpha value `updateColor` in `ContourPopoverControl.tsx` forces on every picked color; if that normalization changes, these fixtures silently stop matching real state. Add a brief comment tying 100 to the picker's forced alpha, or derive it from a shared constant.
    • Misleading placeholder type prop · Line 57-59
      `type="BoundsControl"` is a placeholder for a required prop the component ignores; the value is a real control type, so readers and future copy-pastes can misread this as a bounds control. Consider widening `ControlType` with a `ContourControl` member or making `type` optional for custom controls.
    • Unguarded mock.calls dereference · Line 69-70
      `lastChange` indexes `onChange.mock.calls[length - 1][0]` without guarding an empty calls array; inside the `waitFor` predicates (lines 100, 135, 157, 176, 194) a never-fired `onChange` throws `TypeError: Cannot read properties of undefined (reading '0')` instead of a clean timeout failure. Return `calls.at(-1)?.[0] ?? []`.
    • Unsound array type cast · Line 72-72
      `getAllByTestId` returns `HTMLElement[]`; the blanket `as HTMLInputElement[]` cast silences the compiler without checking, so a non-input `inline-name` element surfaces as a runtime `value`/`type` failure inside `userEvent.type` rather than a type error. Map and cast per element, or assert `instanceof HTMLInputElement`.
    • Unguarded querySelector click target · Line 74-78
      `pickColor` dereferences `document.querySelector('.ant-color-picker-trigger')` immediately; if the color picker has not mounted yet the `as HTMLElement` cast hides `null` and `userEvent.click(trigger)` throws `TypeError: trigger is null`. Wrap the lookup in the same `waitFor` retry pattern used for the preset below.
    • Magic default-contour count · Line 89-89
      `toHaveLength(3)` hardcodes the count of `DEFAULT_CONTOURS` in `index.tsx`; adding or removing a default contour silently breaks this test with an unexplained number. Export `DEFAULT_CONTOURS` and assert `toHaveLength(DEFAULT_CONTOURS.length)` so the link is explicit.
    • Repeated debounce sleep magic · Line 126-128
      `Constants.FAST_DEBOUNCE + 100` is repeated three times (lines 126, 128, 153); the bare `100` is an unexplained debounce-settling slack. Extract a named helper (e.g. `const debounceSettled = () => sleep(Constants.FAST_DEBOUNCE + 100)`) with a comment so the magic slack is defined once.
Review Details
  • Files reviewed - 7 · Commit Range: 6aa62bb..c9a4470
    • superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigControl.test.tsx
    • superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/ControlForm.test.tsx
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.test.tsx
    • superset-frontend/src/explore/components/controls/ContourControl/ContourOption.test.tsx
    • superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverControl.test.tsx
    • superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverTrigger.test.tsx
    • superset-frontend/src/explore/components/controls/ContourControl/index.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@sadpandajoe
sadpandajoe requested a review from rusackas October 1, 2026 17:22
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 2, 2026
sadpandajoe and others added 2 commits October 2, 2026 09:23
…ntrols

Keep the upstream ColumnConfigControl.test.tsx unchanged and move the
popover-based cases to ColumnConfigControl.popover.test.tsx, since the
upstream file mocks ColumnConfigItem file-wide.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 2, 2026
@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.27%. Comparing base (e048389) to head (f7e6d5a).
⚠️ Report is 375 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #44843      +/-   ##
==========================================
+ Coverage   82.14%   82.27%   +0.12%     
==========================================
  Files        2995     2995              
  Lines      184988   184988              
  Branches    42814    42814              
==========================================
+ Hits       151960   152195     +235     
+ Misses      30269    30034     -235     
  Partials     2759     2759              
Flag Coverage Δ
javascript 77.98% <ø> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@bito-code-review

bito-code-review Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #e8e8de

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: c9a4470..b3188f6
    • superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/ControlForm.test.tsx
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.test.tsx
    • superset-frontend/src/explore/components/controls/ContourControl/ContourOption.test.tsx
    • superset-frontend/src/explore/components/controls/ContourControl/index.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review

bito-code-review Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #517aa1

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: b3188f6..f7e6d5a
    • superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/ControlForm.test.tsx
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.test.tsx
    • superset-frontend/src/explore/components/controls/ContourControl/index.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Solid test-only PR, and I like that it calls out the pre-existing bugs it deliberately doesn't pin (verified the isoband-upper-threshold-of-0 truthiness quirk is real in ContourPopoverControl.tsx, so that's an honest caveat, not a cop-out). Both of CodeAnt's race-condition asks got real follow-up tests with a clear explanation of what was and wasn't reproducible. Bito's remaining nits (shared helpers, magic numbers in fixtures) are optional cleanup, not blockers for test code.

Needs a rebase before it's mergeable, but LGTM otherwise.

sadpandajoe and others added 2 commits October 20, 2026 14:54
…ntrols

Resolve ConditionalFormattingControl.test.tsx: keep both sides' tests. Master's
file-level FormattingPopover stub replaced the real popover the CRUD tests
drive, so the stub is dropped and the add/remove test uses the real popover.
Two prune tests no longer expect the mount-time onChange echo removed in #45352.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt PR Risk: Medium Risk

  • The PR needs attention before merging because rapid edits to separate form fields can overwrite an earlier value during the debounce window.
  • ControlForm updates built from stale values can discard an earlier field edit; the added test only checks edits made after the first change flushes.

Assessed commit: ffadc610f6be

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 22, 2026
@sadpandajoe
sadpandajoe merged commit d595bec into master Oct 22, 2026
76 checks passed
@sadpandajoe
sadpandajoe deleted the explore-rtl-crud-controls branch October 22, 2026 23:18
hughhhh added a commit that referenced this pull request Oct 23, 2026
…migration

The popover test added in #44843 asserted that a config stored under the
display alias `Time` is ignored. #44955 deliberately reads legacy
`Time`-keyed configs and migrates them onto `__timestamp`, so the
assertion is stale. Assert the intended behaviour instead: the legacy
config is read back and an edit is saved under `__timestamp`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 34d5617)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants