detail
USR369 asked how the housekeeping sweep is prevented from deleting things it shouldn't. Investigated the exact incident from the first live sweep run (PEEK.php/JANUS.php/ROTATE.php wrongly flagged as orphans and trashed) rather than just building a generic audit -- found 2 real, distinct root causes: (1) CLEAN.php has a HARDCODED $WHITELIST array, completely SEPARATE from the .htaccess FilesMatch allowlist in the same directory -- last updated 07/20/26, never touched since. All 5 commands added to systems/commands/ this session (PEEK, JANUS, ROTATE, GOV-INVENTORY, HOUSEKEEPING-SWEEP) plus TASKGATE.php (older, separately confirmed it had zero protection too, just hadn't been swept yet by chance) were completely unprotected by this list. (2) A SECOND, independent safety net exists -- any PHP with a versioned docblock header is supposed to be automatically protected regardless of the whitelist -- but its regex required a /* */-style block comment as an anchor before it would even look for a version marker. PEEK.php/JANUS.php (CC[100], 08/21/26) use // line-comment headers instead -- equally valid PHP, just a different convention -- so this protection silently never matched them at all despite the real 'Version: v1.0' text sitting right there. Both bugs had to align for the incident to happen; either one alone would have caught it. FIXED: broadened the docblock regex to accept either comment style; added all 6 missing files to the hardcoded whitelist with a comment flagging that this list and .htaccess are two separate sources of truth needing manual sync (a durable single-source-of-truth refactor would be better long-term but is a bigger change than the immediate fix warranted right now). RESTORED all 3 wrongly-trashed files from backups/40-server/trash/ (ROTATE.php had already auto-archived to trash/archive/ per its own 3-day rule, found and restored from there). Verified: dry-run CLEAN.php post-fix shows orphans_found:[] , and all 3 restored files functionally confirmed working again (PEEK.php real response, ROTATE.php correctly reaching its own decade-validation logic instead of a 403/404).