Repository navigation
ci: add nightly NFS and Docker lock tests (#324) - #333
Merged
Merged
Conversation
Tiers 2 and 3 from the kernel file-locking design, deferred from #317/#332: the per-PR suite covers PID namespaces but cannot reach how std::fs::File::try_lock behaves on a network filesystem or in real containers. tests/nfs_lock_test.rs asserts the core #324 property on a loopback NFSv4 mount and an NFSv3 mount without lockd: a lock held by one process must never let a second process also believe it holds it. It also proves allow_unlocked is consulted only on a mount that cannot lock at all, never to bypass a live lock. tests/docker_lock_test.rs runs the same #317 regression shape (a killed holder's replacement must still be able to open) across two containers sharing a Docker volume, matching the original report literally. Both reuse examples/pid_ns_helper.rs, which gains an explicit mode match (an unrecognized mode now fails loudly instead of silently behaving like "open") and a new open-unlocked mode. Locally verifiable pieces (mode validation, open-unlocked on an ordinary filesystem, docker_available() reflecting a sandbox with no Docker) are covered by TDD here. The NFS- and Docker-gated assertions need root and a container runtime this sandbox doesn't have; they skip cleanly without their environment and are exercised for real by the new .github/workflows/nfs-lock.yml nightly workflow, which also records failures as tracking issues, matching fuzz.yml/property-tests.yml. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
test_docker_availability_check_reflects_this_sandbox asserted docker was never reachable, true only in the local sandbox this branch was written in. GitHub's ubuntu-latest runners have Docker preinstalled and running, so the assertion failed there -- while, in the same run, the two real gated tests it was meant to backstop actually exercised Docker for real and passed. Those two are the genuine proof; this one just encoded an environment assumption as a hard failure. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
cargo tarpaulin does not build examples/ before running tests, unlike plain cargo test. tests/nfs_lock_test.rs and tests/docker_lock_test.rs resolve examples/pid_ns_helper relative to the test binary's own target dir, so it must already be built. tests/pid_namespace_test.rs never hit this because it skips before reaching that check when unshare isn't available in tarpaulin's environment; the new tests don't have an equivalent early-out. Reproduced and verified the fix locally with cargo tarpaulin directly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
cargo tarpaulin deletes target/debug/examples/ as part of its own instrumented build, regardless of when it was built -- a plain `cargo build --examples` step before the tarpaulin run doesn't survive it. Reproduced locally against cargo-tarpaulin 0.35.2 from a clean checkout: the previous fix (build-examples-first) still failed with "helper binary not found", and target/debug/examples/ was empty after tarpaulin ran. nfs_lock_test.rs and docker_lock_test.rs now check MINIGRAF_PID_NS_HELPER before falling back to the current_exe()-derived path. coverage.yml builds the helper into an isolated --target-dir tarpaulin never touches and points the variable at it. Verified against a clean checkout with cargo tarpaulin directly: both suites pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Tiers 2 and 3 from the kernel file-locking design
(
docs/superpowers/specs/2026-08-22-kernel-file-locking-design.md),deferred from #317/#332: the per-PR suite (
tests/pid_namespace_test.rs)covers PID namespaces but cannot reach how
std::fs::File::try_lockbehaves on a network filesystem or in real containers.
tests/nfs_lock_test.rs— asserts the core ci: nightly file-locking tests on NFS and in containers #324 property on a loopbackNFSv4 mount and an NFSv3 mount without
lockd: a lock held by oneprocess must never let a second process also believe it holds it (a
silent no-op must fail the build). Also proves
allow_unlockedisconsulted only on a mount that cannot lock at all, never to bypass a
live lock.
tests/docker_lock_test.rs— runs the FileLock refuses stale lock under PID namespaces (Kubernetes): every container is PID 1 #317 regression shape (a killedholder's replacement must still be able to open) across two containers
sharing a Docker volume, matching the original report literally.
examples/pid_ns_helper.rs, which gains an explicit modematch (an unrecognized mode now fails loudly instead of silently
behaving like
open) and a newopen-unlockedmode..github/workflows/nfs-lock.yml— new nightly workflow (+workflow_dispatch) provisioning the loopback NFS export and runningboth suites, with the same failure-tracking-issue convention as
fuzz.yml/property-tests.yml.Test plan
cargo test --lib— 678 passedcargo test(full suite) — all 36 test binaries pass, 0 failedcargo fmt --check,cargo clippy --all-features -- -D warnings(CI's exact invocation) — cleanopen-unlockedonan ordinary filesystem,
docker_available()correctly reportingfalsein this sandbox (no Docker, no root)runtime this sandbox doesn't have — will dispatch
nfs-lock.ymlmanually once it's on a ref GitHub can run it from, to verify for
real on an Actions runner
Closes #324
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU