feat: Condition gates for system-state-gated resources#8
Merged
Conversation
- Move networkInterfaceCondition struct/Met/String to build-tag-free condition/network_interface.go; platform files keep only Wait() - Move mountPointCondition struct/Met/String to condition/mount_point_unix.go (linux || darwin); Windows keeps its own struct/Met/String - Remove sync.Mutex from Windows NotifyIpInterfaceChange callback (deadlock risk in thread pool context); buffered channel select/default is sufficient - Replace hand-rolled iphlpapi procs with windows.NotifyIpInterfaceChange and windows.CancelMibChangeNotify2 from x/sys/windows; drops unsafe import - Remove unsafe import from file_windows.go; ReadDirectoryChanges takes *byte - Move overlapped event handle creation outside the loop in file_windows.go; add CancelIoEx on timeout; check GetOverlappedResult error - Fix tests: dynamic loopback interface lookup, positive NetworkReachable case, rename misleading subtest, t.Skip for container/WSL mount edge case - Fix docs/design.md: Puppet runtime is Ruby (agent) + JVM/JRuby (server only); Puppet apply compiles catalog locally; ansible-pull noted; ChefSpec vs InSpec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #7: condition gates for system-state-gated resources.
Summary
Conditioninterface inextensions/:Met(),Wait(),String()— gates daemon convergence on system statecondition/package:FileExists,NetworkReachable,NetworkInterface,MountPointWait()implementations: netlink RTMGRP_LINK (Linux), NotifyIpInterfaceChange (Windows), 2s poll (macOS) for network interfaces; inotify on/proc/self/mountinfo(Linux), kqueue on/(macOS), 5s poll (Windows) for mount points; inotify/kqueue/ReadDirectoryChangesW for file existenceconditionsMet sync.Maptracks per-resource gate state; condition watcher goroutine blocks untilWait()returns, then injectsEventConditionto trigger initial convergenceEventConditionsend is blocking withctx.Done()guard — a dropped event would leave the resource permanently unconvergedunsafeimports:windows.NotifyIpInterfaceChange/windows.CancelMibChangeNotify2from x/sys/windows used directly;ReadDirectoryChangestakes*byteWait()--timeout, then as a daemon on the running system — same blueprint, both phases); Chef/Puppet/Ansible accuracy fixesIntegration test (WSL2)
Skips: systemd not running in WSL (service drift test), nftables not available (firewall test). Both expected.
Usage
Ref #7