testsAndMisc/docs/superpowers/specs/2026-05-01-phone-focus-recovery/DOCS-05-safety-and-testing.md
Krzysztof kuhy Rudnicki 49d82511c3 Adopt the four markdown namespaces and gate them
Renames this repo's markdown onto README.md / CLAUDE*.md / DOCS*.md /
TODO*.md so a future session can tell a live task from a finished
record without reading the file to find out.

TODO files carry the literal "REMOVE ME AFTER FINISH" and are deleted
when the work lands. Enforced by the md-naming pre-commit hook and CI
workflow, both delegating to the shared gate in kuhyx/utils so this
repo's idea of a valid name cannot drift from every other repo's.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A47aX5DJwmA3QFn3pkEWi7
2026-08-24 15:55:46 +02:00

2.1 KiB
Raw Blame History

Automation safety rules, testing expectations and non-goals

Automation safety rules

Because the phone may appear repeatedly over USB or Wi-Fi, automation must be conservative.

Required safeguards:

  • single-instance lock to prevent overlapping runs
  • cooldown window so repeated reconnects do not trigger backup storms
  • clear separation between lightweight auto mode and heavier full-backup behavior
  • retry and backoff rules for transient ADB failures
  • no automatic fresh-phone restore without explicit user intent

Testing and verification expectations

The implementation phase should follow strict shell hygiene and repository quality rules.

  • use set -euo pipefail
  • prefer reusable functions over repeated ADB snippets
  • validate parameters and environment clearly
  • keep destructive operations explicit and well-logged
  • add tests where practical for shell logic or parser behavior
  • run pre-commit run --files <changed-files> before claiming completion

Verification must include:

  • shell syntax validation
  • targeted script execution in safe modes
  • README/help-text verification against the approved user flows
  • evidence that backups and monitoring output are actually produced

Constraints and non-goals

The design deliberately does not promise impossible guarantees.

  • It cannot make a rooted phone impossible to tamper with locally.
  • It cannot safely restore every app’s private data without app-specific risk.
  • It should prefer explicit warnings over pretending unsupported restores are safe.

The goal is a robust, repeatable, operator-friendly recovery and monitoring system, not an infallible anti-root fortress.

Open implementation notes

  • Reuse code patterns already present in linux_configuration/scripts/utils/ and python_pkg/screen_locker/_phone_verification.py where they help with ADB detection and wireless reconnection.
  • Keep the wrapper stable even if the internal phone implementation evolves.
  • Preserve the existing deploy.sh value rather than rewriting it from scratch.
  • Make backup scope declarative so expanding or narrowing coverage does not require editing core shell control flow.