Skip to content

Fleet UI: Fix ManageSoftwareAutomationsModal test type errors - #48878

Merged
RachelElysia merged 1 commit into
mainfrom
fix-manage-software-automations-test-types
Jul 7, 2026
Merged

Fleet UI: Fix ManageSoftwareAutomationsModal test type errors#48878
RachelElysia merged 1 commit into
mainfrom
fix-manage-software-automations-test-types

Conversation

@RachelElysia

@RachelElysia RachelElysia commented Jul 7, 2026

Copy link
Copy Markdown
Member

Issue

Broken test file introduced in #48854 — failing on the build-binaries > Generate static files job (first surfaced on #48871's CI run).

Description

  • Root cause: babel-jest strips TS types by erasure without type-checking, so Jest CI passed on Add onURLBlur handler for InputField #48854. Strict TS check runs inside webpack's ForkTsCheckerWebpackPlugin (webpack.config.js:15), which only fires during make generate-js in the build-binaries job — that job apparently didn't gate Add onURLBlur handler for InputField #48854 and first surfaced the failure on a downstream PR.
  • Bug: the test passed partial nested objects to createMockConfig, which accepts Partial<IConfig> — top-level keys may be omitted, but each included value must be complete. webhook_settings needed failing_policies_webhook, host_status_webhook, and activities_webhook alongside the provided vulnerabilities_webhook; gitops needed repository_url and exceptions alongside gitops_mode_enabled.
  • Fix: fill in the missing required fields in the two createMockConfig(...) call sites in ManageSoftwareAutomationsModal.tests.tsx.

Screenrecording

  • N/A (test-only change)

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • Tests
    • Updated automated test data to cover additional software webhook settings and destination URL validation scenarios.
    • Refined mocked GitOps configuration used in modal tests to better reflect current settings structure.

Root cause: babel-jest strips TS types by erasure without type-checking,
so the Jest CI job passed on #48854. The strict check runs inside
webpack's ForkTsCheckerWebpackPlugin (webpack.config.js:15), which only
fires during `make generate-js` in the build-binaries job — that job
apparently didn't gate #48854 and first surfaced the failure on a
downstream PR.

The test passed partial nested objects to createMockConfig, which
accepts Partial<IConfig> — top-level keys may be omitted but each
included value must be complete. Filled in the missing required fields
so the shapes satisfy IWebhookSettings and IGitOpsModeConfig.
Copilot AI review requested due to automatic review settings July 7, 2026 17:29
@RachelElysia
RachelElysia requested a review from a team as a code owner July 7, 2026 17:29

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

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 TypeScript type errors in ManageSoftwareAutomationsModal tests by ensuring createMockConfig overrides provide complete values for required nested config objects (since createMockConfig shallow-merges overrides).

Changes:

  • Extend the webhook_settings override in the test to include all required webhook sub-objects (failing_policies_webhook, host_status_webhook, activities_webhook) alongside vulnerabilities_webhook.
  • Extend the gitops override in the test render context to include required fields (repository_url, exceptions) alongside gitops_mode_enabled.

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

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.09%. Comparing base (4c79d6b) to head (c3ed876).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #48878      +/-   ##
==========================================
+ Coverage   68.06%   68.09%   +0.02%     
==========================================
  Files        3694     3694              
  Lines      234689   234339     -350     
  Branches    12501    12501              
==========================================
- Hits       159748   159574     -174     
+ Misses      60597    60445     -152     
+ Partials    14344    14320      -24     
Flag Coverage Δ
frontend 59.27% <ø> (ø)

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.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 46c1602a-5b8f-4102-a440-bc3e6d717a6d

📥 Commits

Reviewing files that changed from the base of the PR and between 4c79d6b and c3ed876.

📒 Files selected for processing (1)
  • frontend/pages/SoftwarePage/components/modals/ManageSoftwareAutomationsModal/ManageSoftwareAutomationsModal.tests.tsx

Walkthrough

This change updates test fixtures within a single test file for the ManageSoftwareAutomationsModal component. The mocked softwareConfig webhook settings are expanded to include failing_policies_webhook, host_status_webhook, and activities_webhook entries. The mocked backend app.config used by the renderModal helper is updated to replace a single gitops_mode_enabled field with a fuller gitops object containing gitops_mode_enabled, repository_url, and an exceptions object with labels, software, and secrets flags.

Changes

Cohort / File(s) Summary
Test mock updates: ManageSoftwareAutomationsModal.tests.tsx Expanded mocked webhook_settings with additional webhook entries; replaced mocked gitops_mode_enabled with a full gitops config object including exceptions

Sequence Diagram(s)

Not applicable — changes are limited to test fixture data updates with no observable control flow to diagram.

Related issues: None found in provided context.

Related PRs: None found in provided context.

Suggested labels: frontend, tests

Suggested reviewers: None found in provided context.

🐰 A hop through mocks, a tweak so slight,
Webhooks added, gitops set right,
Tests now hum with fuller data in tow,
A rabbit's small nudge to keep checks aglow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: fixing type errors in ManageSoftwareAutomationsModal tests.
Description check ✅ Passed The description includes the issue, root cause, fix summary, and testing details, covering the main template requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-manage-software-automations-test-types

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RachelElysia

Copy link
Copy Markdown
Member Author

@claude review

@RachelElysia
RachelElysia merged commit 2d64dcc into main Jul 7, 2026
27 checks passed
@RachelElysia
RachelElysia deleted the fix-manage-software-automations-test-types branch July 7, 2026 17:38
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.

3 participants