diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-04 12:53:18 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-04 12:53:18 -0500 |
| commit | bc4befa139781801b41231ef1b0d3be8939d04a1 (patch) | |
| tree | 1852956681bc0ec143360d52f1ff96d4530a969e /.ai/scripts/route-batch | |
| parent | 44af1b2ae955a6deac3be75b5d3495b17c8b3ad9 (diff) | |
| download | rulesets-bc4befa139781801b41231ef1b0d3be8939d04a1.tar.gz rulesets-bc4befa139781801b41231ef1b0d3be8939d04a1.zip | |
fix(startup): skip the .ai/ template sync when the project branch is behind
Phase A step 3 guarded its template rsync only on whether rulesets' own source was clean, never on whether the project branch was current. When a branch is diverged or behind-and-dirty, Phase A.0 correctly declines to fast-forward, but the rsync then landed templates on the stale committed .ai/ baseline. The diff came out huge (measured against old content) and conflicted once the branch reconciled to upstream's newer templates. home hit it today: a 3-ahead/46-behind divergence produced ~25 files of phantom drift nobody authored.
I added a second guard: after Phase A.0's reconcile, it re-checks git rev-list @{u}...HEAD and skips the rsync when behind>0. It composes with the rulesets-clean guard, so both a stable source and a current branch are required before the sync runs. No-upstream and ahead-only both fall through and sync, which is correct.
It's deliberately not an auto-discard: a legitimate local stopgap in a synced file can't be told from accidental drift by content alone, so prevention is safe where blind cleanup isn't. Phase C's churn safety net still surfaces pre-existing dirt.
home proposed this via inbox handoff.
Diffstat (limited to '.ai/scripts/route-batch')
0 files changed, 0 insertions, 0 deletions
