KB-E016

B3-F1c-g dot-dot-health Scheduler Repair — ROLLBACK Artifact

5 min read Revision 1
dieu44p3dbirthb3f1c-gdot-dot-healthrollbackscheduler-repaircompile-only

B3-F1c-g dot-dot-health Scheduler Repair — ROLLBACK Artifact

Mode: COMPILE ROLLBACK ONLY (no execution) Target file: web-test/dot/bin/dot-dot-health Companion patch: p3d-birth-b3f1c-g-dot-dot-health-scheduler-repair-patch.md Pairs with: Hunk 1 (parse_args no-op) + Hunk 2 (safe source guard)


1. Rollback Strategy

Two independent rollback paths, in order of preference:

# Strategy When to use Reversibility
R1 Restore from timestamped backup (.bak.b3f1c-g.<ts>) Default — backup made at apply time Instant, byte-perfect
R2 Reverse-apply unified diff Backup missing or corrupted Surgical, requires diff tool
R3 Git revert If commit was made and pushed Standard git flow

The patch apply procedure (§6 of patch artifact) creates:

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

Rollback command:

cd /opt/incomex/dot
# Identify the backup (most recent matching pattern):
ls -lt bin/dot-dot-health.bak.b3f1c-g.* | head -1
# Replace live with backup (USER ACTION — not executed by drafter):
cp bin/dot-dot-health.bak.b3f1c-g.<UTC-timestamp> bin/dot-dot-health
# Verify byte-perfect restore:
sha256sum bin/dot-dot-health bin/dot-dot-health.bak.b3f1c-g.<UTC-timestamp>
# Two hashes must match.

Verification after R1:

bash -n bin/dot-dot-health                              # syntax OK
grep -n 'main "\$@"$' bin/dot-dot-health                # bare main "$@" restored
grep -nE '--local|--cloud' bin/dot-dot-health           # no-op cases gone

3. R2 — Reverse-apply unified diff

If R1 unavailable, apply the inverse of the patch:

--- a/web-test/dot/bin/dot-dot-health
+++ b/web-test/dot/bin/dot-dot-health
@@ -95,8 +95,7 @@ log_system_issue() {
 main() {
   for arg in "$@"; do
     case "$arg" in
-      --help|-h)        show_help; exit 0 ;;
-      --local|--cloud)  : ;;  # no-op: environment flag consumed by init_environment
+      --help|-h) show_help; exit 0 ;;
     esac
   done
 
@@ -298,6 +297,4 @@ main() {
   echo "========================================="
 }
 
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
-  main "$@"
-fi
+main "$@"

Apply with:

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

4. R3 — Git revert (if patch was committed)

cd /opt/incomex/dot                       # or appropriate repo root
git log --oneline -- bin/dot-dot-health | head -5
# Identify the B3-F1c-g commit SHA, then:
git revert --no-edit <SHA>
git commit --amend -m "revert: B3-F1c-g dot-dot-health scheduler repair (rollback)"

Per memory feedback_git_commit_after_vps_edit.md: if rollback edits the VPS-host copy of /opt/incomex/dot/bin/dot-dot-health directly, follow up with cd /opt/incomex/dot && git add -A && git commit to keep the VPS repo state consistent. Per memory project_agent_data_repo_diverged.md, never git pull on diverged VPS repos; edit host directly.


5. Independent partial rollback

Each hunk is independently revertible if only one needs to be undone:

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

@@ -95,8 +95,7 @@ log_system_issue() {
 main() {
   for arg in "$@"; do
     case "$arg" in
-      --help|-h)        show_help; exit 0 ;;
-      --local|--cloud)  : ;;  # no-op: environment flag consumed by init_environment
+      --help|-h) show_help; exit 0 ;;
     esac
   done

(Not recommended — re-opens the original cron failure.)

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

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

(Not recommended — re-exposes source-time mutation risk.)


6. Post-rollback verification (NON-MUTATING)

After any R1/R2/R3:

Check Command Expected
Syntax bash -n bin/dot-dot-health exit 0
Bare main present grep -n '^main "\$@"$' bin/dot-dot-health 1 match (last line)
No-op cases absent grep -nE '\-\-local|\-\-cloud' bin/dot-dot-health only Usage: lines
Source guard absent grep -n 'BASH_SOURCE' bin/dot-dot-health line 26 only (SCRIPT_DIR)
--help non-mutating bin/dot-dot-health --help usage banner, exit 0

No mutating verification (no bare execution, no cron retrigger). If cron behavior must be re-validated after rollback, schedule a dedicated session.


7. Status

rollback_compiled=true
rollback_paths_count=3
hunk_independent_rollback=true
execution_allowed=false
next_recommended_action=GPT_REVIEW_PATCH_ARTIFACT
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/artifacts/p3d-birth-b3f1c-g-dot-dot-health-scheduler-repair-rollback.md