harden fact discovery contracts#23
Merged
Merged
Conversation
Fix schema wildcard expansion so escaped dynamic fact keys, such as mountpoint paths containing dots, match concrete schema requirements instead of being re-split as path segments. Preserve the mountpoints options contract for parsed entries that have device or filesystem data but no options list, and make the cache file mode test avoid POSIX permission assertions on Windows.
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
This PR commits the current hardening pass across Facts discovery, formatting, config, cache, schema, and release validation, plus the follow-up CI fixes from PR validation.
The latest fix keeps the mountpoint contract intact instead of making mountpoints conditional: every real OS needs at least one mount point, and the failures came from code/test issues. Schema conformance now handles escaped dynamic mountpoint keys correctly, parsed mount entries keep
mountpoints.*.optionspresent even when the OS reports no options, and the Windows cache test no longer asserts POSIX permission bits on a platform that reports them differently.Changes
Engine.Discovernow returns an error instead of panicking, map key normalization rejects duplicate string forms, and snapshot/structured fact handling is more deterministic.--delimiter handling and dash-prefixed option values, and avoid adding an extra newline for YAMLfacterversionoutput.mountpoints./etc/resolv\.conf.size, so dotted mount paths do not get re-split into false missing schema entries.mountpoints.*.optionsschema contract for parsed mount entries that have device or filesystem data but no options list by emitting an empty option slice.0600permission bits on Windows.distbefore building and no longer requires a release artifact, release gates coverdisks,partitions, andpath, and generated local artifacts are ignored.Validation
gofmt -won modified Go filesgo test ./...- 1626 passed in 9 packagesgo vet ./...- no issues foundgo test -race . ./internal/engine ./internal/app- 1502 passed in 3 packagesmake buildCGO_ENABLED=0 GOOS/GOARCH go build ./...passed for linux, windows, darwin, freebsd, openbsd, netbsd, dragonfly, illumos, and plan9 targets in the workflow matrixgolang:1.26-bookwormandgolang:1.26-alpineboth passedTestFactsSchemaConformanceinternal/enginetest binary passedTestWriteCacheFileWritesFinalFileAndRemovesTemp