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
+78
View File
@@ -49,6 +49,84 @@
# platform_push_setup_state — push wizard setup state to WebGUI PHP
#
# ==============================================================================================
# DESIGN PRINCIPLES
# ==============================================================================================
#
# One Place Knows the OS
# Every Unraid-specific path, rc.d script and config location lives here. Scripts never
# branch on OS and never hardcode /etc/rc.d, /boot/config or dynamix paths. That is what
# makes a second platform a single new file rather than a hundred edits.
#
# Never Exit, Always Return
# No function here calls exit. A platform capability being absent is information the
# caller needs, not a decision the adapter gets to make — a watchdog may want to skip a
# check where an installer wants to abort, and only they know which.
#
# Report, Do Not Remediate
# The adapter answers questions and performs the single action asked of it. It does not
# retry, escalate, notify or heal. Every one of those policies belongs to the caller, and
# burying them here would make identical calls behave differently per platform.
#
# Stdout Is the Return Channel
# Value-producing functions write to stdout and are captured with $(). Status is carried
# by the exit code. Keeping those separate is what lets callers use them in conditionals
# without parsing output.
#
# ==============================================================================================
# OPERATIONAL SAFEGUARDS
# ==============================================================================================
#
# No Root, No Lock, No detect_hosts — Deliberate
# This is a sourced library, loaded by load_config.sh whenever PLATFORM=unraid. It runs
# inside the caller's process and holds no state of its own. A root check here would fire
# for every script in the ecosystem including read-only ones, and a lock would be taken
# on every source. The executable scripts own those gates. Do not "fix" this to match them.
#
# Executable Validation Before Use
# platform_require_cmd() and the rc.d helpers verify a target exists and is executable
# before invoking it, so a missing platform binary returns a clean failure rather than a
# command-not-found in the middle of a caller's flow.
#
# Notification Is Best-Effort
# platform_send_os_notification() returns 1 if the dynamix notify script is absent rather
# than failing the caller. A missing notifier must never turn a successful operation into
# a reported failure.
#
# Graceful Degradation on Unknown Services
# _platform_rc_script() falls through to /etc/rc.d/rc.<name> for any service it does not
# explicitly map, so a new service works without an adapter change — and still fails
# cleanly if that path does not exist.
#
# ==============================================================================================
# CONFIGURATION
# ==============================================================================================
#
# None of its own. The adapter is selected by PLATFORM in varaverk.cfg, which load_config.sh
# uses to source Plugin/$PLATFORM/adapter.sh.
#
# It reads platform-owned files rather than Varaverk config:
#
# /boot/config/plugins/dynamix/dynamix.cfg disk temperature thresholds
# /boot/config/plugins/varaverk/varaverk.cfg SCRIPTS_DIR probe
# /boot/config/plugins/dockerMan/templates-user container rebuild templates
# /etc/rc.d/rc.* service control
#
# Those paths are Unraid's, not Varaverk's — which is exactly why they are confined to this
# file. STATE_DIR, DATA_DIR and friends belong to master.conf and are not the adapter's
# concern.
#
# ==============================================================================================
# RUNTIME MODES
# ==============================================================================================
#
# None — sourced, never executed:
#
# source "$LOAD_CONFIG_DIR/Plugin/$PLATFORM/adapter.sh"
#
# No argument parsing, no --dry-run, no --status. Callers that need a dry run implement it
# around the platform_*() call, since only they know which of their actions are destructive.
#
# ==============================================================================================
# ──────────────────────────────────────────────────────────────────────────────────────────────
# Internal: map a logical service name → its rc.d script path