Skip to content

Conversation

@lixmal
Copy link
Collaborator

@lixmal lixmal commented Oct 26, 2025

Describe your changes

Issue ticket number and link

Stack

CreatedKeys wasn't saved in the state file so dns was also not cleaned up completely on crash

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Copilot AI review requested due to automatic review settings October 26, 2025 15:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes macOS state-based DNS cleanup by ensuring that created DNS configuration keys are properly tracked and restored during unclean shutdown recovery.

Key Changes:

  • Added CreatedKeys field to ShutdownState struct to track created DNS configuration keys
  • Introduced updateState() helper methods in both macOS and Windows DNS configurators to centralize state management
  • Improved error handling and logging in macOS DNS configuration

Reviewed Changes

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

File Description
client/internal/dns/unclean_shutdown_darwin.go Added CreatedKeys field to ShutdownState and logic to restore tracked keys during cleanup
client/internal/dns/host_darwin.go Implemented updateState() method and added multiple state update calls to track DNS configuration changes
client/internal/dns/host_windows.go Refactored duplicate state update code into reusable updateState() method

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

@lixmal lixmal force-pushed the macos-state-dns-fix branch from f99dea3 to 73d7481 Compare October 26, 2025 15:57
@lixmal lixmal force-pushed the macos-state-dns-fix branch from 73d7481 to 22afe34 Compare October 26, 2025 15:59
@sonarqubecloud
Copy link

@lixmal lixmal merged commit b9ef214 into main Oct 27, 2025
36 checks passed
@lixmal lixmal deleted the macos-state-dns-fix branch October 27, 2025 17:35
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