Skip to content

fix(#505): harden tests and correct uncovered network behavior - #505

Merged
cachebag merged 4 commits into
masterfrom
fix/505-test-audit-hardening
Jul 18, 2026
Merged

fix(#505): harden tests and correct uncovered network behavior#505
cachebag merged 4 commits into
masterfrom
fix/505-test-audit-hardening

Conversation

@cachebag

@cachebag cachebag commented Jul 18, 2026

Copy link
Copy Markdown
Member

This PR performs a comprehensive audit and overhaul of the unit and integration test suites. The previous suite had several permissive, redundant, or overly broad assertions that could remain green without proving the intended behavior. Tests now validate exact D-Bus payloads, typed errors, state transitions, boundary conditions, race handling, cleanup behavior, and both successful and failing paths.

The integration suite has been consolidated into four strict, isolated contracts covering saved-profile CRUD and events, secret-agent registration and request handling, native WireGuard activation, wired DHCP, WPA WiFi authentication, saved-credential reuse, and callback monitoring. These tests use panic-safe cleanup and run against a private NetworkManager environment so they cannot modify developer or CI host profiles.

The audit also exposed several production defects. This PR corrects NetworkManager payload construction and decoding for WiFi, Bluetooth, VLAN, WireGuard, OpenVPN, and access points. It fixes fresh versus saved WiFi credential handling, removes failed newly-created profiles while preserving existing profiles, strengthens validation and OpenVPN parsing, prevents certificate-store collisions, and improves activation timeout handling.

Monitoring APIs now wait until their D-Bus subscriptions are ready before returning, preventing callers from missing immediate changes. Secret-agent handling now reports accurate lifecycle errors, supports concurrent requests with identical keys, handles cancellation and backpressure correctly, and reports closed responders. Active-connection enumeration also tolerates NetworkManager objects disappearing during a snapshot without hiding unrelated D-Bus failures.

Device handling now ignores unmanaged interfaces during automatic selection and recognizes NetworkManager veth devices as wired Ethernet. The integration harness includes private D-Bus, udev, veth, dnsmasq, WireGuard, hostapd, wpa_supplicant, and mac80211_hwsim support, with CI safeguards to prevent the host NetworkManager from claiming test radios. Related documentation, contributor guidance, test commands, and changelog entries have been updated.

AI Disclosure: GPT 5.6 Sol on Ultra via Zed was tasked with performing almost all of the changes. Specific coverage and unit tests we're manually refined by me and all code was manually reviewed and tested.

Replace permissive and redundant tests with exact happy-path, failure-path,
payload, error, boundary, race, and cleanup assertions.

Add isolated NetworkManager integration coverage for settings events, secret
agent requests, WireGuard activation, wired DHCP, WiFi authentication, and
monitor callbacks.

Fix behavioral defects exposed by the audit, including builder serialization,
saved WiFi credential handling, monitor readiness, secret-agent concurrency,
veth classification, validation, and active-connection enumeration races.
@cachebag cachebag self-assigned this Jul 18, 2026
@cachebag cachebag added tests Add, remove or adjust tests CI/CD Changes to CI/CD pipeline dbus D-Bus types, signatures, or NM D-Bus API nm-compat NetworkManager compatibility or runtime rejection labels Jul 18, 2026
@cachebag
cachebag had a problem deploying to self-hosted-pr-integration July 18, 2026 15:19 — with GitHub Actions Failure
@cachebag
cachebag had a problem deploying to self-hosted-pr-integration July 18, 2026 15:21 — with GitHub Actions Failure
@cachebag
cachebag had a problem deploying to self-hosted-pr-integration July 18, 2026 15:23 — with GitHub Actions Failure
@cachebag
cachebag had a problem deploying to self-hosted-pr-integration July 18, 2026 15:27 — with GitHub Actions Failure
@cachebag
cachebag force-pushed the fix/505-test-audit-hardening branch from c46b73f to 0585f7a Compare July 18, 2026 15:29
@cachebag
cachebag had a problem deploying to self-hosted-pr-integration July 18, 2026 15:29 — with GitHub Actions Failure
@cachebag
cachebag had a problem deploying to self-hosted-pr-integration July 18, 2026 15:35 — with GitHub Actions Failure
Treat a managed WiFi device in NetworkManagers transient Unavailable state
as a readiness candidate instead of returning WifiNotReady immediately.
@cachebag
cachebag temporarily deployed to self-hosted-pr-integration July 18, 2026 15:39 — with GitHub Actions Inactive
@cachebag
cachebag merged commit 0096331 into master Jul 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD Changes to CI/CD pipeline dbus D-Bus types, signatures, or NM D-Bus API nm-compat NetworkManager compatibility or runtime rejection tests Add, remove or adjust tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant