Skip to content

System Architecture & Design Invariants

fparted is designed with strict layering to decouple user interface actions from privileged operating system commands. Every action operates across well-defined boundaries to prevent accidental disk corruption or malicious command injection.


🏛️ Layered Architecture

┌──────────────────────────────────────────────────────────┐
│                   User Interface (UI)                    │
│   • Navigation Rail       • Partition Graph / List       │
│   • Dialogs & Modals      • Desktop Shortcut Menus       │
└────────────────────────────┬─────────────────────────────┘
                             │ Dispatches Typed Intents
┌──────────────────────────────────────────────────────────┐
│               Storage Operations Layer                   │
│   • StorageOperation      • PlannedCommand Planner       │
│   • Preflight Validation  • Disk Prediction Engine       │
│   • Operation Queue       • Risk Classification         │
└────────────────────────────┬─────────────────────────────┘
                             │ Validated Commands
┌──────────────────────────────────────────────────────────┐
│             Privileged Execution Subsystem               │
│   • Manifest-Backed Executable Registry                  │
│   • Central POSIX Single-Quote Sanitizer                 │
│   • Deterministic Environment Builder                    │
│   • First-Failure Stop Execution Loop                    │
└────────────────────────────┬─────────────────────────────┘
                             │ Transport: /system/bin/su -c
┌──────────────────────────────────────────────────────────┐
│       Verified Toolchain (Repo A) / System Root          │
│   • parted, blkid, mkfs.*, fsck.*, resize2fs, cryptsetup │
│   • Exact prefix: /data/data/vn.shadichy.parted/files    │
└──────────────────────────────────────────────────────────┘

🔒 Fixed Invariants

  1. Privilege Boundary: Widgets never construct raw shell strings, join lists with spaces, or invoke root processes directly. All user mutations produce immutable StorageOperation records.
  2. Deterministic Toolchain: Binaries must resolve from the manifest-backed registry under /data/data/vn.shadichy.parted/files/usr/bin. Android system $PATH builtins and toybox aliases are never used for toolchain-owned tools.
  3. First-Failure Stop: When executing a batch of planned commands, execution stops immediately upon the first non-zero exit code. Later commands are aborted, and a device rescan is performed to synchronize UI state with hardware reality.
  4. No Rollback Illusion: The application never falsely claims that destructive storage mutations (such as filesystem resizing or reformatting) can be automatically rolled back if cancelled mid-flight. Pending operations can be discarded before execution, but in-flight I/O is non-interruptible.
  5. Deterministic Environment: All commands run with an explicit environment:
    PATH=/data/data/vn.shadichy.parted/files/usr/bin:/data/data/vn.shadichy.parted/files/usr/bin/applets
    HOME=/data/data/vn.shadichy.parted/files/home
    TMPDIR=/data/data/vn.shadichy.parted/files/usr/tmp
    LC_ALL=C