From 7ad4353fd453e18666d6fee768c0f2ca0286ac1a Mon Sep 17 00:00:00 2001 From: Howard Enos Date: Mon, 22 Jun 2026 14:31:32 -0700 Subject: [PATCH] docs(memory): sync.sh Phase-3 submodule-clobber fixed; branch work now survives Co-Authored-By: Claude Opus 4.8 (1M context) --- .../feedback_submodule_autosync_discipline.md | 28 ++++++++++++------- errorlog.md | 2 ++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.claude/memory/feedback_submodule_autosync_discipline.md b/.claude/memory/feedback_submodule_autosync_discipline.md index 357ba08a..0630ee6a 100644 --- a/.claude/memory/feedback_submodule_autosync_discipline.md +++ b/.claude/memory/feedback_submodule_autosync_discipline.md @@ -5,11 +5,18 @@ metadata: type: feedback --- -The superproject's background auto-sync resets each submodule's working tree to the **pinned -gitlink** (which intentionally lags `main`), and 3-4 Claude sessions can share one submodule -checkout. So inside `projects/msp-tools/guru-rmm` (and guru-connect) **local branch refs / HEAD do -NOT reliably survive across tool calls or sessions** โ€” a `git switch -c feat` can get reset to the -gitlink mid-work, commits land on a detached HEAD, and `push -u origin ` ships a stale ref. +**UPDATE 2026-06-22:** `sync.sh` now protects submodule work on BOTH destructive paths. The +2026-06-21 fix only guarded the Phase-1a init (`sync.sh:391`, init-only-if-unpopulated); the +Phase-3 **post-rebase** reconcile (`sync.sh:525`) still ran `git submodule update --init +--recursive` unconditionally and re-detached/reset everything โ€” that's the path that ate a +feature branch + commits mid-build today. New `submodule_update_safe()` advances ONLY submodules +in the pristine pinned state (clean, detached HEAD) and SKIPS any on a branch or with uncommitted +changes. **So: working on a real branch in a submodule now survives sync.** Prefer that. + +Historically (and still as belt-and-suspenders), the auto-sync reset each submodule's working +tree to the **pinned gitlink** (which intentionally lags `main`), and 3-4 Claude sessions can +share one submodule checkout โ€” so local branch refs / HEAD could get reset to the gitlink +mid-work, commits land on a detached HEAD, and `push -u origin ` ships a stale ref. **Do this instead:** - **Feature work:** `git worktree add origin/main`, edit + commit + push there, then @@ -27,12 +34,13 @@ gitlink mid-work, commits land on a detached HEAD, and `push -u origin ` is HTTP, submodule is a different host; SSH key not authorized here). **Why:** recurring across the fleet (Howard-Home detached-HEAD x2 + a stale-gitlink audit; -GURU-5070 hit a non-fast-forward on a docs push this session). Each occurrence costs a -re-diagnose/rebuild cycle. Howard fixed the `sync.sh` submodule-clobber root cause + moved to -worktrees (2026-06-21), but the defensive discipline still applies. +GURU-5070 hit a non-fast-forward on a docs push; 2026-06-22 the Phase-3 path reset guru-rmm +mid-build). The 2026-06-21 fix was incomplete (Phase-1a only); the 2026-06-22 fix +(`submodule_update_safe()`) closes the Phase-3 post-rebase path too. -**How to apply:** worktree or push-by-SHA + `ls-remote` verify for writes; assert HEAD==origin/main -(or read `origin/main:`) before audits; never `checkout --` shared files. +**How to apply:** Work on a real branch in the submodule (now survives sync) and push it to origin. +Belt-and-suspenders for high-stakes writes: push-by-SHA + `ls-remote` verify. Assert +HEAD==origin/main (or read `origin/main:`) before audits; never `checkout --` shared files. Related: [[gururmm-session-logs-submodule-save]] [[feedback_gururmm_build_verification]] [[feedback_verify_committed_state_before_push]] [[using-git-worktrees]] diff --git a/errorlog.md b/errorlog.md index 38dae653..3c79aded 100644 --- a/errorlog.md +++ b/errorlog.md @@ -17,6 +17,8 @@ Categories (the `[type]` tag): _(none)_ = skill/command execution failure ยท +2026-06-22 | Howard-Home | sync/submodules | [friction] Phase-3 'git submodule update --init --recursive' reset guru-rmm submodule to pinned commit, discarding feature branch + commits mid-build; fix: submodule_update_safe() skips branch/dirty submodules [ctx: ref=sync.sh:525 fixed] + 2026-06-22 | Howard-Home | save/wiki-compile | [friction] /save Phase 3 emits 'project:guru-rmm' (from submodule dir name) but canonical wiki article is 'gururmm'; guru-rmm.md is a tombstone redirect. Map guru-rmm -> gururmm in the slug derivation. [ctx: ref=wiki-slug-tombstone proj=guru-rmm] 2026-06-22 | Howard-Home | gururmm/product-direction | [correction] assumed RMM should build native virus/malware removal; correct is: AV products do removal, RMM only monitors AV reports + sends commands to AV products, and RMM's own built-in value is helping techs find issues