镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Remove unused windows_updates MySQL table and ingestion - #44128

Merged
lucasmrod merged 5 commits into
mainfrom
44127-remove-unused-windows_updates
Apr 24, 2026
Merged

lucasmrod merged 5 commits into
mainfrom
44127-remove-unused-windows_updates

Conversation

@lucasmrod

@lucasmrod lucasmrod commented Apr 24, 2026 •

Copy link
Copy Markdown
Member

Related issue: Resolves #44127

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.

Testing

  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • Chores
    • Removed the unused Windows Updates feature: ingestion, parsing, persistence APIs, and detail query; added a migration to drop the related database table.
  • Tests
    • Removed unit and integration tests for Windows update parsing, ingestion, persistence, and query inclusion.

Copilot AI review requested due to automatic review settings April 24, 2026 15:42
@lucasmrod
lucasmrod requested a review from a team as a code owner April 24, 2026 15:42

@claude claude 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

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

@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Removes the unused windows_updates MySQL table and adds a migration to drop it. Deletes the windows_update_history osquery detail query and its direct ingest path, the WindowsUpdate type and parsing/comparison logic, MySQL datastore methods and tests for listing/inserting Windows updates, related mock hooks, and references to windows_updates in host cleanup and query sets. The MDM windows_updates deadline/grace-period policy is unchanged.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing an unused windows_updates MySQL table and its ingestion code.
Linked Issues check ✅ Passed The PR comprehensively implements all planned changes from issue #44127: database migration to drop the table, removal of the osquery detail query, removal of related types and datastore methods, interface cleanup, and mock regeneration.
Out of Scope Changes check ✅ Passed All changes are in-scope and directly related to removing the unused windows_updates table and its ingestion infrastructure as specified in issue #44127.
Description check ✅ Passed PR description includes changes file notice, test completion, and related issue link.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 44127-remove-unused-windows_updates

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 and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@server/datastore/mysql/migrations/tables/20260423153950_DropWindowsUpdatesTable.go`:
- Around line 12-17: hostRefs in server/datastore/mysql/hosts.go still lists
"windows_updates" which was dropped by Up_20260423153950; remove the
"windows_updates" entry from the hostRefs array (the slice/array named hostRefs
used when deleting host-related rows) so the deletion loop no longer issues
DELETE FROM windows_updates and fails; update hostRefs to exclude that string
and run relevant tests to ensure host deletion proceeds without referencing the
dropped table.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d5eae61c-0960-406c-9473-0ce32bcfec0c

📥 Commits

Reviewing files that changed from the base of the PR and between 43e32d9 and ec56334.

📒 Files selected for processing (11)
  • changes/44127-remove-unused-windows_updates
  • server/datastore/mysql/migrations/tables/20260423153950_DropWindowsUpdatesTable.go
  • server/datastore/mysql/migrations/tables/20260423153950_DropWindowsUpdatesTable_test.go
  • server/datastore/mysql/windows_updates.go
  • server/datastore/mysql/windows_updates_test.go
  • server/fleet/datastore.go
  • server/fleet/windows_updates.go
  • server/fleet/windows_updates_tests.go
  • server/mock/datastore_mock.go
  • server/service/osquery_utils/queries.go
  • server/service/osquery_utils/queries_test.go
💤 Files with no reviewable changes (8)
  • server/fleet/windows_updates_tests.go
  • server/datastore/mysql/windows_updates_test.go
  • server/datastore/mysql/windows_updates.go
  • server/fleet/datastore.go
  • server/service/osquery_utils/queries_test.go
  • server/service/osquery_utils/queries.go
  • server/mock/datastore_mock.go
  • server/fleet/windows_updates.go

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

Removes the unused windows_updates MySQL table and its associated osquery detail query ingestion so Fleet no longer schedules windows_update_history or maintains dead datastore/types.

Changes:

  • Removed the windows_update_history detail query and directIngestWindowsUpdateHistory ingestion.
  • Deleted windows_updates fleet types + MySQL datastore methods and removed the corresponding datastore interface/mock methods.
  • Added a MySQL migration to drop the windows_updates table (and a changelog entry).

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/service/osquery_utils/queries.go Removes the Windows update history detail query and ingestion hook.
server/service/osquery_utils/queries_test.go Updates detail-query expectations and removes ingestion test for windows update history.
server/fleet/datastore.go Removes windows_updates methods from the datastore interface.
server/mock/datastore_mock.go Removes mock methods/func fields for windows_updates datastore APIs.
server/fleet/windows_updates.go Deletes unused WindowsUpdate parsing/types.
server/fleet/windows_updates_tests.go Deletes tests for removed WindowsUpdate parsing logic.
server/datastore/mysql/windows_updates.go Deletes MySQL implementation for the removed windows_updates datastore APIs.
server/datastore/mysql/windows_updates_test.go Deletes MySQL tests for the removed windows_updates datastore APIs.
server/datastore/mysql/migrations/tables/20260423153950_DropWindowsUpdatesTable.go Adds migration to drop windows_updates table.
server/datastore/mysql/migrations/tables/20260423153950_DropWindowsUpdatesTable_test.go Adds migration test validating the table is dropped.
changes/44127-remove-unused-windows_updates Adds release note entry for the removal.

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

Comment thread server/service/osquery_utils/queries.go Resolved

@getvictor getvictor 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.

Looks good. See CI and CodeRabbit suggestion

@codecov

codecov Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.78%. Comparing base (28908e6) to head (26a2030).
⚠️ Report is 56 commits behind head on main.

Files with missing lines Patch % Lines
...s/tables/20260423161824_DropWindowsUpdatesTable.go 50.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #44128      +/-   ##
==========================================
+ Coverage   66.75%   66.78%   +0.02%     
==========================================
  Files        2623     2621       -2     
  Lines      211148   211106      -42     
  Branches     9386     9386              
==========================================
+ Hits       140959   140987      +28     
+ Misses      57357    57307      -50     
+ Partials    12832    12812      -20     
Flag Coverage Δ
backend 68.56% <50.00%> (+0.03%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
server/service/osquery_test.go (1)

2495-2496: ⚠️ Potential issue | 🟠 Major

Update test assertion from len(expected)+3 to len(expected)+2 and remove stale windows update history reference.

The comment and assertion are outdated. windows_update_history is not a detail query—it exists only in seed data and the osquery table implementation, not in osquery_utils.GetDetailQueries. With a Windows host and one campaign query (ID 42), the test should account for exactly two additional queries: the campaign query and fleet_no_policies_wildcard. Update the assertion and comment accordingly:

✏️ Proposed fix
-	// +1 for the distributed query for campaign ID 42, +1 for windows update history, +1 for the fleet_no_policies_wildcard query.
-	if expected := expectedDetailQueriesForPlatform(host.Platform); !assert.Equal(t, len(expected)+3, len(queries)) {
+	// +1 for the distributed query for campaign ID 42, +1 for the fleet_no_policies_wildcard query.
+	if expected := expectedDetailQueriesForPlatform(host.Platform); !assert.Equal(t, len(expected)+2, len(queries)) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/service/osquery_test.go` around lines 2495 - 2496, Update the test
comment and assertion in server/service/osquery_test.go to remove the stale
"windows update history" reference and change the expected count from
len(expected)+3 to len(expected)+2: adjust the comment that explains why we add
extra queries to mention only the campaign query (ID 42) and the
fleet_no_policies_wildcard, and change the assertion using
expectedDetailQueriesForPlatform(host.Platform) to assert.Equal(t,
len(expected)+2, len(queries)); ensure you update any nearby explanatory text to
match this corrected expectation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@server/service/osquery_test.go`:
- Around line 2495-2496: Update the test comment and assertion in
server/service/osquery_test.go to remove the stale "windows update history"
reference and change the expected count from len(expected)+3 to len(expected)+2:
adjust the comment that explains why we add extra queries to mention only the
campaign query (ID 42) and the fleet_no_policies_wildcard, and change the
assertion using expectedDetailQueriesForPlatform(host.Platform) to
assert.Equal(t, len(expected)+2, len(queries)); ensure you update any nearby
explanatory text to match this corrected expectation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: efdf06d7-5465-4225-832f-fef04c1cb64c

📥 Commits

Reviewing files that changed from the base of the PR and between ec56334 and 20878ec.

⛔ Files ignored due to path filters (1)
  • docs/Contributing/product-groups/orchestration/understanding-host-vitals.md is excluded by !**/*.md
📒 Files selected for processing (4)
  • server/datastore/mysql/hosts.go
  • server/datastore/mysql/hosts_test.go
  • server/datastore/mysql/schema.sql
  • server/service/osquery_test.go
💤 Files with no reviewable changes (2)
  • server/datastore/mysql/hosts.go
  • server/datastore/mysql/hosts_test.go

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@server/datastore/mysql/migrations/tables/20260423161824_DropWindowsUpdatesTable.go`:
- Around line 8-20: The migration functions are misversioned: the file is
20260423161824_DropWindowsUpdatesTable.go and schema seeds version
20260423161824, but the code registers Up_20260423153950/Down_20260423153950;
rename the functions and their registrations from Up_20260423153950 and
Down_20260423153950 to Up_20260423161824 and Down_20260423161824 (and update the
MigrationClient.AddMigration call to use the new symbols) so the migration
version matches the file name and schema seed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4e92ee9a-1720-48d5-a3b5-b1dad4708297

📥 Commits

Reviewing files that changed from the base of the PR and between 20878ec and 9eaee68.

📒 Files selected for processing (2)
  • server/datastore/mysql/migrations/tables/20260423161824_DropWindowsUpdatesTable.go
  • server/datastore/mysql/schema.sql

@sgress454 sgress454 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.

understanding-host-vitals.md removal matches code removal 👍

@lucasmrod
lucasmrod merged commit c22954e into main Apr 24, 2026
53 checks passed
@lucasmrod
lucasmrod deleted the 44127-remove-unused-windows_updates branch April 24, 2026 18:21

This branch was previously deployed

1 inactive deployment
Docker Hub — 26a20303 Deployed Apr 24, 2026 by lucasmrod via publish #86378
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.

Remove unused windows_updates table and ingestion

4 participants