KB-1312

B3-F1c-g VPS dot-dot-health Scheduler Repair — ROLLBACK Artifact (live-targeted)

7 min read Revision 1
dieu44p3dbirthb3f1c-gvps-targeteddot-dot-healthrollbackscheduler-repaircompile-only

B3-F1c-g VPS dot-dot-health Scheduler Repair — ROLLBACK Artifact (live-targeted)

Mode: COMPILE ROLLBACK ONLY (no execution) Target: /opt/incomex/dot/bin/dot-dot-health on VPS (38.242.240.89) Live VPS version: v2.0.0 (Fix25, 2026-04-21), 555 lines Companion patch: p3d-birth-b3f1c-g-vps-dot-dot-health-scheduler-repair-patch.md Pairs with: Hunk 1 (--local|--cloud no-op in parse_args) + Hunk 2 (BASH_SOURCE safe-source guard) Supersedes: p3d-birth-b3f1c-g-dot-dot-health-scheduler-repair-rollback.md (local-clone-based)


1. Rollback Strategy

Three independent rollback paths, in order of preference:

# Strategy When to use Reversibility
R1 Restore from timestamped backup .bak.b3f1c-g.<ts> Default — apply-time backup exists Byte-perfect, instant
R2 Reverse-apply unified diff Backup missing/corrupt Surgical
R3 git revert in /opt/incomex/dot Commit pushed/recorded; mem ref feedback_git_commit_after_vps_edit.md Standard git flow

The patch apply procedure (patch artifact §7) creates:

/opt/incomex/dot/bin/dot-dot-health.bak.b3f1c-g.<UTC-timestamp>

Rollback commands (run as root on VPS):

SRC=/opt/incomex/dot/bin/dot-dot-health
# Identify most-recent backup (DRY RUN — list only):
ls -lt "${SRC}.bak.b3f1c-g."* | head -3

# Choose the immediate-pre-patch backup, then restore:
BAK="${SRC}.bak.b3f1c-g.<UTC-timestamp>"
cp -p "$BAK" "$SRC"

# Verify byte-perfect restore:
sha256sum "$SRC" "$BAK"
# Two hashes MUST match.

Post-R1 verification (NON-MUTATING):

bash -n "$SRC"                                          # exit 0
grep -nE '^main "\$@"$' "$SRC"                          # 1 match at line 555
grep -nE '\-\-local\|\-\-cloud' "$SRC"                  # 0 matches in parse_args
grep -nE 'BASH_SOURCE\[0\].*\$0' "$SRC"                 # 0 matches

3. R2 — Reverse-apply unified diff

If R1 unavailable:

--- a/opt/incomex/dot/bin/dot-dot-health
+++ b/opt/incomex/dot/bin/dot-dot-health
@@ -163,7 +163,7 @@ usage() {
 parse_args() {
   while [[ $# -gt 0 ]]; do
     case "$1" in
       --help|-h)             usage; exit 0 ;;
       --dry-run)             DRY_RUN=1; shift ;;
       --verbose)             VERBOSE=1; shift ;;
       --only-check=*)        ONLY_CHECK="${1#*=}"; shift ;;
       --only-check)
         [[ $# -lt 2 ]] && { log_err "--only-check requires value"; exit 2; }
         ONLY_CHECK="$2"; shift 2 ;;
-      --local|--cloud)       shift ;;  # no-op: legacy DOT scheduler convention (env loaded from SSOT, Đ33 §14)
       *)
         log_err "Unknown option: $1"
         usage >&2
         exit 2 ;;
     esac
   done
 }
@@ -553,6 +552,4 @@ main() {
   exit 0
 }
 
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
-  main "$@"
-fi
+main "$@"

Apply:

# Save the diff above to /tmp/b3f1c-g-vps-rollback.diff, then:
cd /opt/incomex
patch -p1 < /tmp/b3f1c-g-vps-rollback.diff

4. R3 — Git revert (if patch was committed in /opt/incomex/dot)

Per memory feedback_git_commit_after_vps_edit.md, every VPS edit must be git commited. Therefore the patch should have a commit on the VPS-host repo /opt/incomex/dot.

cd /opt/incomex/dot
git log --oneline -5 -- bin/dot-dot-health
# Identify the B3-F1c-g commit SHA, then:
git revert --no-edit <SHA>

Per memory project_agent_data_repo_diverged.md: never git pull on diverged VPS repos. Edit host directly; the revert commit lives only on the VPS-host repo unless explicitly pushed.


5. Independent partial rollback

Each hunk is independently revertible:

Revert Hunk 1 only (keep safe-source guard, drop --local no-op)

@@ -163,8 +163,7 @@ usage() {
       --only-check)
         [[ $# -lt 2 ]] && { log_err "--only-check requires value"; exit 2; }
         ONLY_CHECK="$2"; shift 2 ;;
-      --local|--cloud)       shift ;;  # no-op: legacy DOT scheduler convention (env loaded from SSOT, Đ33 §14)
       *)

Not recommended — re-opens the cron --local rejection (the primary defect).

Revert Hunk 2 only (keep --local no-op, drop safe-source guard)

@@ -553,6 +553,4 @@ main() {
   exit 0
 }
 
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
-  main "$@"
-fi
+main "$@"

Not recommended — re-exposes the B3-F1c-f source-time mutation incident path (source dot-dot-health triggers system_issues INSERTs via verify_all → log_issue → fn_log_issue).


6. Post-rollback verification (NON-MUTATING)

After any R1/R2/R3:

Check Command Expected (full rollback)
Syntax bash -n /opt/incomex/dot/bin/dot-dot-health exit 0
Bare main present grep -n '^main "\$@"$' /opt/incomex/dot/bin/dot-dot-health 1 match at line 555
No-op case absent grep -nE '\-\-local|\-\-cloud' /opt/incomex/dot/bin/dot-dot-health 0 matches inside parse_args (lines 164-180)
Source guard absent grep -nE 'BASH_SOURCE\[0\].*\$0' /opt/incomex/dot/bin/dot-dot-health 0 matches
--help non-mutating /opt/incomex/dot/bin/dot-dot-health --help usage banner, exit 0

Important post-rollback caveat: rolling back re-introduces the cron failure (cron will resume exit 2 rejections at 03:00 UTC) AND re-introduces the source-time mutation risk. Do not rollback without immediately scheduling a follow-up repair.

No mutating verification — no bare dot-dot-health --local, no --dry-run, no cron retrigger.


7. Cron behavior under rollback

The cron line is never modified by this patch or its rollback:

0 3 * * * /opt/incomex/dot/bin/dot-dot-health --local >> /var/log/incomex/dot-health.log 2>&1

So rollback automatically restores the pre-patch failure mode (cron fails at 03:00 with Unknown option: --local). Monitor /var/log/incomex/dot-health.log after rollback to confirm the failure pattern returns (read-only tail -f).


8. Status

rollback_compiled=true
rollback_paths_count=3
hunk_independent_rollback=true
target_file_vps_path=/opt/incomex/dot/bin/dot-dot-health
target_vps_version=v2.0.0
execution_allowed=false
next_recommended_action=GPT_REVIEW_B3F1C_G_VPS_PATCH_ARTIFACT
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/artifacts/p3d-birth-b3f1c-g-vps-dot-dot-health-scheduler-repair-rollback.md