Complete the header template across Partnership, Kernel, Deployment and Plugin

Finishes the pass: every script now documents its safeguards, and the deliberate absences
in the sourced libraries are recorded so they are not "corrected" later.
This commit is contained in:
Gmer4Lfe
2026-08-01 22:44:23 -04:00
parent 5c4f8db497
commit c377ddfcca
24 changed files with 1237 additions and 32 deletions
+73
View File
@@ -37,6 +37,79 @@
# Step 8: SSH revocation — revoke keys both directions, write state, signal owner
#
# ==============================================================================================
# DESIGN PRINCIPLES
# ==============================================================================================
#
# Sync Before Severing
# The final sync (owner step 2) runs before any state change, so the mirror leaves with
# current Critical-Data rather than a snapshot from whenever the last scheduled sync
# happened. Once keys are revoked there is no second chance to move data.
#
# Stop the Sync First
# Step 1 on both paths halts rsync before anything else. A sync running through a
# partnership teardown would be writing to a partner that is having its access removed
# underneath it.
#
# Revoke Last, Not First
# SSH keys and Emby admin are revoked at the end. Every earlier step needs working remote
# access — revoking up front would strand the remaining cleanup on the far side and leave
# the mirror holding containers nobody can remove.
#
# Both Sides Land Somewhere Valid
# Each path restarts the host's own parked containers before finishing. Offboarding must
# leave two working standalone servers, not one working server and one stripped of the
# coverage it was relying on.
#
# Role Detected, Not Declared
# Owner and mirror run different sequences, and the role is derived rather than passed in.
# A human choosing the wrong path would run the owner's remote-cleanup steps against a
# server that never deployed anything.
#
# Blocklist Is the Enforcement
# Writing INACTIVE state is not enough on its own — a stale cron or a script mid-flight
# could still attempt a sync. The mirror is blocklisted so rsync.sh refuses it outright,
# independently of whatever any config still says.
#
# ==============================================================================================
# OPERATIONAL SAFEGUARDS
# ==============================================================================================
#
# Root Enforcement
# Container removal, conf edits and SSH key revocation all require root.
#
# Lock Acquisition
# acquire_lock "strict" — an offboard is not resumable partway, so a second instance is
# refused rather than queued behind the first.
#
# Host Detection
# detect_hosts() resolves MY_ID / REMOTE_ID, which the role detection builds on.
#
# Docker Presence Check
# Verified before any container removal is attempted.
#
# Ordered Teardown
# The step sequence is the safeguard — sync, then reconfigure, then remove, then restart,
# then revoke, then record. Reordering breaks the guarantees above.
#
# Own Stack Restored
# Parked containers are brought back up on both sides before the run completes.
#
# State Written Both Ends
# INACTIVE is written locally and pushed to the mirror, so neither side is left believing
# a partnership is still active.
#
# Partner Blocklisted
# The mirror is added to the partnership blocklist, which rsync.sh checks and refuses on —
# stale access cannot survive the offboard.
#
# Tailscale Grace Window
# Device removal happens after state is written, not before, so the final state push
# cannot be cut off by removing its own transport.
#
# Dry Run Support
# --dry-run walks the full sequence reporting each step without executing any.
#
# ==============================================================================================
# CONFIGURATION
# ==============================================================================================
#