feat!: stop routine events from rotating machine IDs (D2) - #19
Merged
Merged
Conversation
Four inputs that changed on ordinary maintenance are now excluded from
the hash. This changes IDs on affected machines; see the README section
"ID compatibility across versions" for the migration note.
Linux CPU (WithCPU)
- The identifier is now "vendor:model[:hardware]" from the first core.
The kernel's "flags" line gained entries after kernel and microcode
updates and the processor index changed when a VM was resized; both
rotated the ID on routine maintenance.
- aarch64 kernels have no vendor_id or model name; "CPU implementer",
"CPU part", "CPU variant", "CPU revision" and "Hardware" are used
instead of the previous empty fields.
Network (WithMAC, physical filter)
- Hyper-V and WSL switches ("vEthernet (...)"), Bluetooth PAN, Wi-Fi
Direct, VirtualBox and VMware host adapters, Npcap and TAP-Windows on
Windows; awdl, llw, ap and anpi on macOS; tailscale, zerotier, cni,
flannel, calico, dummy, vxlan and other overlay names on Linux are now
classified as virtual.
- Windows friendly names (with spaces) use their own rules so the
kernel prefix "lo" cannot misclassify "Local Area Connection".
Loopback is matched exactly (lo, lo0, ...).
Disks (WithDisk)
- Linux: lsblk is queried with -P -o NAME,TYPE,RM,SERIAL and only
TYPE=disk RM=0 devices count; /sys/block skips removable=1 and the
loop/ram/zram/dm-/md/sr/fd/nbd/mtd families.
- Windows: USB interfaces and Removable/External media are excluded in
both the wmic and the PowerShell path.
- Plugging in a USB drive, SD card or DVD no longer changes the ID.
README: stability table rewritten, MAC filter table updated, migration
paragraph added. Table tests cover every new classification and the
"flags added / index changed => same identifier" property.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
Implements decision D2 from the Go 1.27 review: four inputs that rotated machine IDs on routine events are now excluded from the hash. This changes IDs on affected machines, deliberately, and ships in v0.2.0 with a migration note in the README ("ID compatibility across versions").
WithCPU()processor:vendor:model:flagsvendor:model[:hardware], first coreN:::)WithMAC()physical filtervEthernet, Bluetooth PAN, Wi-Fi Direct, VirtualBox/VMware host adapters, Npcap,awdl/llw/ap/anpi, tailscale/zerotier/cni/flannel/calico counted as physicalWithDisk()lsblkTYPE=disk RM=0, sysfsremovable, wmic/PowerShell InterfaceType and MediaType)Everything else is unchanged: default CLI flags (
-cpu -motherboard -uuid) on macOS and Windows produce the same IDs as v0.1.3.Details worth a look
vethernet,bluetooth,npcap,vmware,virtualbox,hyper-v,tap-windowsprefixes;virtual,wi-fi direct,loopback,*substrings). Kernel-style names use the prefix list plus an exact loopback rule. The first draft used one flat list and theloprefix misclassifiedLocal Area Connection; the table test caught it and now pinslom1,logical0,Local Area Connection,Ethernet 2as physical.InterfaceType/MediaTypefields is still accepted (instances without type fields are kept).Verification
gofmt, vet, golangci-lint (0 issues),
go test -race ./...on darwin; vet and test binaries compile for linux and windows; modernize and betteralign clean. The Linux and Windows suites run in this PR's CI.🤖 Generated with Claude Code