KB-1352

B3-F1c-g dot-dot-health Scheduler Repair — Patch Compilation Report

6 min read Revision 1
dieu44p3dbirthb3f1c-gdot-dot-healthreportpatch-compilescheduler-repair

B3-F1c-g dot-dot-health Scheduler Repair — Patch Compilation Report

Session: B3-F1c-g (Birth, Phase 3d, Frame 1c-g) Date (UTC): 2026-05-14 Mode: COMPILE PATCH + ROLLBACK ONLY — no execution Author: Claude (Opus 4.7, 1M context) Artifacts produced:

  • knowledge/dev/laws/dieu44-trien-khai/artifacts/p3d-birth-b3f1c-g-dot-dot-health-scheduler-repair-patch.md
  • knowledge/dev/laws/dieu44-trien-khai/artifacts/p3d-birth-b3f1c-g-dot-dot-health-scheduler-repair-rollback.md

1. Hard-boundary attestation

Boundary Adhered
No file modification (source script) YES — dot-dot-health was only read (Read tool); never edited
No cron modification YES — cron not touched, not even inspected for writes
No PG mutation YES — no run_pg, no psql, no docker exec invoked
No function invocation YES — no script function called
No running dot-dot-health YES — script not executed (not even --help)
No running fn_birth_onboarding_full_scan YES — function untouched
No system_health_checks INSERT YES — table untouched
No execution YES — only Read + grep (read-only) for context

Only read-only operations performed: find (locate file), Read (inspect script), grep on environment.sh (inspect env parser), crontab -l (read-only listing, returned no match — local mac has no cron entry for this DOT, as expected).


2. Defect summary

Reported: dot-dot-health cron broken — root cron passes --local, but parse_args rejects it.

Source inspection findings:

  • dot-dot-health v1.0.0, 301 lines, at web-test/dot/bin/dot-dot-health.
  • The inline "parse_args" is a for arg in "$@"; case block at lines 96-100, matching only --help|-h. No default reject case exists in this local copy — --local would fall through silently here.
  • init_environment (web-test/dot/config/environment.sh:249-255) does accept --local|--cloud correctly.
  • Documented usage in script header (lines 21, 49): dot-dot-health [--cloud|--local] — promise made but not enforced at the parse loop level.
  • Mutation path confirmed: main() calls log_system_issue (curl POST to /items/system_issues) on every check failure; Check 2 also POSTs to /items/approval_requests. Source-time mutation risk via bare main "$@" (line 300) is real if another script sources this file.

VPS divergence caveat: The reported "parse_args rejects --local" symptom is not directly reproducible against the local clone (the case-statement falls through). The VPS-resident /opt/incomex/dot/bin/dot-dot-health likely has a stricter default case OR the failure manifests in a downstream call (init_environment, dot-auth, print_environment_banner) under root cron's minimal PATH. Reviewer must diff VPS source vs. local clone before applying. The patch is safe and correct either way — it's a no-op-or-fix.


3. Decision rationale (recommended_repair_option)

Selected: ADD_LOCAL_NOOP_FLAG

Per user directive and B3-MAINLINE-RESUME §3.7 convention:

  • Multiple DOT scripts use --local in root cron.
  • Removing --local from this single cron line would diverge.
  • Adding --local|--cloud as an accepted no-op (the case actually delegates to init_environment "$@") is minimal, backward-compatible, and convention-preserving.

Both alternatives rejected with reasons documented in patch artifact §1.


4. Patch composition (compiled, not applied)

Hunk Location Change Lines added Lines removed
H1 — parse_args no-op line 96-100 Add --local|--cloud) : ;; case (with explanatory comment) +1 (+1 reformat of --help line spacing) -1 (reformatted --help line)
H2 — safe source guard line 300 Wrap main "$@" in if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then ... fi +2 -1

Net: +5 lines, -2 lines, no logic deletion, no behavior change for --help / bare exec / --cloud / --local direct invocation paths.


5. Verification plan compiled (NON-MUTATING)

Compiled in patch artifact §5:

  • V1 bash -n — syntax check (parse-only, proven non-mutating)
  • V2 static grep on parse_args block (read-only)
  • V3 static grep on safe source guard (read-only)
  • V4 --help invocation — proven non-mutating by code-path analysis: the --help case fires inside main()'s arg loop BEFORE init_environment, BEFORE dot-auth, BEFORE any check / run_pg / log_system_issue / curl. show_help is stdout-only (heredoc + show_environment_help helper).
  • V5 EXCLUDED — bare execution would run all 9 checks and POST to system_issues + approval_requests. No --dry-run flag exists. Explicitly omitted from verification plan.

6. Rollback compilation

Three independent rollback paths compiled:

  • R1 restore from .bak.b3f1c-g.<UTC-timestamp> (recommended)
  • R2 reverse-apply unified diff
  • R3 git revert

Per-hunk independent rollback also documented (with caveats — partial rollback re-opens defects). Rollback is byte-perfect reversible via R1.


7. Open items for GPT review

  1. Confirm VPS source matches local v1.0.0 (or quote VPS diff) before applying.
  2. Confirm cron line for dot-dot-health actually passes --local (and confirm no other surprising flags are passed under root cron's PATH/env).
  3. Confirm dot-auth accepts --local at line 112 — out of scope for this patch but adjacent.
  4. Decide commit strategy — single commit covering both hunks, or two separate commits (one per hunk) for cleaner revert granularity.
  5. Confirm timing — applying outside cron tick window minimizes interference with a concurrent run.

8. Final status block

b3f1c_g_patch_compile_status=PASS
recommended_repair_option=ADD_LOCAL_NOOP_FLAG
safe_source_guard_included=true
patch_compiled=true
rollback_compiled=true
execution_allowed=false
next_recommended_action=GPT_REVIEW_PATCH_ARTIFACT
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reports/p3d-birth-b3f1c-g-dot-dot-health-scheduler-repair-patch-report.md