Deepen Facts internal contracts#21
Merged
Merged
Conversation
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
Deepens four shallow internal contracts in Facts that had started to cost real time: schema interpretation was duplicated, platform vocabulary was repeated across tests/docs/build tooling, CLI option metadata had already drifted, and host probe behaviour still leaked through category modules.
No public Facts library API change, no new runtime dependency, and the canonical structured fact tree is unchanged. User-visible output is stable except for corrected help/man docs and stricter failures for undocumented or overclaimed schema entries.
Tracked as OpenSpec change
deepen-facts-internal-contracts(proposal, design, specs, and tasks included underopenspec/changes/).Why
Four internal contracts were doing more work than their code shape admitted:
schema_test.goandtools/supportedfacts.--force-dot-resolutionwas accepted but undocumented).Sessionowned run-scoped discovery state, but category modules still reached around it to call host/runtime APIs directly.What changed
1. Schema contract (
internal/schema)docs/schema/facts.yaml, validating entries, flattening fact trees, platform vocabulary, and schema-path matching.schema_test.go(−211 lines) andtools/supportedfacts(−88 lines) become thin adapters over it instead of each re-implementing parsing and matching.disks.*,mountpoints.*) no longer act as blanket approval for arbitrary descendants. Open provider-shaped subtrees stay open only when explicitly marked. Undocumented emitted leaves now fail conformance.2. CLI option contract (
internal/cli/options.go)flag.FlagSetand app execution stay in place — this is shared vocabulary, not a new CLI framework.--force-dot-resolutionadded to help/man surfaces while it remains accepted. Drift tests prove every accepted non-hidden option appears in help/man output and the installed man page.3. Platform target profile (
internal/platform/profile.go)os/kernel/release facts preserved).4. Session host probe seam (
internal/engine/session.go,disks.go,os.go)Sessionhost seam only where category modules reached around it. Disk, partition, and mountpoint resolution now route through injectable host operations: platform identity, directory reads, globbing, command output, file reads, and stat data.Testing
gofmt -won edited files,go test ./...,go vet ./....*, documented vs unknown dynamic children, explicit open subtrees), CLI option drift, platform profile (target IDs, target-set separation, excludedsolaris/aix, OS identity, vocabulary alignment), and fake-host disk/partition/mountpoint probes.Notes
schema_test.goandtools/supportedfacts.