test(sys): invariant test suite for lib/sys + Arch.parse/goarch extraction - #59
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Test Results 4 files ± 0 177 suites +14 1m 41s ⏱️ +5s For more details on these failures, see this check. Results for commit 051829b. ± Comparison against base commit 5b5068f. |
This was referenced Jul 8, 2026
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
Closes the real test gaps in
lib/syswith invariant-driven tests (plan:docs/superpowers/plans/2026-07-07-sys-test-suite.md), plus three small refactors that expose pure functions so logic buried behind fixed system paths becomes property-testable:Sys.Arch— extracted pureparse/1; absorbedgoarch/1fromHyper.Img.OciLoader(it is an architecture fact, not an OCI-loader fact). New inverse law:parse(goarch(a)) == {:ok, a}.Sys.Linux.Proc.Mounts— extractedparse/1(mirrorsMeminfo.parse/1); property pins the keep-valid/skip-garbage/preserve-order law; live smoke asserts/is always mounted.Sys.Linux.Subid— promoted privatesubid_ranges/1to publicranges/1(body unchanged); properties pin the security-relevant whole-file refusal: one malformed line anywhere refuses the entire file.Sys.Posix— real-filesystem tests: exec-bit table + the four distinct refusal paths ofensure_writable_dir/1(root-exempt cases self-skip under uid 0).Sys.Tmp—with_tempdir/2lifecycle, incl. the load-bearing cleanup-on-raise contract.Sys.Linux.Nss/Meminfo— live passwd round-trip (uid 0 exists on every Linux),getentrefusal contract, short-line skip branch.Sys.Mon— live monitor-stack contract:readings/0answers for all four metrics; forced real samples through/proc+/sysassert domain invariants (CPU fraction clamped to 0..1, positive used memory, non-negative bandwidth).Coverage triage per CLAUDE.md: mechanical error-propagation arms and environment-surgery paths are deliberately declined, recorded in the plan's "Declined coverage" section.
Test plan
mix test test/sys— 123/123 (49 properties, 74 tests), no Postgres/Firecracker needed--warnings-as-errors, credo--strict, dialyzer 0Sys.Posixbugs all caught) and 5x flake runs on the live mon tests