Fleet changelogs · dev.ecs0.net
rdmsm4x-changelog-20260905-0631-macos-ramdisk-remediation-unmount-force-e2e-gate

rdmsm4x — macOS-ramDisk-app Remediation: Unmount Force Logic & E2E Gate Clearance

Summary

Remediated critical unmount --force logic, Darwin DiskArbitration -69850 retry settling, access mode process lock inspection, Swift 6 strict concurrency configuration, and E2E test teardowns. Verified 15/15 Swift unit tests and 192/192 master E2E tests passing 100% cleanly, rebuilt Universal2 release fat binaries (x86_64 arm64), committed to main, and pushed to fleet.

Details

Actions Executed

  1. Unconditional Force Unmount Logic (Sources/ramdisk/main.swift):

    • Fixed --force unmount logic in main.swift so --force unconditionally forces unmount regardless of canReleaseWorkspace.
    • Preserved safe refusal exit code 1 when --force is absent and exclusive process write locks exist, satisfying T4.2 and T5.3.3 / T5.3.5.
  2. Storage Primitive Force Detach Fallback & Settling (Sources/RAMDiskCore/StoragePrimitive.swift):

    • Added detachVolume(device: String, force: Bool) to StoragePrimitiveProtocol.
    • In DarwinStoragePrimitive.detachVolume: implemented unconditional force detach (diskutil unmount force <mountPath>, diskutil unmountDisk force <targetDevice>, diskutil eject, hdiutil detach -force) when force == true, and automatic force fallback when clean diskutil eject fails with dissents when force == false.
    • In DarwinStoragePrimitive.formatVolume: added device settling probe with diskutil info and retry loop for -69850 / busy errors.
  3. Process Lock Inspector Access Mode & Libproc Enhancement (Sources/RAMDiskCore/ProcessLockInspector.swift):

    • Updated inspectLocksViaLsof arguments to ["-F", "pcfan", "-n", "-P", "+D", mountPath], adding access mode (a).
    • Added case "a" in parseLsofOutput to properly detect write modes (w, u, W) into hasWrite = true.
    • In inspectLocksViaLibproc: added Darwin kernel fi_openflags check for FWRITE = 0x0002 alongside POSIX O_WRONLY | O_RDWR.
  4. Package.swift Swift 6 Strict Concurrency:

    • Explicitly configured .swiftLanguageMode(.v6) and .enableExperimentalFeature("StrictConcurrency") across all 3 targets (RAMDiskCore, ramdisk, RAMDiskTests).
  5. Test Fixture Isolation & E2E Teardown Stabilization (Tests/):

    • In Tests/RAMDiskTests/SwiftTestingSuite.swift: isolated RAMDiskEngine with MockStoragePrimitive() and unique mount path to avoid host mount leakage.
    • In Tests/E2ETests/e2e_framework.py: updated unmount_volume to execute --force when force=True, and hardened ensure_unmounted with retry polling and cleanup.
    • In Tests/E2ETests/run_e2e_tests.sh: fixed diskutil eject force syntax in cleanup_ramdisks().
    • In Tests/E2ETests/test_tier3_cross_feature.py and test_tier4_real_world_scenarios.py: added reliable ensure_unmounted() teardown.
  6. Universal2 Fat-Binary Packaging:

    • Built release fat binary: swift build -c release --arch arm64 --arch x86_64.
    • Verified slices using lipo -archs:
      • .build/out/Products/Release/ramdisk: x86_64 arm64
      • dist/ramdisk: x86_64 arm64
      • dist/rdramdisk: x86_64 arm64
  7. Verification Evidence:

    • swift test: 15/15 tests passed cleanly (11 XCTest + 4 Swift Testing).
    • bash Tests/E2ETests/run_e2e_tests.sh:
      • Tier 1: Feature Coverage (70/70 PASS)
      • Tier 2: Boundary & Corner Cases (70/70 PASS)
      • Tier 3: Cross-Feature Combinations (8/8 PASS)
      • Tier 4: Real-World Scenarios (5/5 PASS)
      • Tier 5: Adversarial Challenge & Stress (39/39 PASS)
      • Total: ALL 5 TIERS PASSED (192/192 Tests Verified Cleanly in 58s).
  8. Git & Fleet Coordination:

    • Commits 0f1e97c and a136538 committed to main and pushed to fleet/main (git.ecs0.net:git/apps/macOS-ramDisk-app.git).
    • Appended completion comment to ticket FEAT-20260831-32.