feat(core): add Linux support for process activity checks and filesystem tests - #7
Open
coder1408 wants to merge 1 commit into
Open
feat(core): add Linux support for process activity checks and filesystem tests#7coder1408 wants to merge 1 commit into
coder1408 wants to merge 1 commit into
Conversation
…tem tests - Implement Linux /proc/<pid>/exe and cwd tracking in ActivitySnapshot - Handle ext4 directory block allocation in hardlink accounting - Fix scan helper test permissions for 0002 umask environments - Add file.sync_all in review fixtures to prevent ext4 delalloc races - Un-gate and pass all 465 core unit and integration tests on Linux
Contributor
|
@coder1408 is attempting to deploy a commit to the McIlroy Team on Vercel. A member of the Team first needs to authorize it. |
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.
Linux Native Support for Chippytea Core
Summary
This PR enables the Chippytea core Rust engine to run natively on Linux, laying the foundation for cross-platform Linux support while preserving all existing safety guarantees and invariants.
Previously, on non-macOS platforms,
ActivitySnapshot::capturereturned an unconditional error, preventing artifact revalidation and cleanup. This PR implements Linux/procinspection to track active processes and addresses filesystem differences, including ext4/XFS directory block allocation, delayed allocation timing, and strictumaskpermissions.As a result, the entire core test suite now compiles and passes cleanly on Linux.
No deletion safety rules or candidate eligibility definitions have been broadened or altered.
Key Changes
1. Linux Process Activity Tracking
File:
core/src/activity.rsImplemented
#[cfg(target_os = "linux")] ActivitySnapshot::capture(&AtomicBool).Uses
/proc/<pid>/exeand/proc/<pid>/cwdto inspect running processes.Tracks only processes owned by the current effective user (
stat.st_uid == libc::geteuid()).Excludes the current process's own working directory to avoid self-blocking.
Handles the macOS app-bundle cache (
blocked_owning_cache) on Linux by returningOk(BTreeSet::new())instead of failing closed with a platform error.2. Filesystem & Allocation Adaptations
Ext4/XFS Directory Block Accounting
File:
core/src/scanner.rsOn Linux, directories consume allocated blocks, typically 4,096 bytes per directory, unlike APFS where directories consume 0 allocated bytes.
Updated
logical_lanes_share_exact_hardlink_accounting_without_duplicate_bytesto deduct directory-allocated blocks fromtraverse_metadatatotals.This keeps hardlink accounting exact across different filesystem implementations.
Ext4 Delayed Allocation
File:
core/src/cleanup.rsAdded
file.sync_all()toreview_fixture.Ensures disk extents are committed before scanning.
Prevents delayed-allocation timing races during parallel test execution.
Engine Lock Reopen Retry
File:
core/src/lib.rsAdded a bounded retry in
reopen_foreground_fixture.Prevents lockfile contention races when an
Engineinstance is dropped and immediately reopened during heavy concurrent test execution.3. Strict Trusted Context &
umaskHardeningFiles:
core/src/scan_worker.rscore/tests/support/mod.rsChippytea's
trusted_contextrequires helper directories to be non-writable by group or others (mode & 0o022 == 0).On Linux distributions with a default
0002umask, temporary test folders and Cargo'starget/debug/depsdirectory can be created with mode0775, violating this invariant.To address this:
Updated test runners to explicitly set directory permissions to
0o700or0o755.Updated
stage_helperto explicitly strip group/other write permissions.Preserves the existing trusted-context security invariant across Linux environments.
4. Un-gated Test Coverage
Files:
core/src/cleanup.rscore/src/scanner.rscore/tests/hardlinks.rsUn-gated 20+ tests that were previously restricted to
#[cfg(target_os = "macos")].This enables full Linux verification of:
Hardlink integration tests (
core/tests/hardlinks.rs)Python virtual environment (
.venv) symlink preservation and measurementLive process activity rejection during revalidation
Duplicate cleanup guards
Atomic manifest rollback on failure
Verification & Checks Run
All checks were executed on Linux (
Check | Result -- | -- Core Test Suite | 465 passed, 0 failed, 0 ignored Clippy | 0 warnings Formatter | Clean Public Files Check | 143 paths checked, 0 errors CLI Smoke Test | Completed in 1ms with 0 errorsx86_64, kernel 6.17+).Core Test Suite
Result:
465 passed, 0 failed, 0 ignoredBreakdown:
438 unit tests in
chippytea_core1 unit test in
chippytea_scan_helper15 integration tests in
discovery2 integration tests in
hardlinks9 integration tests in
safetyLinter
Result: 0 warnings
Formatter
Result: Clean
Public Files Check
Result: 143 paths checked, 0 errors
CLI Smoke Test
Result: Completed in 1ms with 0 errors
Checks Not Run
macOS Native SwiftUI App Build
This check was not run because the development environment was Linux and did not have access to macOS 14+ or Xcode.
Note: No macOS-specific code under
native/was modified in this PR.