Add managed state backup/import and certificate operations

WH
25d ago
+10410-515

Summary

Adds the Managed State transfer and backup import/export operations, together with HTTPS certificate capture and restoration, behind the selected privilege backend. This PR is stacked on PR #4; Normal Mode continues to use the app-UID backend.

Validation

  • Recorded validation for this commit: make test passed (486 tests across 38 suites); make all passed.
  • Physical-device root/SELinux qualification: NOT RUN.

Stack

Base: codex/rootbackend-transport-execution-and-recovery (PR #4)
Head: codex/privileged-managed-state-and-backup-import
This PR contains one implementation commit. The later folder/script/tuning slice remains separate.


Summary by cubic

Adds Managed State transfer, backup/import, and HTTPS certificate capture and restoration through the selected privilege backend. Normal Mode still uses app-UID file operations, while RootBackend performs the same state operations through bounded, operation-scoped root helper sessions; a failed privileged operation reports a failure instead of falling back.

  • Backup archives never change the device-local Superuser Mode preference; an import preserves the value this device had before.
  • HTTPS certificate mutations capture the prior pair and restore it exactly on failed verification, including across service restarts.
  • All filesystem access is expressed in approved Managed State members and operation-owned staging directories, never caller-supplied paths, with symbolic-link and partial-transfer checks.
  • The docs/superpowers design and plan documents for the superuser runtime redesign are included in this PR.